migrator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationOpts

type MigrationOpts struct {
	PG MigrationOptsPG
	CH MigrationOptsCH
}

type MigrationOptsCH

type MigrationOptsCH struct {
	Addr     string
	Username string
	Password string
	Database string
}

type MigrationOptsPG

type MigrationOptsPG struct {
	URL string
}

type Migrator

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

func New

func New(opts MigrationOpts) (*Migrator, error)

func (*Migrator) Close

func (m *Migrator) Close(ctx context.Context) (error, error)

func (*Migrator) Down

func (m *Migrator) Down(ctx context.Context, n int) (int, int, error)

Down migrates the database down by n migrations. It returns the updated version, the number of migrations rolled back, and an error.

func (*Migrator) Force

func (m *Migrator) Force(ctx context.Context, version int) error

func (*Migrator) Up

func (m *Migrator) Up(ctx context.Context, n int) (int, int, error)

Up migrates the database up by n migrations. It returns the updated version, the number of migrations applied, and an error.

func (*Migrator) Version

func (m *Migrator) Version(ctx context.Context) (int, error)

Jump to

Keyboard shortcuts

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