postgres

package
v1.99.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package postgres provides PostgreSQL storage for prompts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements prompt.Store using PostgreSQL.

func New

func New(db *sql.DB) *Store

New creates a new PostgreSQL prompt store.

func (*Store) Count

func (s *Store) Count(ctx context.Context, filter prompt.ListFilter) (int, error)

Count returns the number of prompts matching the filter.

func (*Store) Create

func (s *Store) Create(ctx context.Context, p *prompt.Prompt) error

Create persists a new prompt. If p.ID is empty the database generates one.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, name string) error

Delete removes a non-personal prompt by name.

func (*Store) DeleteByID

func (s *Store) DeleteByID(ctx context.Context, id string) error

DeleteByID removes a prompt by ID.

func (*Store) Get

func (s *Store) Get(ctx context.Context, name string) (*prompt.Prompt, error)

Get retrieves a non-personal (global or persona) prompt by name. Personal prompts are per-owner; use GetPersonal. Returns nil, nil if not found.

func (*Store) GetByID

func (s *Store) GetByID(ctx context.Context, id string) (*prompt.Prompt, error)

GetByID retrieves a prompt by ID. Returns nil, nil if not found.

func (*Store) GetPersonal added in v1.81.0

func (s *Store) GetPersonal(ctx context.Context, ownerEmail, name string) (*prompt.Prompt, error)

GetPersonal retrieves a personal prompt by its owner and name. Returns nil, nil if not found.

func (*Store) List

func (s *Store) List(ctx context.Context, filter prompt.ListFilter) ([]prompt.Prompt, error)

List returns prompts matching the filter.

func (*Store) Search added in v1.81.0

Search ranks approved prompts by relevance to the query within the caller's visibility. A non-nil q.Embedding selects hybrid (semantic + lexical) ranking; a nil embedding selects the lexical-only fallback used when no embedding provider is configured. Visibility is applied in SQL before ranking, so a prompt the caller cannot read is never returned.

func (*Store) Update

func (s *Store) Update(ctx context.Context, p *prompt.Prompt) error

Update modifies an existing prompt identified by ID.

Jump to

Keyboard shortcuts

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