migration

package
v0.0.0-...-b1e8203 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host          string
	Port          int
	User          string
	Password      string
	DBName        string
	SSLMode       string
	MigrationPath string
}

type DBType

type DBType string
const (
	Postgres DBType = "postgres"
	MongoDB  DBType = "mongodb"
)

type Migrator

type Migrator interface {
	Up(ctx context.Context, module string) error
	Down(ctx context.Context, module string, steps int) error
	Version(ctx context.Context, module string) (int, bool, error)
	Force(ctx context.Context, module string, version int) error
	Drop(ctx context.Context, module string) error
	GetModules() ([]string, error)
}

func New

func New(dbType DBType, cfg *Config, log logger.Logger, migrationsDir string) (Migrator, error)

func NewMongoDB

func NewMongoDB(cfg *Config, log logger.Logger, migrationsDir string) Migrator

func NewPostgresMigrator

func NewPostgresMigrator(config *Config, log logger.Logger) (Migrator, error)

Jump to

Keyboard shortcuts

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