postgres

package
v1.51.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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 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 prompt by name. 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) List

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

List returns prompts matching the filter.

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