test

package
v0.39.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KindAccount        = eventsourcing.Kind("Account")
	KindAccountCreated = eventsourcing.Kind("AccountCreated")
	KindMoneyDeposited = eventsourcing.Kind("MoneyDeposited")
	KindMoneyWithdrawn = eventsourcing.Kind("MoneyWithdrawn")
	KindOwnerUpdated   = eventsourcing.Kind("OwnerUpdated")
)
View Source
var (
	KindAccountV2        = eventsourcing.Kind("Account_V2")
	KindAccountCreatedV2 = eventsourcing.Kind("AccountCreated_V2")
	KindOwnerUpdatedV2   = eventsourcing.Kind("OwnerUpdated_V2")
)

Functions

func DockerCompose added in v0.34.0

func DockerCompose(t *testing.T, path, service string, wait time.Duration)

func MigrateAccountCreated added in v0.21.0

func MigrateAccountCreated[K eventsourcing.ID](e *eventsourcing.Event[K], codec eventsourcing.Codec[K]) (*eventsourcing.EventMigration, error)

func MigrateOwnerUpdated added in v0.21.0

func MigrateOwnerUpdated[K eventsourcing.ID](e *eventsourcing.Event[K], codec eventsourcing.Codec[K]) (*eventsourcing.EventMigration, error)

func NewID added in v0.25.0

func NewID(entropy *ulid.MonotonicEntropy) eventid.EventID

func NewJSONCodec added in v0.28.0

func NewJSONCodec() *jsoncodec.Codec[ids.AggID]

func NewJSONCodecWithUpcaster added in v0.28.0

func NewJSONCodecWithUpcaster() *jsoncodec.Codec[ids.AggID]

Types

type Account

type Account struct {
	eventsourcing.RootAggregate[ids.AggID]
	// contains filtered or unexported fields
}

func DehydratedAccount added in v0.34.0

func DehydratedAccount(id ids.AggID) *Account

func NewAccount

func NewAccount(owner string, money int64) (*Account, error)

func (*Account) Balance

func (a *Account) Balance() int64

func (*Account) Deposit

func (a *Account) Deposit(money int64) error

func (*Account) Forget added in v0.28.0

func (a *Account) Forget()

func (*Account) GetKind added in v0.28.0

func (a *Account) GetKind() eventsourcing.Kind

func (*Account) Owner

func (a *Account) Owner() string

func (*Account) Status

func (a *Account) Status() Status

func (*Account) UpdateOwner

func (a *Account) UpdateOwner(owner string) error

func (*Account) Withdraw

func (a *Account) Withdraw(money int64) (bool, error)

type AccountCreated

type AccountCreated struct {
	Money int64
	Owner string
}

func (*AccountCreated) GetKind added in v0.28.0

func (e *AccountCreated) GetKind() eventsourcing.Kind

type AccountCreatedV2 added in v0.21.0

type AccountCreatedV2 struct {
	Money int64
	Owner NameVO
}

func (*AccountCreatedV2) GetKind added in v0.28.0

func (e *AccountCreatedV2) GetKind() eventsourcing.Kind

type AccountV2 added in v0.21.0

type AccountV2 struct {
	eventsourcing.RootAggregate[ids.AggID]
	// contains filtered or unexported fields
}

func DehydratedAccountV2 added in v0.35.0

func DehydratedAccountV2(id ids.AggID) *AccountV2

func NewAccountV2 added in v0.21.0

func NewAccountV2(owner NameVO, money int64) (*AccountV2, error)

func (*AccountV2) Balance added in v0.21.0

func (a *AccountV2) Balance() int64

func (*AccountV2) Deposit added in v0.21.0

func (a *AccountV2) Deposit(money int64) error

func (*AccountV2) GetKind added in v0.28.0

func (a *AccountV2) GetKind() eventsourcing.Kind

func (*AccountV2) Owner added in v0.28.0

func (a *AccountV2) Owner() NameVO

func (*AccountV2) Status added in v0.21.0

func (a *AccountV2) Status() Status

func (*AccountV2) UpdateOwner added in v0.21.0

func (a *AccountV2) UpdateOwner(owner string) error

func (*AccountV2) Withdraw added in v0.21.0

func (a *AccountV2) Withdraw(money int64) (bool, error)

type Cursor added in v0.25.0

type Cursor[K eventsourcing.ID] struct {
	// contains filtered or unexported fields
}

func (*Cursor[K]) Close added in v0.25.0

func (c *Cursor[K]) Close()

func (*Cursor[K]) Next added in v0.25.0

func (c *Cursor[K]) Next() (*eventsourcing.Event[K], <-chan bool)

type InMemDB added in v0.25.0

type InMemDB[K eventsourcing.ID] struct {
	// contains filtered or unexported fields
}

func NewInMemDB added in v0.25.0

func NewInMemDB[K eventsourcing.ID]() *InMemDB[K]

func (*InMemDB[K]) Add added in v0.25.0

func (db *InMemDB[K]) Add(event *eventsourcing.Event[K]) *eventsourcing.Event[K]

func (*InMemDB[K]) GetEvents added in v0.25.0

func (db *InMemDB[K]) GetEvents(ctx context.Context, afterEventID eventid.EventID, untilEventID eventid.EventID, limit int, filter store.Filter) ([]*eventsourcing.Event[K], error)

func (*InMemDB[K]) GetFrom added in v0.25.0

func (db *InMemDB[K]) GetFrom(id eventid.EventID) []*eventsourcing.Event[K]

func (*InMemDB[K]) ReadAt added in v0.25.0

func (db *InMemDB[K]) ReadAt(idx int) (*eventsourcing.Event[K], bool)

func (*InMemDB[K]) RemoveCursor added in v0.25.0

func (db *InMemDB[K]) RemoveCursor(c *Cursor[K])

func (*InMemDB[K]) WatchAfter added in v0.25.0

func (db *InMemDB[K]) WatchAfter(resumeToken []byte) (*Cursor[K], error)

type InMemDBFeed added in v0.25.0

type InMemDBFeed[K eventsourcing.ID] struct {
	// contains filtered or unexported fields
}

func InMemDBNewFeed added in v0.25.0

func InMemDBNewFeed[K eventsourcing.ID](db *InMemDB[K], sinker sink.Sinker[K]) InMemDBFeed[K]

func (InMemDBFeed[K]) Run added in v0.25.0

func (f InMemDBFeed[K]) Run(ctx context.Context) error

type InMemLocker added in v0.25.0

type InMemLocker struct {
	// contains filtered or unexported fields
}

func (*InMemLocker) Lock added in v0.25.0

func (l *InMemLocker) Lock(ctx context.Context) (context.Context, error)

func (*InMemLocker) Unlock added in v0.25.0

func (l *InMemLocker) Unlock(context.Context) error

func (*InMemLocker) WaitForLock added in v0.31.0

func (l *InMemLocker) WaitForLock(ctx context.Context) (context.Context, error)

func (*InMemLocker) WaitForUnlock added in v0.25.0

func (l *InMemLocker) WaitForUnlock(context.Context) error

type InMemLockerPool added in v0.25.0

type InMemLockerPool struct {
	// contains filtered or unexported fields
}

func NewInMemLockerPool added in v0.25.0

func NewInMemLockerPool() *InMemLockerPool

func (*InMemLockerPool) NewLock added in v0.25.0

func (l *InMemLockerPool) NewLock(name string) *InMemLocker

type InMemMemberList added in v0.25.0

type InMemMemberList struct {
	// contains filtered or unexported fields
}

func NewInMemMemberList added in v0.25.0

func NewInMemMemberList(ctx context.Context, db *sync.Map) *InMemMemberList

func (*InMemMemberList) Close added in v0.39.0

func (m *InMemMemberList) Close(_ context.Context) error

func (InMemMemberList) Name added in v0.25.0

func (m InMemMemberList) Name() string

func (InMemMemberList) Peers added in v0.39.0

func (*InMemMemberList) Register added in v0.25.0

func (m *InMemMemberList) Register(_ context.Context, workers []string) error

type InMemResumeStore added in v0.25.0

type InMemResumeStore struct {
	// contains filtered or unexported fields
}

func NewInMemResumeStore added in v0.25.0

func NewInMemResumeStore() *InMemResumeStore

func (*InMemResumeStore) GetStreamResumeToken added in v0.25.0

func (s *InMemResumeStore) GetStreamResumeToken(ctx context.Context, key projection.ResumeKey) (string, error)

func (*InMemResumeStore) SetStreamResumeToken added in v0.25.0

func (s *InMemResumeStore) SetStreamResumeToken(ctx context.Context, key projection.ResumeKey, token string) error

type MockSinkClient added in v0.34.0

type MockSinkClient[K eventsourcing.ID] struct {
	// contains filtered or unexported fields
}

func NewMockSink

func NewMockSink[K eventsourcing.ID](data *MockSinkData[K], partitions, partitionsLow, partitionHi uint32) *MockSinkClient[K]

func (*MockSinkClient[K]) Accepts added in v0.34.0

func (s *MockSinkClient[K]) Accepts(hash uint32) bool

func (*MockSinkClient[K]) Close added in v0.34.0

func (s *MockSinkClient[K]) Close()

func (*MockSinkClient[K]) OnSink added in v0.34.0

func (s *MockSinkClient[K]) OnSink(handler func(ctx context.Context, e *eventsourcing.Event[K]) error)

func (*MockSinkClient[K]) Partitions added in v0.34.0

func (s *MockSinkClient[K]) Partitions() (uint32, []uint32)

func (*MockSinkClient[K]) ResumeTokens added in v0.34.0

func (s *MockSinkClient[K]) ResumeTokens(ctx context.Context, forEach func(resumeToken encoding.Base64) error) error

func (*MockSinkClient[K]) Sink added in v0.34.0

func (s *MockSinkClient[K]) Sink(ctx context.Context, e *eventsourcing.Event[K], m sink.Meta) error

type MockSinkData added in v0.34.0

type MockSinkData[K eventsourcing.ID] struct {
	// contains filtered or unexported fields
}

func NewMockSinkData added in v0.34.0

func NewMockSinkData[K eventsourcing.ID]() *MockSinkData[K]

func (*MockSinkData[K]) GetEvents added in v0.34.0

func (s *MockSinkData[K]) GetEvents() []*sink.Message[K]

func (*MockSinkData[K]) LastResumes added in v0.34.0

func (s *MockSinkData[K]) LastResumes() map[uint32]encoding.Base64

func (*MockSinkData[K]) SetLastResumes added in v0.34.0

func (s *MockSinkData[K]) SetLastResumes(lastEvents map[uint32]encoding.Base64)

type MoneyDeposited

type MoneyDeposited struct {
	Money int64
}

func (*MoneyDeposited) GetKind added in v0.28.0

func (e *MoneyDeposited) GetKind() eventsourcing.Kind

type MoneyWithdrawn

type MoneyWithdrawn struct {
	Money int64
}

func (*MoneyWithdrawn) GetKind added in v0.28.0

func (e *MoneyWithdrawn) GetKind() eventsourcing.Kind

type NameVO added in v0.28.0

type NameVO struct {
	// contains filtered or unexported fields
}

func NewName added in v0.28.0

func NewName(firstName string, lastName string) (NameVO, error)

func (NameVO) FirstName added in v0.28.0

func (n NameVO) FirstName() string

func (NameVO) LastName added in v0.28.0

func (n NameVO) LastName() string

type OwnerUpdated

type OwnerUpdated struct {
	Owner string
}

func (*OwnerUpdated) GetKind added in v0.28.0

func (e *OwnerUpdated) GetKind() eventsourcing.Kind

type OwnerUpdatedV2 added in v0.21.0

type OwnerUpdatedV2 struct {
	Owner NameVO
}

func (*OwnerUpdatedV2) GetKind added in v0.28.0

func (e *OwnerUpdatedV2) GetKind() eventsourcing.Kind

type Status

type Status string
const (
	OPEN   Status = "OPEN"
	CLOSED Status = "CLOSED"
	FROZEN Status = "FROZEN"
)

Directories

Path Synopsis
pg
wal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL