Documentation
¶
Overview ¶
Package sqlite implements SQLite session persistence and FTS5 indexing (S03), following upstream storage/sqlite-session. session_events stores JSON blobs keyed by (session_id, seq); session_events_fts indexes message and title text for S04 queries. Append and AppendBatch update both tables transactionally. User/assistant Content and session Title supply index text; other events contribute empty text.
Index ¶
- type Match
- type Store
- func (s *Store) Append(ctx context.Context, sessionID brand.SessionID, ev session.SessionEvent) error
- func (s *Store) AppendBatch(ctx context.Context, sessionID brand.SessionID, events []session.SessionEvent) error
- func (s *Store) Close() error
- func (s *Store) Count(ctx context.Context, sessionID brand.SessionID) (int, error)
- func (s *Store) FTSEnabled() bool
- func (s *Store) FTSUnavailable() bool
- func (s *Store) ListSessions(ctx context.Context) ([]string, error)
- func (s *Store) Load(ctx context.Context, sessionID brand.SessionID) ([]session.SessionEvent, error)
- func (s *Store) Search(ctx context.Context, query string) ([]Match, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Match ¶
type Match struct {
SessionID string `json:"sessionId"`
Seq uint64 `json:"seq"`
Text string `json:"text,omitempty"`
}
Match identifies a session, sequence, and matched text; results sort by session ID.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists session events in SQLite with an FTS5 index.
func (*Store) Append ¶
func (s *Store) Append(ctx context.Context, sessionID brand.SessionID, ev session.SessionEvent) error
Append inserts an event and its index entry in one transaction.
func (*Store) AppendBatch ¶
func (s *Store) AppendBatch(ctx context.Context, sessionID brand.SessionID, events []session.SessionEvent) error
AppendBatch atomically inserts multiple events in one transaction.
func (*Store) FTSEnabled ¶
FTSEnabled reports FTS5 availability for callers and tests.
func (*Store) FTSUnavailable ¶
FTSUnavailable indicates the current driver does not support FTS5.
func (*Store) ListSessions ¶
ListSessions returns known session IDs in deterministic lexical order for queries.