eventstore

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRetention = 3 * 24 * time.Hour // 3 days
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket interface {
	Name() string
	Insert(ctx context.Context, ev components.Event) error
	// Find returns nil if the event is not found.
	Find(ctx context.Context, ev components.Event) (*components.Event, error)
	// Get queries the event in the descending order of timestamp (latest event first).
	Get(ctx context.Context, since time.Time) ([]components.Event, error)
	// Latest queries the latest event, returns nil if no event found.
	Latest(ctx context.Context) (*components.Event, error)
	Purge(ctx context.Context, beforeTimestamp int64) (int, error)
	Close()
}

type Store

type Store interface {
	Bucket(name string) (Bucket, error)
}

func New

func New(dbRW *sql.DB, dbRO *sql.DB, retention time.Duration) (Store, error)

Jump to

Keyboard shortcuts

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