pgvector

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package pgvector implements the vectorstore.Store interface for PostgreSQL with pgvector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements vectorstore.Store for PostgreSQL with pgvector extension.

func New

func New(ctx context.Context, connStr string) (*Client, error)

New creates a new pgvector client. connStr should be a PostgreSQL connection string, e.g.: "postgres://user:password@localhost:5432/dbname"

func (*Client) Close

func (c *Client) Close() error

Close releases resources.

func (*Client) Count

func (c *Client) Count(ctx context.Context, collection string) (int64, error)

Count returns the number of points in a collection.

func (*Client) DeleteCollection

func (c *Client) DeleteCollection(ctx context.Context, name string) error

DeleteCollection removes a collection table and all its data.

func (*Client) EnsureCollection

func (c *Client) EnsureCollection(ctx context.Context, name string, dim int) error

EnsureCollection creates a table for the collection if it doesn't exist.

func (*Client) Search

func (c *Client) Search(ctx context.Context, collection string, vector []float32, topK int) ([]vectorstore.Result, error)

Search performs similarity search and returns top-k results. Uses cosine distance (1 - cosine_similarity) for ranking.

func (*Client) Upsert

func (c *Client) Upsert(ctx context.Context, collection string, points []vectorstore.Point) error

Upsert inserts or updates points in a collection.

Jump to

Keyboard shortcuts

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