store

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store persists events to a local SQLite database.

func New

func New(dbPath string) (*Store, error)

New opens (or creates) a SQLite database at the given path.

func (*Store) Close

func (s *Store) Close() error

Close closes the database.

func (*Store) EventCounts

func (s *Store) EventCounts() (map[string]int, error)

EventCounts returns the count of each event type.

func (*Store) GetState

func (s *Store) GetState(key string) (string, error)

GetState retrieves a value from the state table.

func (*Store) InsertEvent

func (s *Store) InsertEvent(evt events.Event) (int64, error)

InsertEvent stores a parsed event.

func (*Store) MarkSynced

func (s *Store) MarkSynced(upToID int64) error

MarkSynced marks events as synced up to the given ID.

func (*Store) SetState

func (s *Store) SetState(key, value string) error

SetState upserts a key-value pair in the state table.

func (*Store) TotalEvents

func (s *Store) TotalEvents() (int, error)

TotalEvents returns the total number of stored events.

func (*Store) UnsyncedEvents

func (s *Store) UnsyncedEvents(limit int) ([]StoredEvent, error)

UnsyncedEvents returns events that haven't been synced to SC Bridge yet.

type StoredEvent

type StoredEvent struct {
	ID        int64
	Type      string
	Source    string
	Timestamp string
	DataJSON  string
}

StoredEvent represents an event row from the database.

Jump to

Keyboard shortcuts

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