fix: not found on create
This commit is contained in:
parent
5b09ea3e96
commit
2fb3fae61f
2
ev.go
2
ev.go
|
@ -335,7 +335,7 @@ func Create[A any, T PA[A]](ctx context.Context, es *EventStore, streamID string
|
||||||
attribute.String("agg.streamID", streamID),
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ func TestES(t *testing.T) {
|
||||||
|
|
||||||
thing := &Thing{Name: "time"}
|
thing := &Thing{Name: "time"}
|
||||||
err = store.Load(ctx, thing)
|
err = store.Load(ctx, thing)
|
||||||
is.NoErr(err)
|
is.True(errors.Is(err, ev.ErrNotFound))
|
||||||
|
|
||||||
t.Log(thing.StreamVersion(), thing.Name, thing.Value)
|
t.Log(thing.StreamVersion(), thing.Name, thing.Value)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user