store

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MetaColumnPrefix = "meta_"

Variables

View Source
var ErrResumeTokenNotFound = errors.New("resume token not found")

Functions

This section is empty.

Types

type AggregateMetadata added in v0.28.0

type AggregateMetadata[K eventsourcing.ID] struct {
	Type      eventsourcing.Kind
	ID        K
	Version   uint32
	UpdatedAt time.Time
}

type EventBus added in v0.28.0

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

func New added in v0.28.0

func New[K eventsourcing.ID](mw ...EventBusMW[K]) *EventBus[K]

func (*EventBus[K]) Publish added in v0.29.0

func (m *EventBus[K]) Publish(ctx context.Context, events ...*eventsourcing.Event[K]) error

func (*EventBus[K]) Subscribe added in v0.29.0

func (m *EventBus[K]) Subscribe(filter string, handler Subscription[K], mw ...EventBusMW[K])

Subscribe register an handler subscription. The middlewares are executed in the reverse order

type EventBusMW added in v0.28.0

type EventBusMW[K eventsourcing.ID] func(Subscription[K]) Subscription[K]

type Filter

type Filter struct {
	AggregateKinds []eventsourcing.Kind
	// Metadata filters on top of metadata. Every key of the map is ANDed with every OR of the values
	// eg: [{"geo": "EU"}, {"geo": "USA"}, {"membership": "prime"}] equals to:  geo IN ("EU", "USA") AND membership = "prime"
	Metadata MetadataFilter
	Splits   uint32
	SplitIDs []uint32
}

type FilterOption

type FilterOption func(*Filter)

func WithAggregateKinds added in v0.28.0

func WithAggregateKinds(at ...eventsourcing.Kind) FilterOption

func WithFilter

func WithFilter(filter Filter) FilterOption

func WithMetadata

func WithMetadata(metadata MetadataFilter) FilterOption

func WithMetadataFilter added in v0.36.0

func WithMetadataFilter(key, value string) FilterOption

func WithSplits added in v0.36.0

func WithSplits(partitions uint32, partitionIDs []uint32) FilterOption

type InTxHandler added in v0.34.0

type InTxHandler[K eventsourcing.ID] func(context.Context, *eventsourcing.Event[K]) error

type KVRStore added in v0.34.0

type KVRStore interface {
	// Get retrieves the stored value for a key.
	// If the a resume key is not found it return ErrResumeTokenNotFound as an error
	Get(ctx context.Context, key string) (string, error)
}

type KVStore added in v0.34.0

type KVStore interface {
	KVRStore
	KVWStore
}

type KVWStore added in v0.34.0

type KVWStore interface {
	Put(ctx context.Context, key string, token string) error
}

type Metadata

type Metadata struct {
	Key   string
	Value string
}

type MetadataFilter added in v0.36.0

type MetadataFilter []*MetadataKVs

func (*MetadataFilter) Add added in v0.36.0

func (m *MetadataFilter) Add(key string, values ...string)

type MetadataHook added in v0.36.0

type MetadataHook[K eventsourcing.ID] func(context.Context) eventsourcing.Metadata

type MetadataKVs added in v0.36.0

type MetadataKVs struct {
	Key    string
	Values []string
}

type NilString added in v0.36.0

type NilString string

NilString converts nil to empty string

func (*NilString) Scan added in v0.36.0

func (ns *NilString) Scan(value interface{}) error

func (NilString) Value added in v0.36.0

func (ns NilString) Value() (driver.Value, error)

type Row added in v0.36.0

type Row map[string]interface{}

func (Row) AsBool added in v0.36.0

func (r Row) AsBool(colName string) bool

func (Row) AsBytes added in v0.36.0

func (r Row) AsBytes(colName string) []byte

func (Row) AsString added in v0.36.0

func (r Row) AsString(colName string) string

func (Row) AsTimeDate added in v0.36.0

func (r Row) AsTimeDate(colName string) time.Time

func (Row) AsUint32 added in v0.36.0

func (r Row) AsUint32(colName string) uint32

type Subscriber added in v0.28.0

type Subscriber[K eventsourcing.ID] interface {
	Subscribe(string, Subscription[K])
}

type Subscription added in v0.28.0

type Subscription[K eventsourcing.ID] func(context.Context, *eventsourcing.Event[K]) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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