persistence

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionField

func ActionField(name string, val interface{}) *actionField

func NewExecutor

func NewExecutor(storage Pusher, afterExec func(act CompositeAction)) *executor

Types

type CompositeAction

type CompositeAction interface {
	// contains filtered or unexported methods
}

type DeleteAction

type DeleteAction struct {
	// contains filtered or unexported fields
}

func NewDeleteAction

func NewDeleteAction(deleteCondition map[string]interface{}) *DeleteAction

type InsertAction

type InsertAction struct {
	// contains filtered or unexported fields
}

func NewInsertAction

func NewInsertAction(pkHydrator func([]interface{}) error, box *persistBox) *InsertAction

func (*InsertAction) Box

func (i *InsertAction) Box() *entity.Box

type OnConflict

type OnConflict int
const (
	Undefined OnConflict
	DoNothing
)

type PersistGraph

type PersistGraph struct {
	// contains filtered or unexported fields
}

PersistGraph graph of database actions derived from entities.

func NewPersistGraph

func NewPersistGraph(
	checkInDirty func(box *d3entity.Box) (bool, error),
	originalFactory func(box *d3entity.Box) interface{},
) *PersistGraph

NewPersistGraph create new graph.

func (*PersistGraph) ProcessDeletedEntity

func (p *PersistGraph) ProcessDeletedEntity(box *d3entity.Box) error

func (*PersistGraph) ProcessEntity

func (p *PersistGraph) ProcessEntity(box *d3entity.Box) error

ProcessEntity process entity and all related entities into database actions.

type Pusher

type Pusher interface {
	Insert(table string, cols []string, values []interface{}, onConflict OnConflict) error
	InsertWithReturn(table string, cols []string, values []interface{}, returnCols []string, withReturned func(scanner Scanner) error) error
	Update(table string, cols []string, values []interface{}, identityCond map[string]interface{}) error
	Remove(table string, identityCond map[string]interface{}) error
}

type Scanner

type Scanner interface {
	Scan(...interface{}) error
}

type UpdateAction

type UpdateAction struct {
	// contains filtered or unexported fields
}

func NewUpdateAction

func NewUpdateAction(identityCondition map[string]interface{}) *UpdateAction

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL