core

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainEntityNotFound added in v0.2.0

type DomainEntityNotFound struct {
	Type string `json:"type,omitempty"`
	ID   string `json:"id,omitempty"`
}

type DomainValidationFailed added in v0.2.0

type DomainValidationFailed struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type Entity

type Entity interface {
	ID() string
	Type() string
	Version() uint64
	State(interface{})
	UpdatedAt() time.Time
	UpdatedBy() string
	CreatedAt() time.Time
	CreatedBy() string
	IsDeleted() bool
}

type EntityPage added in v0.4.0

type EntityPage interface {
	Items() []Entity
	NextToken() string
}

type Event

type Event interface {
	ID() string
	Source() string
	Class() EventClass
	Type() string
	Time() time.Time
	Author() string
	Data(interface{})
	Entity() Entity
	Trigger() Event
	Transaction() string
}

type EventClass added in v0.2.0

type EventClass string
const (
	CommandEvent  EventClass = "C"
	DomainEvent   EventClass = "D"
	BusinessEvent EventClass = "B"
	SystemEvent   EventClass = "S"
)

type EventFactory

type EventFactory interface {
	NewSystemEvent(ctx context.Context, data interface{}) Event
	NewCommandEvent(ctx context.Context, data interface{}) Event
	NewBusinessEvent(ctx context.Context, data interface{}) Event
	NewDomainEvent(ctx context.Context, data interface{}, entity Entity, state interface{}) Event
	NewFirstDomainEvent(ctx context.Context, data interface{}, state interface{}) Event
	NewFirstDomainEventWithCustomID(ctx context.Context, data interface{}, id string, state interface{}) Event

	NewSystemEventWithCustomType(ctx context.Context, typ string, data interface{}) Event
	NewCommandEventWithCustomType(ctx context.Context, typ string, data interface{}) Event
	NewBusinessEventWithCustomType(ctx context.Context, typ string, data interface{}) Event
	NewDomainEventWithCustomType(ctx context.Context, typ string, data interface{}, entity Entity, state interface{}) Event
	NewFirstDomainEventWithCustomType(ctx context.Context, typ string, data interface{}, state interface{}) Event
	NewFirstDomainEventWithCustomIDAndCustomType(ctx context.Context, typ string, data interface{}, id string, state interface{}) Event
}

type EventHandler

type EventHandler func(ctx context.Context, event Event) Event

type EventHandlingFailed added in v0.4.0

type EventHandlingFailed struct {
	Handler    string `json:"handler,omitempty"`
	Error      string `json:"error,omitempty"`
	StackTrace string `json:"stackTrace,omitempty"`
}

type EventPage added in v0.4.0

type EventPage interface {
	Items() []Event
	NextToken() string
}

type EventStore

type EventStore interface {
	GetLastEvent(ctx context.Context, source string) Event
	GetEventByID(ctx context.Context, source string, id string) Event

	GetEntityEvents(ctx context.Context, typ string, id string,
		after *time.Time, before *time.Time, nextToken *string, limit *int64) EventPage
	GetDayEvents(ctx context.Context, day string,
		after *time.Time, before *time.Time, nextToken *string, limit *int64) EventPage
	GetTypeEvents(ctx context.Context, typ string,
		after *time.Time, before *time.Time, nextToken *string, limit *int64) EventPage
	GetAuthorEvents(ctx context.Context, author string,
		after *time.Time, before *time.Time, nextToken *string, limit *int64) EventPage
	GetTransactionEvents(ctx context.Context, transaction string,
		after *time.Time, before *time.Time, nextToken *string, limit *int64) EventPage
}

type NoEventGenerated added in v0.7.0

type NoEventGenerated struct {
	Handler string `json:"handler,omitempty"`
}

type StateStore

type StateStore interface {
	GetLastVersion(ctx context.Context, typ string, id string) Entity
	GetByVersion(ctx context.Context, typ string, id string, version uint64) Entity

	GetVersions(ctx context.Context, typ string, id string,
		after *uint64, before *uint64, nextToken *string, limit *int64) VersionPage
	GetByType(ctx context.Context, typ string,
		after *time.Time, nextToken *string, limit *int64) EntityPage
}

type Version added in v0.5.0

type Version interface {
	ID() uint64
	Time() time.Time
	Author() string
}

type VersionPage added in v0.5.0

type VersionPage interface {
	Items() []Version
	NextToken() string
}

Jump to

Keyboard shortcuts

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