chore: move LoadForUpdate to seporate interface

This commit is contained in:
Jon Lundy committed 2022-09-30 14:56:28 -06:00
1 parent 129968d179
commit e7df4cc479
4 files changed
+107 -11

No files matched your search

+8 -1
View File
@@ -182,7 +182,14 @@ func (w *wrapper) LoadForUpdate(ctx context.Context, a event.Aggregate, fn func(
ctx, span := lg.Span(ctx)
defer span.End()
return w.up.LoadForUpdate(ctx, a, fn)
up := w.up
for up != nil {
if up, ok := up.(driver.EventLogWithUpdate); ok {
return up.LoadForUpdate(ctx, a, fn)
}
up = es.Unwrap(up)
}
return 0, es.ErrNoDriver
}
type position struct {