refactor: push commands in to cmd and ev to root as library

This commit is contained in:
Jon Lundy
2023-01-09 11:30:02 -07:00
parent 250395d6b3
commit 4fc9c78dae
58 changed files with 765 additions and 376 deletions

View File

@@ -5,8 +5,8 @@ import (
"context"
"strings"
"github.com/sour-is/ev"
"github.com/sour-is/ev/internal/lg"
"github.com/sour-is/ev/pkg/es"
"github.com/sour-is/ev/pkg/es/driver"
"github.com/sour-is/ev/pkg/es/event"
)
@@ -19,7 +19,7 @@ type projector struct {
func New(_ context.Context, fns ...func(event.Event) []event.Event) *projector {
return &projector{fns: fns}
}
func (p *projector) Apply(e *es.EventStore) {
func (p *projector) Apply(e *ev.EventStore) {
up := e.Driver
for up != nil {
@@ -29,7 +29,7 @@ func (p *projector) Apply(e *es.EventStore) {
return
}
up = es.Unwrap(up)
up = ev.Unwrap(up)
}
p.up = e.Driver
@@ -112,7 +112,7 @@ func (w *wrapper) Append(ctx context.Context, events event.Events, version uint6
span.RecordError(err)
continue
}
_, err = l.Append(ctx, event.NewEvents(e), es.AppendOnly)
_, err = l.Append(ctx, event.NewEvents(e), ev.AppendOnly)
span.RecordError(err)
}
}()

View File

@@ -5,7 +5,7 @@ import (
"testing"
"github.com/matryer/is"
"github.com/sour-is/ev/pkg/es"
"github.com/sour-is/ev"
"github.com/sour-is/ev/pkg/es/driver"
"github.com/sour-is/ev/pkg/es/driver/projecter"
"github.com/sour-is/ev/pkg/es/event"
@@ -112,10 +112,10 @@ func TestProjecter(t *testing.T) {
return mockEL, nil
}
es.Init(ctx)
es.Register(ctx, "mock", mock)
ev.Init(ctx)
ev.Register(ctx, "mock", mock)
es, err := es.Open(
es, err := ev.Open(
ctx,
"mock:",
projecter.New(ctx, projecter.DefaultProjection),