Documentation
¶
Overview ¶
Package sqlite provides a SQLite-backed implementation of store.Store. It uses the pure-Go modernc.org/sqlite driver (no cgo) so the Console binary stays static. Flag variants and component config are persisted as JSON columns; timestamps are stored as RFC3339 TEXT in UTC.
Index ¶
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateComponent(ctx context.Context, c core.Component) error
- func (s *Store) CreateFlag(ctx context.Context, f core.Flag) error
- func (s *Store) DeleteComponent(ctx context.Context, key string) error
- func (s *Store) DeleteFlag(ctx context.Context, key string) error
- func (s *Store) GetComponent(ctx context.Context, key string) (core.Component, error)
- func (s *Store) GetFlag(ctx context.Context, key string) (core.Flag, error)
- func (s *Store) LatestCheck(ctx context.Context, component string) (core.Check, error)
- func (s *Store) LatestChecks(ctx context.Context) ([]core.Check, error)
- func (s *Store) ListComponents(ctx context.Context) ([]core.Component, error)
- func (s *Store) ListFlags(ctx context.Context) ([]core.Flag, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) RecordCheck(ctx context.Context, c core.Check) error
- func (s *Store) UpdateComponent(ctx context.Context, c core.Component) error
- func (s *Store) UpdateFlag(ctx context.Context, f core.Flag) error
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 is a SQLite-backed store.Store. It is safe for concurrent use: the underlying *sql.DB serializes access and the busy_timeout pragma absorbs transient lock contention.
func Open ¶
Open opens (or creates) the database at dsn, applies connection pragmas, runs the schema migrations, and returns a ready Store. An empty dsn opens a shared in-memory database, suitable for tests.
func (*Store) CreateComponent ¶
CreateComponent inserts a new component, or returns core.ErrConflict.
func (*Store) CreateFlag ¶
CreateFlag inserts a new flag. It returns core.ErrConflict if the key exists.
func (*Store) DeleteComponent ¶
DeleteComponent removes the component with the given key (and, via the foreign key, its checks), or returns core.ErrNotFound.
func (*Store) DeleteFlag ¶
DeleteFlag removes the flag with the given key, or returns core.ErrNotFound.
func (*Store) GetComponent ¶
GetComponent returns the component with the given key, or core.ErrNotFound.
func (*Store) LatestCheck ¶
LatestCheck returns the most recent check for the given component, or core.ErrNotFound if it has none.
func (*Store) LatestChecks ¶
LatestChecks returns the most recent check for each component, one row per component, ordered by component key.
func (*Store) ListComponents ¶
ListComponents returns all components ordered by key.
func (*Store) RecordCheck ¶
RecordCheck appends a health-check observation.
func (*Store) UpdateComponent ¶
UpdateComponent overwrites the component with the given key, or returns core.ErrNotFound. CreatedAt is preserved.