Documentation ¶
Index ¶
- Constants
- Variables
- type AggregateMetadata
- type EventBus
- type EventBusMW
- type Filter
- type FilterOption
- type InTxHandler
- type InTxHandlerContext
- type KVRStore
- type KVStore
- type KVWStore
- type Metadata
- type MetadataFilter
- type MetadataHook
- type MetadataHookContext
- type MetadataHookKind
- type MetadataKVs
- type NilString
- type Repository
- type Row
- type Session
- type Subscriber
- type Subscription
- type Tx
Constants ¶
View Source
const ( OnPersist = MetadataHookKind("persist") OnRetrieve = MetadataHookKind("retrieve") )
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]) 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(*InTxHandlerContext[K]) error
type InTxHandlerContext ¶ added in v0.39.0
type InTxHandlerContext[K eventsourcing.ID] struct { // contains filtered or unexported fields }
func NewInTxHandlerContext ¶ added in v0.39.0
func NewInTxHandlerContext[K eventsourcing.ID](ctx context.Context, event *eventsourcing.Event[K]) *InTxHandlerContext[K]
func (*InTxHandlerContext[K]) Context ¶ added in v0.39.0
func (c *InTxHandlerContext[K]) Context() context.Context
func (*InTxHandlerContext[K]) Event ¶ added in v0.39.0
func (c *InTxHandlerContext[K]) Event() *eventsourcing.Event[K]
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(*MetadataHookContext) eventsourcing.Metadata
type MetadataHookContext ¶ added in v0.39.0
type MetadataHookContext struct {
// contains filtered or unexported fields
}
func NewMetadataHookContext ¶ added in v0.39.0
func NewMetadataHookContext(ctx context.Context, kind MetadataHookKind) *MetadataHookContext
func (*MetadataHookContext) Context ¶ added in v0.39.0
func (c *MetadataHookContext) Context() context.Context
func (*MetadataHookContext) Kind ¶ added in v0.39.0
func (c *MetadataHookContext) Kind() MetadataHookKind
type MetadataHookKind ¶ added in v0.39.0
type MetadataHookKind string
type MetadataKVs ¶ added in v0.36.0
type Repository ¶ added in v0.39.0
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶ added in v0.39.0
func NewRepository(db *sqlx.DB) Repository
func (*Repository) Session ¶ added in v0.39.0
func (r *Repository) Session(ctx context.Context) Session
Session will check if there is a transaction in context and use it, otherwise it will use the current pool
func (Repository) TxRunner ¶ added in v0.39.0
func (r Repository) TxRunner() Tx
type Session ¶ added in v0.39.0
type Session interface { Rebind(query string) string GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error QueryxContext(ctx context.Context, query string, args ...any) (*sqlx.Rows, error) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) }
func TxFromContext ¶ added in v0.39.0
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
Click to show internal directories.
Click to hide internal directories.