Documentation
¶
Overview ¶
Package db wires gitrakz's SQLite storage: opening the database, running the embedded migrations, and exposing a typed Store facade over the generated gorm-gen repositories.
Index ¶
- type LLMSettings
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteTemplate(ctx context.Context, id string) error
- func (s *Store) GetLLMSettings(ctx context.Context) (LLMSettings, error)
- func (s *Store) GetSyncState(ctx context.Context, owner, repo string) (int64, error)
- func (s *Store) GetTemplate(ctx context.Context, id string) (template.Template, error)
- func (s *Store) LLMCacheGet(ctx context.Context, key string) (string, bool, error)
- func (s *Store) LLMCachePut(ctx context.Context, key, step, processingVersion, inputHash, output string) error
- func (s *Store) ListOwners(ctx context.Context) ([]string, error)
- func (s *Store) ListRepos(ctx context.Context, owner string) ([]string, error)
- func (s *Store) ListTemplates(ctx context.Context) ([]template.Template, error)
- func (s *Store) QueryTimeline(ctx context.Context, f TimelineFilter) ([]types.Event, bool, error)
- func (s *Store) SaveDocument(ctx context.Context, id, templateID, filter, formValues, doc string) error
- func (s *Store) SaveLLMSettings(ctx context.Context, settings LLMSettings) error
- func (s *Store) SaveTemplate(ctx context.Context, tmpl template.Template) error
- func (s *Store) UpsertEvents(ctx context.Context, evs []types.Event) error
- func (s *Store) UpsertSyncState(ctx context.Context, owner, repo string, ts int64) error
- type TimelineFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LLMSettings ¶ added in v0.7.0
LLMSettings is the stored runtime LLM configuration read by the summarization and composer blocks.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the typed facade over gitrakz's SQLite storage. It maps between the domain types (types.Event, template.Template, ...) and the generated gorm-gen repositories, wraps every error with ctxerrors, and translates gorm's not-found result into either a zero value or commerr.ErrNotFound depending on what each method's caller needs.
func Open ¶
Open opens (creating it if necessary) the SQLite database at dbPath, runs every pending migration, and returns a Store wired to its own generated query API instance (repositories.Use — not SetDefault, which mutates process-wide globals and races when multiple Stores open concurrently, as every parallel test in this package does). ctx is accepted for API consistency; the driver and migration runner are synchronous and do not currently take a context.
func (*Store) DeleteTemplate ¶
DeleteTemplate removes the template with the given id, if any.
func (*Store) GetLLMSettings ¶ added in v0.7.0
func (s *Store) GetLLMSettings(ctx context.Context) (LLMSettings, error)
GetLLMSettings returns the stored LLM settings, or a zero value when none have been saved yet.
func (*Store) GetSyncState ¶
GetSyncState returns the last synced unix timestamp for (owner, repo), or 0 with a nil error if no sync has ever run for that pair.
func (*Store) GetTemplate ¶
GetTemplate returns the template with the given id, or wraps commerr.ErrNotFound if no template has that id.
func (*Store) LLMCacheGet ¶
LLMCacheGet returns the cached output for key, or ok=false with a nil error if key was never cached.
func (*Store) LLMCachePut ¶
func (s *Store) LLMCachePut( ctx context.Context, key, step, processingVersion, inputHash, output string, ) error
LLMCachePut stores output under key, replacing any previous entry for that key.
func (*Store) ListOwners ¶
ListOwners returns every distinct owner with at least one stored event, sorted ascending.
func (*Store) ListRepos ¶
ListRepos returns every distinct repo owner has at least one stored event for, sorted ascending.
func (*Store) ListTemplates ¶
ListTemplates returns every saved template.
func (*Store) QueryTimeline ¶
func (s *Store) QueryTimeline( ctx context.Context, f TimelineFilter, ) ([]types.Event, bool, error)
QueryTimeline returns the events matching f, newest first, one page at a time. hasMore reports whether a further page exists; when true, the last row of a full page has already been dropped from evs.
func (*Store) SaveDocument ¶
func (s *Store) SaveDocument( ctx context.Context, id, templateID, filter, formValues, doc string, ) error
SaveDocument persists one template run's output under id.
func (*Store) SaveLLMSettings ¶ added in v0.7.0
func (s *Store) SaveLLMSettings( ctx context.Context, settings LLMSettings, ) error
SaveLLMSettings replaces the stored LLM settings.
func (*Store) SaveTemplate ¶
SaveTemplate creates tmpl, or replaces every column of the existing row with the same id.
func (*Store) UpsertEvents ¶
UpsertEvents inserts evs, updating any row whose id already exists. A nil or empty evs is a no-op.
type TimelineFilter ¶
type TimelineFilter struct {
Owner string
Repo string
Type string
From int64
To int64
Page int
PerPage int
}
TimelineFilter narrows QueryTimeline to a window of events. The zero value of every field means "no filter on that dimension" — From/To of 0 disable the time bound, Owner/Repo/Type of "" disable that equality filter.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package migrations embeds gitrakz's SQLite schema migrations into the binary so it stays self-contained — no migrations directory to mount, no version skew between the binary and the SQL files.
|
Package migrations embeds gitrakz's SQLite schema migrations into the binary so it stays self-contained — no migrations directory to mount, no version skew between the binary and the SQL files. |