migrator

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

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