fix: not found on create

This commit is contained in:
Jon Lundy 2023-01-11 22:06:56 -07:00
parent 5b09ea3e96
commit 2fb3fae61f
Signed by untrusted user who does not match committer: xuu
GPG Key ID: C63E6D61F3035024
2 changed files with 2 additions and 2 deletions

2
ev.go
View File

@ -335,7 +335,7 @@ func Create[A any, T PA[A]](ctx context.Context, es *EventStore, streamID string
attribute.String("agg.streamID", streamID),
)
if err = es.Load(ctx, agg); err != nil {
if err = es.Load(ctx, agg); err != nil && !errors.Is(err, ErrNotFound){
return
}

View File

@ -94,7 +94,7 @@ func TestES(t *testing.T) {
thing := &Thing{Name: "time"}
err = store.Load(ctx, thing)
is.NoErr(err)
is.True(errors.Is(err, ev.ErrNotFound))
t.Log(thing.StreamVersion(), thing.Name, thing.Value)