migrate

package
v1.367.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: MIT Imports: 13 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

func NewMigrator(tracer *tracer.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

func (d *Database) GetURL() ([]byte, 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

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

Ping the migrator.

type URL

type URL string

URL for migrate.

func (URL) String added in v1.362.0

func (u URL) String() string

String for URL.

Directories

Path Synopsis
telemetry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳