memory

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package memory defines pigo's durable memory SDK seam. It is a pigo-original addition with no upstream mirror.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

func NewFileStore

func NewFileStore(dir string) (*FileStore, error)

func (*FileStore) Append

func (store *FileStore) Append(ctx context.Context, item Item) (string, error)

func (*FileStore) Delete

func (store *FileStore) Delete(ctx context.Context, id string) error

func (*FileStore) Get

func (store *FileStore) Get(ctx context.Context, id string) (Item, error)

func (*FileStore) Query

func (store *FileStore) Query(ctx context.Context, filter Filter) ([]Item, error)

type Filter

type Filter struct {
	Tags     []string
	Since    time.Time
	Until    time.Time
	Contains string
	Limit    int
}

type Item

type Item struct {
	ID      string            `json:"id"`
	Time    time.Time         `json:"time"`
	Content string            `json:"content"`
	Tags    []string          `json:"tags,omitempty"`
	Meta    map[string]string `json:"meta,omitempty"`
}

type Scored

type Scored struct {
	Item
	Score float64
}

type SemanticSearcher

type SemanticSearcher interface {
	Search(context.Context, string, int) ([]Scored, error)
}

type Store

type Store interface {
	Append(context.Context, Item) (string, error)
	Get(context.Context, string) (Item, error)
	Query(context.Context, Filter) ([]Item, error)
	Delete(context.Context, string) error
}

Jump to

Keyboard shortcuts

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