inmemory

package
v1.164.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inmemory provides a process-local database.Database for platforms where sqlite is unavailable (js/wasm). It follows the sqlite implementation: insertion order, AND keyword search, and the same sentinel errors. Contents are lost when the process exits.

Case folding is not identical: sqlite's LOWER() only folds ASCII, whereas this package uses Go's Unicode-aware folding, so non-ASCII queries may match here and not in sqlite.

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicateID = errors.New("memory ID already exists")

Functions

This section is empty.

Types

type Database

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

func New

func New() *Database

func (*Database) AddMemory

func (d *Database) AddMemory(ctx context.Context, memory database.UserMemory) error

func (*Database) DeleteMemory

func (d *Database) DeleteMemory(ctx context.Context, memory database.UserMemory) error

func (*Database) GetMemories

func (d *Database) GetMemories(ctx context.Context) ([]database.UserMemory, error)

func (*Database) SearchMemories

func (d *Database) SearchMemories(ctx context.Context, query, category string) ([]database.UserMemory, error)

SearchMemories returns memories whose content contains every whitespace separated word of query and whose category equals category, both compared case-insensitively (Unicode folding, see package doc). Empty query or category disables that filter. Like the sqlite implementation, it returns a nil slice when nothing matches.

func (*Database) UpdateMemory

func (d *Database) UpdateMemory(ctx context.Context, memory database.UserMemory) error

Jump to

Keyboard shortcuts

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