migrate

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package migrate handles database migrations. This file defines the configuration loading specific to the migration process.

Package migrate contains the logic for running database migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationConfig

type MigrationConfig struct {
	DSN            string
	MigrationsPath string
}

MigrationConfig holds the configuration required for running migrations.

func NewMigrationConfig

func NewMigrationConfig() (*MigrationConfig, error)

NewMigrationConfig creates a new configuration by parsing environment variables and constructing a URI-based DSN suitable for golang-migrate.

type Migrator

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

Migrator is a struct that manages the database migration process.

func NewMigrator

func NewMigrator(cfg *MigrationConfig) (*Migrator, error)

NewMigrator initializes a new Migrator with a real migrate instance.

func NewMigratorWithDriver

func NewMigratorWithDriver(driver migrator) *Migrator

NewMigratorWithDriver initializes a new Migrator with a provided driver for testing.

func (*Migrator) Run

func (m *Migrator) Run() error

Run applies all available 'up' migrations and returns an error on failure.

Jump to

Keyboard shortcuts

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