eventstore

package module
v0.0.0-...-9960bef Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

eventstore

Demo project for potential race condition

The race condition only exists on Windows, which is not a supported platform for Badger.

This archive is now read only.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewId

func NewId(t time.Time) ulid.ULID

Types

type BadgerEventStore

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

func (*BadgerEventStore) Append

func (b *BadgerEventStore) Append(aggregate string, content interface{}) error

func (*BadgerEventStore) Close

func (b *BadgerEventStore) Close() error

func (*BadgerEventStore) ListKeys

func (b *BadgerEventStore) ListKeys() ([]string, error)

func (*BadgerEventStore) ListKeysForAggregate

func (b *BadgerEventStore) ListKeysForAggregate(aggregate string) ([]string, error)

func (*BadgerEventStore) Read

func (b *BadgerEventStore) Read(aggregate string) ([]interface{}, error)

func (*BadgerEventStore) Register

func (b *BadgerEventStore) Register(t interface{})

type EventStore

type EventStore interface {
	// Register a type for deserialization
	Register(t interface{})
	// Append append an event to the event store for the fact
	Append(aggregate string, content interface{}) error
	// Read the events for a fact from the beginning
	Read(aggregate string) ([]interface{}, error)
	// ListKeys will list all keys in the store
	ListKeys() ([]string, error)
	// ListKeysForAggregate will list all keys with the aggregate prefix
	ListKeysForAggregate(aggregate string) ([]string, error)
	// Close the event store
	Close() error
}

EventStore provides an interface to store events for a topic, and retrieve them later.

func MemoryStore

func MemoryStore() EventStore

type Record

type Record struct {
	Id        ulid.ULID
	Timestamp time.Time
	Content   interface{}
}

Jump to

Keyboard shortcuts

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