migrate

package
v1.237.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidConfig for source or db.
	ErrInvalidConfig = errors.New("invalid config")

	// ErrInvalidMigration happened.
	ErrInvalidMigration = errors.New("invalid migration")

	// ErrInvalidPing happened.
	ErrInvalidPing = errors.New("invalid ping")
)

Module for fx.

Functions

func NewMigrator added in v1.3.0

func NewMigrator(t trace.Tracer) migrator.Migrator

NewMigrator for databases.

Types

type Config

type Config struct {
	Databases []*Database `yaml:"databases,omitempty" json:"databases,omitempty" toml:"databases,omitempty"`
}

Config for migrate.

func (*Config) Database

func (c *Config) Database(name string) *Database

Database by name.

type Database

type Database struct {
	Name   string `yaml:"name,omitempty" json:"name,omitempty" toml:"name,omitempty"`
	Source string `yaml:"source,omitempty" json:"source,omitempty" toml:"source,omitempty"`
	URL    URL    `yaml:"url,omitempty" json:"url,omitempty" toml:"url,omitempty"`
}

Database for migrate.

func (*Database) GetURL added in v1.99.0

func (d *Database) GetURL() (string, error)

GetURL for database.

type Migrator

type Migrator struct{}

Migrator using migrate.

func (*Migrator) Migrate

func (m *Migrator) Migrate(ctx context.Context, source, db string, version uint64) ([]string, error)

Migrate a database to a version and returning the database logs.

func (*Migrator) Ping added in v1.4.0

func (m *Migrator) Ping(ctx context.Context, source, db string) error

Ping the migrator.

type URL added in v1.99.0

type URL string

URL for migrate.

Directories

Path Synopsis
telemetry

Jump to

Keyboard shortcuts

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