Documentation
¶
Overview ¶
Package store provides vector storage backends.
Index ¶
- Variables
- type MemoryStore
- func (s *MemoryStore) Add(ctx context.Context, ids []string, vectors [][]float64, ...) error
- func (s *MemoryStore) Close() error
- func (s *MemoryStore) Count(ctx context.Context) (int64, error)
- func (s *MemoryStore) Delete(ctx context.Context, ids []string) error
- func (s *MemoryStore) GetAll() map[string][]float64
- func (s *MemoryStore) GetByID(ctx context.Context, id string) ([]float64, error)
- func (s *MemoryStore) GetByIDs(ctx context.Context, ids []string) ([][]float64, error)
- func (s *MemoryStore) GetMetadata(id string) (map[string]any, bool)
- type VectorStore
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("vector not found")
)
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an in-memory vector store for testing.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new in-memory vector store.
func (*MemoryStore) Add ¶
func (s *MemoryStore) Add(ctx context.Context, ids []string, vectors [][]float64, metadata []map[string]any) error
Add adds vectors to the store.
func (*MemoryStore) Count ¶
func (s *MemoryStore) Count(ctx context.Context) (int64, error)
Count returns total vector count.
func (*MemoryStore) Delete ¶
func (s *MemoryStore) Delete(ctx context.Context, ids []string) error
Delete removes vectors by ID.
func (*MemoryStore) GetAll ¶
func (s *MemoryStore) GetAll() map[string][]float64
GetAll returns all vectors (for testing).
func (*MemoryStore) GetMetadata ¶
func (s *MemoryStore) GetMetadata(id string) (map[string]any, bool)
GetMetadata retrieves metadata for a vector.
type VectorStore ¶
type VectorStore interface {
// GetByIDs retrieves vectors by their IDs.
GetByIDs(ctx context.Context, ids []string) ([][]float64, error)
// GetByID retrieves a single vector by ID.
GetByID(ctx context.Context, id string) ([]float64, error)
// Add adds vectors to the store.
Add(ctx context.Context, ids []string, vectors [][]float64, metadata []map[string]any) error
// Delete removes vectors by ID.
Delete(ctx context.Context, ids []string) error
// Count returns total vector count.
Count(ctx context.Context) (int64, error)
// Close closes the connection.
Close() error
}
VectorStore is the interface for vector storage backends.
Click to show internal directories.
Click to hide internal directories.