eventstore

package
v0.0.0-...-783eb67 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: BSD-2-Clause Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicate = errors.New("duplicate")

Functions

This section is empty.

Types

type InMemoryStore

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

func (*InMemoryStore) Append

func (s *InMemoryStore) Append(event *store.Event) error

func (*InMemoryStore) Cleanup

func (s *InMemoryStore) Cleanup() error

Cleanup resets the db

func (*InMemoryStore) Get

func (s *InMemoryStore) Get(originator *common.Originator, fromVersion bool) ([]*store.Event, error)

func (*InMemoryStore) Logs

func (s *InMemoryStore) Logs(fromID uint64, size uint32, pipelineID string) ([]*store.AppLogEntry, error)

type SqlStore

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

func NewSqlStore

func NewSqlStore(dialect string, dbURI string) (*SqlStore, error)

func (*SqlStore) Append

func (estore *SqlStore) Append(event *store.Event) error

func (*SqlStore) Cleanup

func (estore *SqlStore) Cleanup() error

func (*SqlStore) Get

func (estore *SqlStore) Get(originator *common.Originator, fromVersion bool) ([]*store.Event, error)

func (*SqlStore) Logs

func (estore *SqlStore) Logs(fromID uint64, size uint32, pipelineID string) ([]*store.AppLogEntry, error)

type Store

type Store interface {
	Append(event *store.Event) error
	Get(originator *common.Originator, fromVersion bool) ([]*store.Event, error)
	Logs(fromID uint64, size uint32, pipelineID string) ([]*store.AppLogEntry, error)
}

type StoreWithCleanup

type StoreWithCleanup interface {
	Store
	Cleanup() error
}

StoreWithCleanup has the same methods as Store but also has Cleanup method it's useful when working in tests with the store

func NewInMemoryStore

func NewInMemoryStore() StoreWithCleanup

type StoredEvent

type StoredEvent struct {
	OriginatorID      string `gorm:"primary_key; not null"`
	OriginatorVersion uint   `gorm:"primary_key; not null"`
	EventType         string `gorm:"type:varchar(255); not null; index"`
	Payload           string `gorm:"type:text"`
	CreatedAt         time.Timer
}

type StoredLogEntry

type StoredLogEntry struct {
	ID            uint64 `gorm:"primary_key; AUTO_INCREMENT; not null"`
	ApplicationID string `gorm:"type:varchar(255); not null; index:index_app_partition; default:'consumer'"`
	PartitionID   string `gorm:"type:varchar(255); not null; index:index_app_partition"`
	EventPayload  string `gorm:"type:text"`
	CreatedAt     time.Timer
}

Jump to

Keyboard shortcuts

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