sqlite

package
v0.0.0-...-a8c1135 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package sqlite provides SQLite-specific implementation for conversation storage. It implements the ConversationStore interface using SQLite database with optimized WAL mode configuration, schema migrations, and efficient querying.

Index

Constants

View Source
const (
	// SchemaVersion1 represents the initial database schema version
	SchemaVersion1 = 1
	// SchemaVersion2 adds performance indexes
	SchemaVersion2 = 2
	// SchemaVersion3 adds provider column to conversation_summaries table
	SchemaVersion3 = 3
	// SchemaVersion4 adds background_processes column to conversations table
	SchemaVersion4 = 4
	// CurrentSchemaVersion is the latest schema version
	CurrentSchemaVersion = SchemaVersion4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONField

type JSONField[T any] struct {
	Data T
}

JSONField is a generic type for handling JSON marshaling/unmarshaling in database

func (*JSONField[T]) Scan

func (j *JSONField[T]) Scan(value interface{}) error

Scan implements the sql.Scanner interface for reading from database

func (JSONField[T]) Value

func (j JSONField[T]) Value() (driver.Value, error)

Value implements the driver.Valuer interface for writing to database

type Migration

type Migration struct {
	Version     int
	Description string
	Up          func(*sql.Tx) error
	Down        func(*sql.Tx) error // Optional rollback function
}

Migration represents a database migration

type Store

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

Store implements ConversationStore using SQLite database

func NewStore

func NewStore(ctx context.Context, dbPath string) (*Store, error)

NewStore creates a new SQLite-based conversation store

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

Delete removes a conversation and its associated data

func (*Store) Load

Load retrieves a conversation record by ID

func (*Store) Query

Query performs advanced queries with filtering, sorting, and pagination

func (*Store) Save

Save persists a conversation record to the database using UPSERT to preserve created_at timestamps

Jump to

Keyboard shortcuts

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