eventstore

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

README

A simple helper module for retrieving and storing events from postgres

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Stream    string      `json:"stream"`
	Version   int         `json:"version"`
	EventType string      `json:"event_type"`
	Data      interface{} `json:"data"`
	Metadata  interface{} `json:"metadata"`
	Timestamp time.Time   `json:"timestamp"`
}

type EventStore

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

func NewEventStore

func NewEventStore(conn *pgx.Conn) *EventStore

func (*EventStore) AppendToStream

func (es *EventStore) AppendToStream(stream string, version int, events []Event) error

func (*EventStore) LoadFromAll

func (es *EventStore) LoadFromAll(since int, limit int) ([]Event, error)

func (*EventStore) LoadFromStream

func (es *EventStore) LoadFromStream(stream string, since int, limit int) ([]Event, error)

func (*EventStore) Register added in v0.3.0

func (es *EventStore) Register(event_type string, event interface{})

Jump to

Keyboard shortcuts

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