chore: add pkg names
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// package diskstore provides a driver that reads and writes events to disk.
|
||||
|
||||
package diskstore
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// package driver defines interfaces to be used by driver implementations.
|
||||
package driver
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// package memstore provides a driver that reads and writes events to memory.
|
||||
package memstore
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// package projecter provides a driver middleware to derive new events from other events.
|
||||
package projecter
|
||||
|
||||
import (
|
||||
|
||||
@@ -80,10 +80,21 @@ func TestProjecter(t *testing.T) {
|
||||
is := is.New(t)
|
||||
ctx := context.Background()
|
||||
|
||||
var events []event.Event
|
||||
|
||||
wait := make(chan struct{})
|
||||
|
||||
mockEL := &mockEventLog{}
|
||||
mockEL.onRead = func(ctx context.Context, i1, i2 int64) (event.Events, error) {
|
||||
return event.NewEvents(), nil
|
||||
}
|
||||
mockEL.onAppend = func(ctx context.Context, e event.Events, u uint64) (uint64, error) {
|
||||
events = append(events, e...)
|
||||
if wait != nil && len(events) > 3 {
|
||||
close(wait)
|
||||
}
|
||||
return uint64(len(e)), nil
|
||||
}
|
||||
|
||||
mock := &mockDriver{}
|
||||
mock.onOpen = func(ctx context.Context, s string) (driver.Driver, error) {
|
||||
@@ -107,4 +118,12 @@ func TestProjecter(t *testing.T) {
|
||||
_, err = es.Read(ctx, "test", 0, 1)
|
||||
|
||||
is.NoErr(err)
|
||||
|
||||
_, err = es.Append(ctx, "test", event.NewEvents(event.NilEvent))
|
||||
is.NoErr(err)
|
||||
|
||||
<-wait
|
||||
|
||||
is.Equal(len(events), 4)
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// package streamer provides a driver to allow awaiting for new events to be added to a stream.
|
||||
package streamer
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// package es implements an event store and drivers for extending its functionality.
|
||||
package es
|
||||
|
||||
import (
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Aggregate implements functionality for working with event store streams as an aggregate.
|
||||
// When creating a new Aggregate the struct should have an ApplyEvent method and embed the AggregateRoot.
|
||||
type Aggregate interface {
|
||||
// ApplyEvent applies the event to the aggrigate state
|
||||
ApplyEvent(...Event)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// package event implements functionality for working with an eventstore.
|
||||
package event
|
||||
|
||||
import (
|
||||
@@ -28,6 +29,7 @@ func getULID() ulid.ULID {
|
||||
return ulid.MustNew(ulid.Now(), entropy)
|
||||
}
|
||||
|
||||
// Event implements functionality of an individual event used with the event store. It should implement the getter/setter for EventMeta and BinaryMarshaler/BinaryUnmarshaler.
|
||||
type Event interface {
|
||||
EventMeta() Meta
|
||||
SetEventMeta(Meta)
|
||||
|
||||
Reference in New Issue
Block a user