Documentation ¶
Index ¶
- Variables
- func GetPartitionKey(sourceType string, id types.Guid) string
- func RegisterVersionEventFactory(key string, vef VersionEventFactory)
- func WithRepository(parent context.Context, repo Repository) context.Context
- type EventEntity
- type EventSourced
- type EventSourcedRepository
- type EventStore
- type Repository
- type TrivialVersionedEvent
- type VersionEventFactory
- type VersionEventFactoryFunc
- type VersionedEvent
Constants ¶
This section is empty.
Variables ¶
View Source
var (
EventSourcedNoFound = errors.New("eventsoucing no found")
)
Functions ¶
func RegisterVersionEventFactory ¶
func RegisterVersionEventFactory(key string, vef VersionEventFactory)
func WithRepository ¶
func WithRepository(parent context.Context, repo Repository) context.Context
Types ¶
type EventEntity ¶
type EventEntity struct { Id int64 `gorm:"primary_key"` PartitionKey string SourceType string EventType string SourceId string CorrelationId string Version int64 Payload string }
event entity
func ToData ¶
func ToData(st string, partitionKey string, e VersionedEvent) (*EventEntity, error)
func (*EventEntity) TableName ¶
func (ed *EventEntity) TableName() string
type EventSourced ¶
type EventSourced interface { Id() types.Guid Version() int64 ApplyEvent(ve VersionedEvent) error Events() []VersionedEvent Payload() []byte }
type EventSourcedRepository ¶
type EventSourcedRepository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(es EventStore) *EventSourcedRepository
func (*EventSourcedRepository) Find ¶
func (esr *EventSourcedRepository) Find(id types.Guid, es EventSourced) (err error)
func (*EventSourcedRepository) Save ¶
func (esr *EventSourcedRepository) Save(es EventSourced, correlationId string) error
type EventStore ¶
type EventStore interface { Load(partitionKey string, version int64) ([]*EventEntity, error) Save(partitionKey string, events []*EventEntity) error }
type Repository ¶
type Repository interface { Find(id types.Guid, es EventSourced) (err error) Save(es EventSourced, correlationId string) error }
func RepositoryInContext ¶
func RepositoryInContext(ctx context.Context) Repository
type TrivialVersionedEvent ¶
type TrivialVersionedEvent struct {
// contains filtered or unexported fields
}
trivival versioned event
func (*TrivialVersionedEvent) SourceId ¶
func (tve *TrivialVersionedEvent) SourceId() types.Guid
func (*TrivialVersionedEvent) Version ¶
func (tve *TrivialVersionedEvent) Version() int64
type VersionEventFactory ¶
type VersionEventFactory interface {
NewVersionEvent(sourceId types.Guid, version int64) VersionedEvent
}
func GetVersionEventFactory ¶
func GetVersionEventFactory(key string) VersionEventFactory
type VersionEventFactoryFunc ¶
type VersionEventFactoryFunc func(sourceId types.Guid, version int64) VersionedEvent
func (VersionEventFactoryFunc) NewVersionEvent ¶
func (veff VersionEventFactoryFunc) NewVersionEvent(sourceId types.Guid, version int64) VersionedEvent
type VersionedEvent ¶
func NewVersionEvent ¶
func NewVersionEvent(sourceId types.Guid, version int64) VersionedEvent
Source Files ¶
Click to show internal directories.
Click to hide internal directories.