db_utils

package
v0.0.0-...-4a192ad Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnDbConn       = "Establishing database connection"
	OnNewInstance  = "Creating new migrate instance"
	OnVersionCheck = "Checking database version"
	OnDrop         = "Dropping database"
	OnUpgrade      = "Upgrading database"
)

Those are actually not only errors, also used for logging

Variables

This section is empty.

Functions

func LogMigrationErr

func LogMigrationErr(mErr MigrationErr, logger *slog.Logger)

func NewMigrateInstance

func NewMigrateInstance(db *sql.DB, sourceURL string, cfg *pgx_driver.Config) (*migrate.Migrate, error)

Types

type MigrationConfig

type MigrationConfig struct {
	MigrationsPath string
	DBurl          string
	VersionLimit   int
	Drop           bool
	Logger         *slog.Logger
}

type MigrationErr

type MigrationErr = errorsx.CustomErr[map[string]any]

func DoMigrate

func DoMigrate(ctx context.Context, cfg MigrationConfig) (uint, bool, MigrationErr)

func NewMigrationErr

func NewMigrationErr(err string, vars map[string]any) MigrationErr

Jump to

Keyboard shortcuts

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