postgres

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HierarchicalWhere

func HierarchicalWhere(scope, project string, argOffset int) (string, []interface{})

HierarchicalWhere builds the OR-based hierarchical filter for recall. With project set: searches global + project-scoped memories. Without project: searches by explicit scope only.

Types

type Client

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

func NewClient

func NewClient(databaseURL string) (*Client, error)

func (*Client) CleanExpired

func (c *Client) CleanExpired(ctx context.Context) (int, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id string) error

func (*Client) EnsureEmbeddingDimension

func (c *Client) EnsureEmbeddingDimension(ctx context.Context, dim int) error

EnsureEmbeddingDimension verifies that the embedding column matches the expected vector dimension. On first run (no column), it creates the column. If the table has data with a different dimension, it returns an error.

func (*Client) GetByID

func (c *Client) GetByID(ctx context.Context, id string) (*t.Memory, error)

func (*Client) List

func (c *Client) List(ctx context.Context, filter Filter, limit int) ([]t.Memory, error)

func (*Client) RunMigrations

func (c *Client) RunMigrations(ctx context.Context) error

func (*Client) Search

func (c *Client) Search(ctx context.Context, embedding []float32, filter Filter, limit int) ([]SearchResult, error)

func (*Client) SearchWithWhere

func (c *Client) SearchWithWhere(ctx context.Context, embedding []float32, where string, whereArgs []interface{}, limit int) ([]SearchResult, error)

SearchWithWhere performs vector search with a custom WHERE clause (for hierarchical recall)

func (*Client) Stats

func (c *Client) Stats(ctx context.Context) (*t.StatsResult, error)

func (*Client) UpdateWeight

func (c *Client) UpdateWeight(ctx context.Context, id string, weight float64) error

func (*Client) Upsert

func (c *Client) Upsert(ctx context.Context, id string, embedding []float32, mem *t.Memory) error

type Filter

type Filter struct {
	Scope    string
	Project  string
	Type     string
	Delivery string
}

type SearchResult

type SearchResult struct {
	Memory t.Memory
	Score  float32
}

Jump to

Keyboard shortcuts

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