db

package
v0.0.0-...-ad8a21f Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateConnectorFS

func MigrateConnectorFS(database *sqlx.DB, src fs.FS, dir, name string) error

MigrateConnectorFS applies pending migrations from src against the database, tracking version state in schema_migrations_<name> so each connector versions its schema independently of core and of other connectors.

func MigrateEmbedded

func MigrateEmbedded(database *sqlx.DB) error

MigrateEmbedded applies all pending migrations from the embedded migrations/ directory against the supplied database. Returns nil when there is nothing to apply.

func Open

func Open(cfg Config) (*sqlx.DB, error)

Open opens and validates a PostgreSQL connection using the supplied config.

func TxFn

func TxFn(ctx context.Context, db *sqlx.DB, fn func(tx *sql.Tx) error) error

TxFn executes fn within a new database transaction. If fn returns an error, the transaction is rolled back. If fn returns nil, the transaction is committed.

Types

type Config

type Config struct {
	DSN          string
	MaxOpenConns int
	MaxIdleConns int
}

Config holds configuration for opening a database connection.

Jump to

Keyboard shortcuts

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