Documentation
¶
Overview ¶
Package pgstore implements the shared pgwire execution semantics used by PostgreSQL/pgvector and CockroachDB. Provider packages remain responsible for configuration validation and schema provisioning.
Index ¶
- type Config
- type DistanceMetric
- type Store
- func (s *Store) DeleteIDs(ctx context.Context, ids []string) (err error)
- func (s *Store) DeleteWhere(ctx context.Context, expr filter.Predicate) (err error)
- func (s *Store) Index(ctx context.Context, request *vectorstore.IndexRequest) (err error)
- func (s *Store) Search(ctx context.Context, req *vectorstore.SearchRequest) (response *vectorstore.SearchResponse, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Provider string
Pool *pgxpool.Pool
SchemaName string
TableName string
MetadataColumn string
EmbeddingModel embedding.Model
DocumentBatcher vectorstore.Batcher
DistanceMetric DistanceMetric
}
Config contains only shared execution dependencies. Schema policy belongs to the provider package and must be resolved before constructing the engine.
type DistanceMetric ¶
type DistanceMetric string
DistanceMetric selects the pgvector-compatible query operator.
const ( DistanceCosine DistanceMetric = "cosine" DistanceL2 DistanceMetric = "l2" DistanceIP DistanceMetric = "ip" )
func (DistanceMetric) String ¶
func (d DistanceMetric) String() string
func (DistanceMetric) Valid ¶
func (d DistanceMetric) Valid() bool
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store executes pgvector-compatible data operations for one named provider.
func New ¶
New builds the shared PostgreSQL-dialect store that pgvector, CockroachDB, and other wire-compatible backends delegate to. The provider name is passed in so errors name the module the caller actually imported instead of this internal one.
func (*Store) DeleteIDs ¶
DeleteIDs removes rows by primary key — `DELETE ... WHERE id = ANY($1)`. pgx maps the []string to a Postgres text array. An empty slice is a no-op; unknown ids are silently ignored (idempotent). Implements vectorstore.IDDeleter.
func (*Store) DeleteWhere ¶
func (*Store) Index ¶
func (s *Store) Index(ctx context.Context, request *vectorstore.IndexRequest) (err error)
Index embeds the documents and upserts them into the configured table.
func (*Store) Search ¶
func (s *Store) Search(ctx context.Context, req *vectorstore.SearchRequest) (response *vectorstore.SearchResponse, err error)
Search embeds the query, runs an ANN search, and returns the matching documents above the configured MinScore threshold.