refactor(v2): init events (#7823)

creates events structures for initial projections and read models
This commit is contained in:
Silvan
2024-05-23 06:36:08 +02:00
committed by GitHub
parent f37113194d
commit 12be21a3ff
56 changed files with 1952 additions and 316 deletions

View File

@@ -36,7 +36,7 @@ func (pi *PushIntent) Instance() string {
return pi.instance
}
func (pi *PushIntent) Reduce(events ...*Event[StoragePayload]) error {
func (pi *PushIntent) Reduce(events ...*StorageEvent) error {
if pi.reducer == nil {
return nil
}
@@ -170,21 +170,3 @@ func AppendCommands(commands ...Command) PushAggregateOpt {
pa.commands = append(pa.commands, commands...)
}
}
type Command interface {
// Creator is the id of the user which created the action
Creator() string
// Type describes the action it's in the past (e.g. user.created)
Type() string
// Revision of the action
Revision() uint16
// Payload returns the payload of the event. It represent the changed fields by the event
// valid types are:
// * nil: no payload
// * struct: which can be marshalled to json
// * pointer to struct: which can be marshalled to json
// * []byte: json marshalled data
Payload() any
// UniqueConstraints should be added for unique attributes of an event, if nil constraints will not be checked
UniqueConstraints() []*UniqueConstraint
}