Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deleter ¶
type Deleter interface { // Delete removes the provided entities from a persistent store. Delete(...interface{}) error }
Deleter represents a remover of entities.
type Inserter ¶
type Inserter interface { // Insert creates the provided entities in a persistent store. Insert(...interface{}) error }
Inserter represents a creator of entities.
type SQLUnitParameters ¶
type SQLUnitParameters struct { UnitParameters ConnectionPool *sql.DB }
SQLUnitParameters represents the dependencies and configuration required for SQL work units.
type TypeName ¶
type TypeName string
TypeName represents an entity's type.
func TypeNameOf ¶
func TypeNameOf(entity interface{}) TypeName
TypeNameOf provides the type name for the provided entity.
type Unit ¶
type Unit interface { // Register tracks the provided entities as clean. Register(...interface{}) // Add marks the provided entities as new additions. Add(...interface{}) error // Alter marks the provided entities as modifications. Alter(...interface{}) error // Remove marks the provided entities as removals. Remove(...interface{}) error // Save commits the new additions, modifications, and removals // within the work unit to a persistent store. Save() error }
Unit represents an atomic set of entity changes.
func NewBestEffortUnit ¶
func NewBestEffortUnit(parameters UnitParameters) Unit
NewBestEffortUnit constructs a work unit that when faced with adversity, attempts rollback a single time.
func NewSQLUnit ¶
func NewSQLUnit(parameters SQLUnitParameters) (Unit, error)
NewSQLUnit constructs a work unit for SQL stores.
type UnitParameters ¶
type UnitParameters struct { //Inserters indicates the mappings between inserters //and the entity types they insert. Inserters map[TypeName]Inserter //Updates indicates the mappings between updaters //and the entity types they update. Updaters map[TypeName]Updater //Deleters indicates the mappings between deleters //and the entity types they delete. Deleters map[TypeName]Deleter //Logger represents the logger that the work unit will utilize. Logger *zap.Logger //Scope represents the metric scope that the work unit will utilize. Scope tally.Scope }
UnitParameters represents the collection of dependencies and configuration needed for a work unit.
type Uniter ¶
Uniter represents a factory for work units.
func NewBestEffortUniter ¶
func NewBestEffortUniter(parameters UnitParameters) Uniter
NewBestEffortUniter constructs a new best effort unit factory.
func NewSQLUniter ¶
func NewSQLUniter(parameters SQLUnitParameters) Uniter
NewSQLUniter constructs a new SQL work unit factory.