eventsourcing

package
v0.0.0-...-5ebfc8f Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeBinary = esdb.ContentTypeBinary
	ContentTypeJson   = esdb.ContentTypeJson
)

Variables

View Source
var (
	ErrOptimisticConcurrency = errors.New("optimistic concurrency error")
)

Functions

This section is empty.

Types

type Any

type Any = esdb.Any

type CausationId

type CausationId string

func NewCausationId

func NewCausationId() *CausationId

type CommandHandler

type CommandHandler[Command any, Event any] func(context context.Context, db *esdb.Client, command Command, opts *Options) (*Result[Event], error)

CommandHandler is a function that receives a command and returns a list of events. TODO: figure out how to avoid passing the db here. Take into consideration multi-tenancy.

func NewDecider

func NewDecider[State any, Command any, Event any](
	decider *onepiece.Decider[State, Command, Event],
	getStreamId StreamId[Command],
	marshalEvent MarshalEvent[Event],
	unmarshalEvent UnmarshalEvent[Event],
	getEventType GetEventType[Event],
) CommandHandler[Command, Event]

type ContentType

type ContentType = esdb.ContentType

type CorrelationId

type CorrelationId string

func NewCorrelationId

func NewCorrelationId() *CorrelationId

type ExpectedRevision

type ExpectedRevision = esdb.ExpectedRevision

type GetEventType

type GetEventType[Event any] func(event Event) (*onepiecemessage.MessageType, error)

type MarshalEvent

type MarshalEvent[Event any] func(event Event) (ContentType, []byte, error)

type Metadata

type Metadata map[string]any

type NoStream

type NoStream = esdb.NoStream

type Options

type Options struct {
	ExpectedRevision ExpectedRevision
	Metadata         Metadata
	CorrelationId    *CorrelationId
	CausationId      *CausationId
}

type Result

type Result[Event any] struct {
	NextExpectedVersion uint64
	Events              []Event
}

type StreamExists

type StreamExists = esdb.StreamExists

type StreamId

type StreamId[Command any] func(command Command) (string, error)

type StreamRevision

type StreamRevision = esdb.StreamRevision

func Revision

func Revision(value uint64) StreamRevision

type UnmarshalEvent

type UnmarshalEvent[Event any] func(eventType string, data []byte) (Event, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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