eventstore

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaExpectedVersion = "eventstore_expected_version"
	MetaStreamID        = "eventstore_stream_id"
	MetaEventType       = "eventstore_event_type"
)
View Source
const (
	QueryInitSchema    = "InitSchema"
	QueryGetLastOffset = "GetLastOffset"
	QueryInsertEvent   = "InsertEvent"
	QueryReadAll       = "ReadAll"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	GlobalOffset int64             `json:"global_offset"`
	StreamID     string            `json:"stream_id"`
	StreamOffset int64             `json:"stream_offset"`
	EventType    string            `json:"event_type"`
	Payload      []byte            `json:"payload"`
	Metadata     map[string]string `json:"metadata"`
	Timestamp    time.Time         `json:"timestamp"`
}

Event represents a single event in the event store.

type EventStoreSource

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

EventStoreSource implements hermod.Source for replaying events.

func NewEventStoreSource

func NewEventStoreSource(store *SQLStore, fromOffset int64) *EventStoreSource

func (*EventStoreSource) Ack

func (*EventStoreSource) Close

func (s *EventStoreSource) Close() error

func (*EventStoreSource) GetState

func (s *EventStoreSource) GetState() map[string]string

func (*EventStoreSource) Ping

func (s *EventStoreSource) Ping(ctx context.Context) error

func (*EventStoreSource) Read

func (*EventStoreSource) SetPollInterval

func (s *EventStoreSource) SetPollInterval(interval time.Duration)

func (*EventStoreSource) SetState

func (s *EventStoreSource) SetState(state map[string]string)

func (*EventStoreSource) SetStreamID

func (s *EventStoreSource) SetStreamID(streamID string)

type SQLStore

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

SQLStore is a database-backed implementation of an event store.

func NewSQLStore

func NewSQLStore(db *sql.DB, driver string) (*SQLStore, error)

func (*SQLStore) Close

func (s *SQLStore) Close() error

func (*SQLStore) Ping

func (s *SQLStore) Ping(ctx context.Context) error

func (*SQLStore) ReadAll

func (s *SQLStore) ReadAll(ctx context.Context, fromOffset int64, limit int, streamID string) ([]Event, error)

func (*SQLStore) SetLogger

func (s *SQLStore) SetLogger(logger hermod.Logger)

func (*SQLStore) SetTemplates

func (s *SQLStore) SetTemplates(streamID, eventType string)

func (*SQLStore) Write

func (s *SQLStore) Write(ctx context.Context, msg hermod.Message) error

Write implements hermod.Sink.

func (*SQLStore) WriteBatch

func (s *SQLStore) WriteBatch(ctx context.Context, msgs []hermod.Message) error

WriteBatch implements hermod.BatchSink.

Jump to

Keyboard shortcuts

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