db

package
v0.0.0-...-e5ee784 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB(dsn string, waitForDB time.Duration) (*sql.DB, error)

func CreateMigrationFiles

func CreateMigrationFiles(name string) ([]migrations.File, error)

func LatestMigrationVersion

func LatestMigrationVersion() (int, error)

func Migrate

func Migrate(ctx context.Context, db *sql.DB) error

func MigrateUpTo

func MigrateUpTo(ctx context.Context, db *sql.DB, version uint) error

func RunInTx

func RunInTx(ctx context.Context, db *sql.DB, fn func(txq *queries.Queries) error) error

RunInTx executes fn within a database transaction. If fn returns an error, the transaction is rolled back. Otherwise, it is committed.

func RunInTxResult

func RunInTxResult[T any](ctx context.Context, db *sql.DB, fn func(txq *queries.Queries) (T, error)) (T, error)

RunInTxResult executes fn within a database transaction, returning both a value and an error. If fn returns an error, the transaction is rolled back. Otherwise, it is committed.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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