Documentation
¶
Overview ¶
Package contextstore provides the storage components for the context data used by the ProjectMemory service.
Index ¶
- type ContextStore
- type SQLiteContextStore
- func (s *SQLiteContextStore) Clear() (int, error)
- func (s *SQLiteContextStore) Close() error
- func (s *SQLiteContextStore) Delete(id string) error
- func (s *SQLiteContextStore) Initialize(dbPath string) error
- func (s *SQLiteContextStore) Replace(id string, summaryText string, embedding []byte, timestamp time.Time) error
- func (s *SQLiteContextStore) Search(queryEmbedding []float32, limit int) ([]string, error)
- func (s *SQLiteContextStore) Store(id string, summaryText string, embedding []byte, timestamp time.Time) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextStore ¶
type ContextStore interface {
// Initialize initializes the store with configuration options.
Initialize(dbPath string) error
// Close closes the store and releases any resources.
Close() error
// Store stores the context data in the database.
Store(id string, summaryText string, embedding []byte, timestamp time.Time) error
// Search searches for context entries similar to the given embedding.
Search(queryEmbedding []float32, limit int) ([]string, error)
// Delete deletes a specific context entry from the store by ID.
Delete(id string) error
// Clear removes all context entries from the store.
// Returns the number of entries that were deleted.
Clear() (int, error)
// Replace replaces a context entry with updated information.
// Note: The current Store method performs replacement when an ID already exists,
// but this method makes the intent clearer.
Replace(id string, summaryText string, embedding []byte, timestamp time.Time) error
}
ContextStore defines the interface for storing and retrieving context data.
type SQLiteContextStore ¶
type SQLiteContextStore struct {
// contains filtered or unexported fields
}
SQLiteContextStore is an implementation of ContextStore that uses SQLite.
func NewSQLiteContextStore ¶
func NewSQLiteContextStore() *SQLiteContextStore
NewSQLiteContextStore creates a new SQLiteContextStore instance.
func (*SQLiteContextStore) Clear ¶ added in v0.1.3
func (s *SQLiteContextStore) Clear() (int, error)
Clear removes all context entries from the store. Returns the number of entries that were deleted.
func (*SQLiteContextStore) Close ¶
func (s *SQLiteContextStore) Close() error
Close closes the store and releases any resources.
func (*SQLiteContextStore) Delete ¶ added in v0.1.3
func (s *SQLiteContextStore) Delete(id string) error
Delete deletes a specific context entry from the store by ID.
func (*SQLiteContextStore) Initialize ¶
func (s *SQLiteContextStore) Initialize(dbPath string) error
Initialize initializes the store with the given database path.
func (*SQLiteContextStore) Replace ¶ added in v0.1.3
func (s *SQLiteContextStore) Replace(id string, summaryText string, embedding []byte, timestamp time.Time) error
Replace replaces a context entry with updated information.