Documentation ¶
Index ¶
Constants ¶
View Source
const ( //ColumnsEvent represents all fields of an event ColumnsEvent = iota + 1 //ColumnsMaxSequence represents the latest sequence of the filtered events ColumnsMaxSequence )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct { // ID is to refer to the asset ID string //Asset is the actual image Asset []byte //Action defines if asset should be added or removed Action AssetAction }
Asset represents all information about a asset (img)
type AssetAction ¶
type AssetAction int32
const ( AssetAdded AssetAction = iota AssetRemoved )
func (AssetAction) Valid ¶
func (f AssetAction) Valid() bool
type Columns ¶
type Columns int32
Columns defines which fields of the event are needed for the query
type Event ¶
type Event struct { //ID is a generated uuid for this event ID string //Sequence is the sequence of the event Sequence uint64 //PreviousAggregateSequence is the sequence of the previous sequence of the aggregate (e.g. org.250989) // if it's 0 then it's the first event of this aggregate PreviousAggregateSequence uint64 //PreviousAggregateTypeSequence is the sequence of the previous sequence of the aggregate root (e.g. org) // the first event of the aggregate has previous aggregate root sequence 0 PreviousAggregateTypeSequence uint64 //CreationDate is the time the event is created // it's used for human readability. // Don't use it for event ordering, // time drifts in different services could cause integrity problems CreationDate time.Time //Type describes the cause of the event (e.g. user.added) // it should always be in past-form Type EventType //Data describe the changed fields (e.g. userName = "hodor") // data must always a pointer to a struct, a struct or a byte array containing json bytes Data []byte //EditorService should be a unique identifier for the service which created the event // it's meant for maintainability EditorService string //EditorUser should be a unique identifier for the user which created the event // it's meant for maintainability. // It's recommend to use the aggregate id of the user EditorUser string //Version describes the definition of the aggregate at a certain point in time // it's used in read models to reduce the events in the correct definition Version Version //AggregateID id is the unique identifier of the aggregate // the client must generate it by it's own AggregateID string //AggregateType describes the meaning of the aggregate for this event // it could an object like user AggregateType AggregateType //ResourceOwner is the organisation which owns this aggregate // an aggregate can only be managed by one organisation // use the ID of the org ResourceOwner sql.NullString }
Event represents all information about a manipulation of an aggregate
type Field ¶
type Field int32
Field is the representation of a field from the event
const ( //FieldAggregateType represents the aggregate type field FieldAggregateType Field = iota + 1 //FieldAggregateID represents the aggregate id field FieldAggregateID //FieldSequence represents the sequence field FieldSequence //FieldResourceOwner represents the resource owner field FieldResourceOwner //FieldEditorService represents the editor service field FieldEditorService //FieldEditorUser represents the editor user field FieldEditorUser //FieldEventType represents the event type field FieldEventType //FieldEventData represents the event data field FieldEventData )
type Filter ¶
Filter represents all fields needed to compare a field of an event with a value
type Operation ¶
type Operation int32
Operation defines how fields are compared
const ( // OperationEquals compares two values for equality OperationEquals Operation = iota + 1 // OperationGreater compares if the given values is greater than the stored one OperationGreater // OperationLess compares if the given values is less than the stored one OperationLess //OperationIn checks if a stored value matches one of the passed value list OperationIn //OperationJSONContains checks if a stored value matches the given json OperationJSONContains )
type Repository ¶
type Repository interface { //Health checks if the connection to the storage is available Health(ctx context.Context) error // PushEvents adds all events of the given aggregates to the eventstreams of the aggregates. // if unique constraints are pushed, they will be added to the unique table for checking unique constraint violations // This call is transaction save. The transaction will be rolled back if one event fails Push(ctx context.Context, events []*Event, uniqueConstraints ...*UniqueConstraint) error // Filter returns all events matching the given search query Filter(ctx context.Context, searchQuery *SearchQuery) (events []*Event, err error) //LatestSequence returns the latests sequence found by the the search query LatestSequence(ctx context.Context, queryFactory *SearchQuery) (uint64, error) Step20(ctx context.Context, latestSequence uint64) error }
Repository pushes and filters events
type SearchQuery ¶
SearchQuery defines the which and how data are queried
type UniqueConstraint ¶
type UniqueConstraint struct { //UniqueField is the field which should be unique UniqueField string //UniqueType is the type of the unique field UniqueType string //Action defines if unique constraint should be added or removed Action UniqueConstraintAction //ErrorMessage is the message key which should be returned if constraint is violated ErrorMessage string }
UniqueCheck represents all information about a unique attribute
type UniqueConstraintAction ¶
type UniqueConstraintAction int32
const ( UniqueConstraintAdd UniqueConstraintAction = iota UniqueConstraintRemoved )
func (UniqueConstraintAction) Valid ¶
func (f UniqueConstraintAction) Valid() bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.