migrator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

type Migrator

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

func New

func New(db DB, schema Schema) *Migrator

func (*Migrator) Migrate

func (m *Migrator) Migrate(ctx context.Context) error

type Schema

type Schema interface {
	Migrations() map[string]string
	CreateSchema(ctx context.Context, db DB) error
	CreateMigrationTable(ctx context.Context, db DB) error
	SelectMaxMigration(ctx context.Context, db DB) *sql.Row
	InsertMigrationRow(ctx context.Context, db DB, version uint32, fileName, sha string) error
	SelectUnlock(ctx context.Context, db DB) error
	SelectLock(ctx context.Context, db DB) error
}

Schema performs queries on the RDBMS at hand. This setup is a mess, and should be cleaned up at some point.

type TableNames

type TableNames struct {
	Schema string
	Prefix string
}

Jump to

Keyboard shortcuts

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