postgres

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package postgres implements peng's store.Store interface for PostgreSQL, backed by sqlc-generated query code.

Generated files (db.go, models.go, queries.sql.go) come from running sqlc against the repo-root sqlc.yaml — do not edit them by hand. The adapter in store.go bridges the generated *Queries type to the store.Store interface peng operates against.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type InsertMigrationParams

type InsertMigrationParams struct {
	Version    string
	Name       string
	DurationMs int64
	Checksum   string
}

type InsertSeedParams

type InsertSeedParams struct {
	Version    string
	Name       string
	DurationMs int64
}

type PengMigration

type PengMigration struct {
	Version    string
	Name       string
	AppliedAt  time.Time
	DurationMs int64
	Checksum   string
}

type PengSeed

type PengSeed struct {
	Version    string
	Name       string
	AppliedAt  time.Time
	DurationMs int64
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) DeleteMigration

func (q *Queries) DeleteMigration(ctx context.Context, version string) error

func (*Queries) DeleteSeed

func (q *Queries) DeleteSeed(ctx context.Context, version string) error

func (*Queries) GetMigration

func (q *Queries) GetMigration(ctx context.Context, version string) (PengMigration, error)

func (*Queries) GetSeed

func (q *Queries) GetSeed(ctx context.Context, version string) (PengSeed, error)

func (*Queries) InsertMigration

func (q *Queries) InsertMigration(ctx context.Context, arg InsertMigrationParams) error

func (*Queries) InsertSeed

func (q *Queries) InsertSeed(ctx context.Context, arg InsertSeedParams) error

func (*Queries) ListMigrations

func (q *Queries) ListMigrations(ctx context.Context) ([]PengMigration, error)

func (*Queries) ListSeeds

func (q *Queries) ListSeeds(ctx context.Context) ([]PengSeed, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Store

type Store struct{}

Store implements peng/pg's Store interface for PostgreSQL.

func NewStore

func NewStore() *Store

NewStore returns a Postgres Store. The zero value is also usable.

func (*Store) DeleteMigration

func (*Store) DeleteMigration(ctx context.Context, db DBTX, version string) error

func (*Store) DeleteSeed

func (*Store) DeleteSeed(ctx context.Context, db DBTX, version string) error

func (*Store) EnsureTables

func (*Store) EnsureTables(ctx context.Context, db DBTX) error

func (*Store) GetMigration

func (*Store) GetMigration(ctx context.Context, db DBTX, version string) (*peng.MigrationRecord, error)

func (*Store) GetSeed

func (*Store) GetSeed(ctx context.Context, db DBTX, version string) (*peng.SeedRecord, error)

func (*Store) InsertMigration

func (*Store) InsertMigration(ctx context.Context, db DBTX, version, name string, durationMs int64, checksum string) error

func (*Store) InsertSeed

func (*Store) InsertSeed(ctx context.Context, db DBTX, version, name string, durationMs int64) error

func (*Store) ListMigrations

func (*Store) ListMigrations(ctx context.Context, db DBTX) ([]peng.MigrationRecord, error)

func (*Store) ListSeeds

func (*Store) ListSeeds(ctx context.Context, db DBTX) ([]peng.SeedRecord, error)

Jump to

Keyboard shortcuts

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