feat(eventstore): sdk (#39)

* sdk

* fix(sdk): return correct error type

* AppendEventError instead of Aggregater error

* fix(tests): tests

* fix(tests): wantErr to is error func
This commit is contained in:
Silvan
2020-04-07 18:36:37 +02:00
committed by GitHub
parent 970586dfc9
commit 191690d905
27 changed files with 524 additions and 234 deletions

View File

@@ -24,11 +24,8 @@ type Aggregate struct {
editorUser string
resourceOwner string
Events []*Event
Appender appender
}
type appender func(...*Event)
func (a *Aggregate) AppendEvent(typ EventType, payload interface{}) (*Aggregate, error) {
if string(typ) == "" {
return a, errors.ThrowInvalidArgument(nil, "MODEL-TGoCb", "no event type")
@@ -81,8 +78,3 @@ func (a *Aggregate) Validate() error {
return nil
}
func (a *Aggregate) SetAppender(appendFn appender) *Aggregate {
a.Appender = appendFn
return a
}