sqlfts

package
v3.2.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package sqlfts implements pkg/memory.Backend on top of pure-Go SQLite with FTS5 full-text search (github.com/glebarez/sqlite).

Importing this package registers the "sqlite" URI scheme with pkg/memory.RegisterOpener so memory.Open(ctx, "sqlite:///path/to/memory.db") and memory.OpenRouter work automatically.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("sqlfts: backend is closed")

ErrClosed is returned when an operation is called on a closed Backend.

Functions

func OpenRef

func OpenRef(ctx context.Context, ref memory.ParsedRef) (memory.Backend, error)

OpenRef implements memory.Opener for "sqlite://" URIs.

Types

type Backend

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

Backend is a SQLite FTS5 implementation of pkg/memory.Backend partitioned by exact ScopeMap equality.

func Open

func Open(ctx context.Context, dbPath string, opts ...Option) (*Backend, error)

Open opens or creates a SQLite database at dbPath, initializes the memory schema and FTS5 index, and returns a Backend.

func (*Backend) Close

func (b *Backend) Close() error

Close closes the underlying SQLite database connection.

func (*Backend) ConsolidateConversation

func (b *Backend) ConsolidateConversation(ctx context.Context, scope memory.ScopeMap, req memory.ConversationRequest) ([]memory.ConsolidationDelta, error)

ConsolidateConversation extracts non-empty dialogue turns from req.Turns and consolidates them into scope.

func (*Backend) Delete

func (b *Backend) Delete(ctx context.Context, scope memory.ScopeMap, id string) error

Delete removes id only if it exists in scope. Cross-scope delete attempts return an error wrapping both memory.ErrScopeMismatch and memory.ErrNotFound without modifying the target item.

func (*Backend) Put

Put writes or consolidates candidate facts into scope.

func (*Backend) Retrieve

func (b *Backend) Retrieve(ctx context.Context, scope memory.ScopeMap, req memory.RetrieveRequest) ([]memory.Item, error)

Retrieve searches or lists non-expired items in scope.

type Option

type Option func(*Backend)

Option configures a SQLite FTS5 Backend.

func WithClock

func WithClock(now func() time.Time) Option

WithClock overrides time.Now for deterministic timestamp and TTL testing.

Jump to

Keyboard shortcuts

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