Documentation ¶
Index ¶
Constants ¶
View Source
const ( // EmptyEntityID represents an empty EntityID EmptyEntityID = EntityID("") )
Variables ¶
This section is empty.
Functions ¶
func IsValidEntityID ¶
Types ¶
type Action ¶
type Action struct { // Type of the action Type ActionType // EntityID of the instance in action EntityID EntityID // ModelName of the instance in action ModelName string // Previous is the instance before the action Previous interface{} // Current is the instance after the action was done Current interface{} }
Action is a operation done in the model
type ActionType ¶
type ActionType int
ActionType is the type used by actions done in a txn
const ( // Create indicates the creation of an instance in a txn Create ActionType = iota // Save indicates the mutation of an instance in a txn Save // Delete indicates the deletion of an instance by ID in a txn Delete )
type EventCodec ¶
type EventCodec interface { // Reduce applies generated events into state Reduce( events []Event, datastore ds.TxnDatastore, baseKey ds.Key, indexFunc func(model string, key ds.Key, oldData, newData []byte, txn ds.Txn) error, ) ([]ReduceAction, error) // Create corresponding events to be dispatched Create(ops []Action) ([]Event, format.Node, error) // EventsFromBytes deserializes a format.Node bytes payload into // Events. EventsFromBytes(data []byte) ([]Event, error) }
EventCodec transforms actions generated in models to events dispatched to thread logs, and viceversa.
type ReduceAction ¶
type ReduceAction struct { // Type of the reduced action Type ActionType // Model in which action was made Model string // EntityID of the instance in reduced action EntityID EntityID }
Click to show internal directories.
Click to hide internal directories.