store

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package store carries the adapter's schema. The .sql files are the only schema source; nothing in Go declares a domain table. The binary that owns the pool applies them with the shared candace/pkg/sqlmigrate, beside CSF's own schema:

handle := pool.OpenSQL()
defer handle.Close()
err := sqlmigrate.Apply(ctx, handle, store.Migrations, store.MigrationsDirectory)

Index

Constants

View Source
const MigrationsDirectory = "migrations"

MigrationsDirectory is the path the schema lives at inside Migrations; the //go:embed pattern above names the same directory.

Variables

View Source
var Migrations embed.FS

Migrations holds the adapter's schema. Specs apply the very same bytes production does.

Functions

This section is empty.

Types

type PostgresStore

type PostgresStore struct {
	*storedb.Queries
	// contains filtered or unexported fields
}

PostgresStore is the SQLC query set plus the transaction boundary the adapter needs. The database pool remains owned by the mounting binary.

func NewPostgresStore

func NewPostgresStore(database csfpg.IDB) (*PostgresStore, error)

NewPostgresStore binds generated queries to the database capability the binary granted: a csfpg pool in production, pgmem's in a spec.

func (*PostgresStore) Transact

func (store *PostgresStore) Transact(ctx context.Context, operation copilotadapter.StoreTransaction) error

Transact runs operation against one transaction and commits only when the callback succeeds.

Jump to

Keyboard shortcuts

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