domain

package
v0.0.0-...-8dfeaa5 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeEmptyEventID        string = errors.SysErrCodePrefix + "EmptyEventID"
	ErrCodeEmptyAggregateID    string = errors.SysErrCodePrefix + "EmptyAggregateID"
	ErrCodeAggregateNoChange   string = errors.SysErrCodePrefix + "AggregateNoChange"
	ErrCodeAggregateHasChanged string = errors.SysErrCodePrefix + "AggregateHasChanged"
	ErrCodeGetAggregateFail    string = errors.SysErrCodePrefix + "GetAggregateFail"
	ErrCodeSaveAggregateFail   string = errors.SysErrCodePrefix + "SaveAggregateFail"
)

Variables

View Source
var (
	ErrEmptyEventID        error = errors.NewWithCode(ErrCodeEmptyEventID, "event-id is empty")
	ErrEmptyAggregateID    error = errors.NewWithCode(ErrCodeEmptyAggregateID, "aggregate-id is empty")
	ErrAggregateNoChange   error = errors.NewWithCode(ErrCodeAggregateNoChange, "aggregate no change")
	ErrAggregateHasChanged error = errors.NewWithCode(ErrCodeAggregateHasChanged, "aggregate has changed")
	ErrGetAggregateFail    error = errors.NewWithCode(ErrCodeGetAggregateFail, "get aggregate fail")
	ErrSaveAggregateFail   error = errors.NewWithCode(ErrCodeSaveAggregateFail, "save aggregate fail")
)

Functions

This section is empty.

Types

type Aggregate

type Aggregate interface {
	AggregateID() string
	AggregateTypeName() string
	AggregateVersion() int
}

type DomainEvent

type DomainEvent interface {
	serialization.Serializable
	EventID() string
	OccurTime() time.Time
}

type DomainEventBase

type DomainEventBase struct {
	E_ID string
	E_Ts int64
}

func NewDomainEventBase

func NewDomainEventBase(eventID string) DomainEventBase

Base of event, should override method 'TypeName()'

func (DomainEventBase) EventID

func (e DomainEventBase) EventID() string

func (DomainEventBase) OccurTime

func (e DomainEventBase) OccurTime() time.Time

func (DomainEventBase) TypeName

func (e DomainEventBase) TypeName() string

type EventStream

type EventStream struct {
	AggregateID   string
	AggregateType string
	StreamVersion int
	Events        []DomainEvent
	CommandID     string
	CommandType   string
	Extensions    map[string]string
}

type EventStreamSlice

type EventStreamSlice []EventStream

func (EventStreamSlice) Len

func (l EventStreamSlice) Len() int

func (EventStreamSlice) Less

func (l EventStreamSlice) Less(i, j int) bool

func (EventStreamSlice) Swap

func (l EventStreamSlice) Swap(i, j int)

type Repository

type Repository[T Aggregate] interface {
	Get(ctx context.Context, aggregateID string) (T, error)
	Save(ctx context.Context, aggregate T) error
}

Jump to

Keyboard shortcuts

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