store

package
v0.0.0-...-2943bdd Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangesetStore

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

ChangesetStore is an EventStore for changesets.

func NewChangesetStore

func NewChangesetStore(conn *pgx.Conn) *ChangesetStore

NewChangesetStore initializes a new ChangesetStore.

func (*ChangesetStore) DeleteBeforeID

func (s *ChangesetStore) DeleteBeforeID(ctx context.Context, eventID int64) error

DeleteBeforeID deletes all events before a given ID.

func (*ChangesetStore) DeleteBeforeTimestamp

func (s *ChangesetStore) DeleteBeforeTimestamp(ctx context.Context, ts time.Time) error

DeleteBeforeTimestamp deletes all events before a given timestamp.

func (*ChangesetStore) GetByID

func (s *ChangesetStore) GetByID(ctx context.Context, eventID int64) (*Event, error)

GetByID gets an event by ID.

func (*ChangesetStore) GetSinceID

func (s *ChangesetStore) GetSinceID(ctx context.Context, eventID int64, eventCh chan *Event, doneCh chan bool, errCh chan error)

GetSinceID returns all events after a given ID.

func (*ChangesetStore) GetSinceTimestamp

func (s *ChangesetStore) GetSinceTimestamp(ctx context.Context, since time.Time, eventCh chan *Event, doneCh chan bool, errCh chan error)

GetSinceTimestamp returns all events after a given timestamp.

type Event

type Event struct {
	ID         int64
	Timestamp  time.Time
	Action     string
	SchemaName string
	TableName  string
	OID        int64
	NewValues  []byte
	OldValues  []byte
}

Event represents an entry in the events store.

type EventStore

type EventStore interface {
	GetByID(ctx context.Context, eventID int64) (*Event, error)
	GetSinceID(ctx context.Context, eventID int64, eventCh chan *Event, doneCh chan bool, errCh chan error)
	GetSinceTimestamp(ctx context.Context, since time.Time, eventCh chan *Event, doneCh chan bool, errCh chan error)
	DeleteBeforeID(ctx context.Context, eventID int64) error
	DeleteBeforeTimestamp(ctx context.Context, since time.Time) error
}

EventStore is the interface for providing access to events storage.

Jump to

Keyboard shortcuts

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