cockroachdb

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cockroachdb provides a native CockroachDB vector-store adapter over pgwire. It uses CockroachDB's built-in VECTOR type, pgvector-compatible distance operators, and native VECTOR INDEX declaration.

Requirements: CockroachDB v25.4 or later is recommended for generally available vector indexing. Schema initialization is explicit through StoreConfig.InitializeSchema.

Index

Constants

View Source
const (
	DefaultSchemaName     = "public"
	DefaultTableName      = "vector_store"
	DefaultMetadataColumn = "metadata"
	DefaultIndexSuffix    = "_embedding_idx"
)
View Source
const Provider = "CockroachDB"

Variables

This section is empty.

Functions

This section is empty.

Types

type DistanceMetric

type DistanceMetric string

DistanceMetric selects both the pgvector-compatible query operator and the native CockroachDB vector-index opclass.

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 implements vector-store capabilities with CockroachDB's native VECTOR type and vector indexes.

func NewStore

func NewStore(ctx context.Context, config StoreConfig) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) DeleteIDs

func (s *Store) DeleteIDs(ctx context.Context, ids []string) error

func (*Store) DeleteWhere

func (s *Store) DeleteWhere(ctx context.Context, predicate filter.Predicate) error

func (*Store) Index

func (s *Store) Index(ctx context.Context, request *vectorstore.IndexRequest) error

func (*Store) Search

type StoreConfig

type StoreConfig struct {
	Pool             *pgxpool.Pool
	SchemaName       string
	TableName        string
	IndexName        string
	MetadataColumn   string
	EmbeddingModel   embedding.Model
	DocumentBatcher  vectorstore.Batcher
	Dimensions       int
	DistanceMetric   DistanceMetric
	InitializeSchema bool
}

func (StoreConfig) Validate

func (s StoreConfig) Validate() error

Jump to

Keyboard shortcuts

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