chore: move LoadForUpdate to seporate interface

This commit is contained in:
Jon Lundy
2022-09-30 14:56:10 -06:00
parent 129968d179
commit e7df4cc479
4 changed files with 109 additions and 13 deletions

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 {