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 ¶
const MigrationsDirectory = "migrations"
MigrationsDirectory is the path the schema lives at inside Migrations; the //go:embed pattern above names the same directory.
Variables ¶
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 ¶
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.