stores

package
v0.0.0-...-a59c08c Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorStore

type ActorStore struct {
	Store
}

func NewActorStore

func NewActorStore(ctx context.Context, db *gorm.DB) *ActorStore

NewActorStore returns a new ActorStore initialized with the provided context and DB connection

func (*ActorStore) Create

func (m *ActorStore) Create(actor *db.Actor) error

Create inserts a new Actor record into the database

func (*ActorStore) DeleteByID

func (m *ActorStore) DeleteByID(id id.ID) error

DeleteByID removes an Actor record from the database by ID

func (*ActorStore) GetByID

func (m *ActorStore) GetByID(id id.ID) (*db.Actor, error)

GetByID retrieves a single Actor by its ID

func (*ActorStore) List

func (m *ActorStore) List(limit int) ([]db.Actor, error)

List returns a slice of Actors up to the specified limit

func (*ActorStore) Search

func (m *ActorStore) Search(query string, limit int) ([]db.Actor, error)

Search returns a slice of Actors whose names match the given query, up to the limit

func (*ActorStore) Update

func (m *ActorStore) Update(actor *db.Actor) error

Update modifies an existing Actor record in the database

func (*ActorStore) Upsert

func (m *ActorStore) Upsert(actor *db.Actor) error

Upsert creates or updates an Actor record based on its primary key

type FragmentFilter

type FragmentFilter struct {
	ActorID   *id.ID
	SessionID *id.ID
	Metadata  []MetadataCondition
	StartTime *time.Time
	EndTime   *time.Time
	Embedding *pgvector.Vector
	Limit     int
}

type FragmentStore

type FragmentStore struct {
	Store
	// contains filtered or unexported fields
}

func NewFragmentStore

func NewFragmentStore(ctx context.Context, db *gorm.DB, fragmentTable db.FragmentTable) *FragmentStore

func (*FragmentStore) Create

func (f *FragmentStore) Create(fragment *db.Fragment) error

func (*FragmentStore) DeleteByID

func (f *FragmentStore) DeleteByID(fragmentID id.ID) error

func (*FragmentStore) DeleteBySession

func (f *FragmentStore) DeleteBySession(sessionID id.ID) error

func (*FragmentStore) GetByActor

func (f *FragmentStore) GetByActor(actorID id.ID, limit int) ([]db.Fragment, error)

func (*FragmentStore) GetByID

func (f *FragmentStore) GetByID(fragmentID id.ID) (*db.Fragment, error)

func (*FragmentStore) GetBySession

func (f *FragmentStore) GetBySession(sessionID id.ID, limit int) ([]db.Fragment, error)

func (*FragmentStore) GetRecentByManager

func (f *FragmentStore) GetRecentByManager(managerID id.ID, limit int) ([]db.Fragment, error)

func (*FragmentStore) GetRecentSessionsByActor

func (f *FragmentStore) GetRecentSessionsByActor(actorID id.ID, limit int) ([]id.ID, error)

func (*FragmentStore) SearchByFilter

func (f *FragmentStore) SearchByFilter(filter FragmentFilter) ([]db.Fragment, error)

func (*FragmentStore) SearchSimilar

func (f *FragmentStore) SearchSimilar(embedding pgvector.Vector, sessionID id.ID, limit int) ([]db.Fragment, error)

func (*FragmentStore) UpdateContent

func (f *FragmentStore) UpdateContent(fragmentID id.ID, content string) error

func (*FragmentStore) UpdateEmbedding

func (f *FragmentStore) UpdateEmbedding(fragmentID id.ID, embedding []float32) error

func (*FragmentStore) UpdateID

func (f *FragmentStore) UpdateID(oldID id.ID, newID id.ID) error

func (*FragmentStore) UpdateMetadata

func (f *FragmentStore) UpdateMetadata(fragmentID id.ID, metadata map[string]interface{}) error

func (*FragmentStore) Upsert

func (f *FragmentStore) Upsert(fragment *db.Fragment) error

type MetadataCondition

type MetadataCondition struct {
	Key      string
	Value    interface{}
	Operator MetadataOperator
}

type MetadataOperator

type MetadataOperator string
const (
	MetadataOpEquals    MetadataOperator = "="
	MetadataOpNotEquals MetadataOperator = "!="
	MetadataOpContains  MetadataOperator = "?"
	MetadataOpIn        MetadataOperator = "IN"
)

type SessionStore

type SessionStore struct {
	Store
}

func NewSessionStore

func NewSessionStore(ctx context.Context, db *gorm.DB) *SessionStore

func (*SessionStore) Create

func (cs *SessionStore) Create(session *db.Session) error

func (*SessionStore) GetByID

func (cs *SessionStore) GetByID(id id.ID) (*db.Session, error)

func (*SessionStore) Upsert

func (cs *SessionStore) Upsert(session *db.Session) error

type Store

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

Jump to

Keyboard shortcuts

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