eventstore

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StreamIdFieldIndexKey = "spec.streamId"

Functions

func EventType

func EventType(event eventsource.Event) (string, reflect.Type)

EventType is a helper func that extracts the event type of the event along with the reflect.Type of the event. Primarily useful for serializers that need to understand how marshal and unmarshal instances of Event to a []byte

func New

func New(client client.Client, log logr.Logger, context context.Context, serializer eventsource.Serializer) eventsource.Repository

func StreamId

func StreamId(s string) string

Types

type JsonSerializer

type JsonSerializer struct {
	// contains filtered or unexported fields
}

JsonSerializer provides a simple serializer implementation

func NewSerializer

func NewSerializer(events ...eventsource.Event) *JsonSerializer

NewSerializer constructs a new JsonSerializer and populates it with the specified events. Bind may be subsequently called to add more events.

func (*JsonSerializer) MarshalEvent

func (j *JsonSerializer) MarshalEvent(v eventsource.Event) (eventsource.Record, error)

MarshalEvent converts an event into its persistent type, Record

func (*JsonSerializer) Register

func (j *JsonSerializer) Register(events ...eventsource.Event)

Register registers the specified events with the serializer; may be called more than once

func (*JsonSerializer) UnmarshalEvent

func (j *JsonSerializer) UnmarshalEvent(record eventsource.Record) (eventsource.Event, error)

UnmarshalEvent converts the persistent type, Record, into an Event instance

type Repository

type Repository struct {
	client.Client
	Log     logr.Logger
	Context context.Context
	// contains filtered or unexported fields
}

func (Repository) Delete

func (r Repository) Delete(stream eventsource.Stream) error

func (Repository) Get

func (r Repository) Get(streamId string) (eventsource.Stream, error)

func (Repository) Save

func (r Repository) Save(aggregate eventsource.Aggregate) (events int, err error)

Jump to

Keyboard shortcuts

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