sqlite

package
v0.0.0-...-4821133 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SqliteStore

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

SqliteStore persists and queries knowledge documents using SQLite + sqlite-vec.

func New

func New(_ context.Context, path string) (*SqliteStore, error)

New creates a new SqliteStore at the given file path. Parent directories are created automatically.

func (*SqliteStore) Close

func (s *SqliteStore) Close() error

Close closes the underlying database connection.

func (*SqliteStore) DB

func (s *SqliteStore) DB() *sql.DB

DB returns the underlying *sql.DB for use in migrations (e.g. from cmd/mcp-issues-index).

func (*SqliteStore) ReplaceProject

func (s *SqliteStore) ReplaceProject(ctx context.Context, tenantID, projectKey string, docs []knowledge.Document) error

ReplaceProject atomically removes all documents for tenantID+projectKey and inserts docs in a single transaction.

func (*SqliteStore) Search

func (s *SqliteStore) Search(ctx context.Context, queryEmbedding []float32, f knowledge.Filter, topK int) ([]knowledge.Hit, error)

Search returns the topK nearest documents to queryEmbedding filtered by f. Score is cosine similarity (1 - distance), ranging from 0 to 1.

func (*SqliteStore) Stats

func (s *SqliteStore) Stats(ctx context.Context, tenantID, projectKey string) (int, error)

Stats returns the number of indexed documents for the given tenantID and project key.

func (*SqliteStore) Upsert

func (s *SqliteStore) Upsert(ctx context.Context, docs []knowledge.Document) error

Upsert inserts or updates the given documents in the store.

Jump to

Keyboard shortcuts

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