stork

package module
v0.0.0-...-b94b79f Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 3 Imported by: 0

README

Stork - Lowtech database migrations

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseFunction

type DatabaseFunction func(db *sql.DB)

func NoopDBFunc

func NoopDBFunc() DatabaseFunction

type GetVersionFunc

type GetVersionFunc func(db *sql.DB) int

type Migration

type Migration struct {
	SchemaVersion int
	Up            DatabaseFunction
	Down          DatabaseFunction
}

type Migrator

type Migrator struct {
	CheckSequence bool
	GetVersion    GetVersionFunc
	SetVersion    SetVersionFunction
	BeforeAll     DatabaseFunction
	AfterAll      DatabaseFunction
	BeforeEach    DatabaseFunction
	AfterEach     DatabaseFunction
	// contains filtered or unexported fields
}

func NewMigrator

func NewMigrator(getVersion GetVersionFunc, setVersion SetVersionFunction) Migrator

func (*Migrator) MigrateTo

func (m *Migrator) MigrateTo(db *sql.DB, version int)

func (*Migrator) MigrateToLatest

func (m *Migrator) MigrateToLatest(db *sql.DB)

func (*Migrator) RegisterMigrations

func (m *Migrator) RegisterMigrations(migrations ...Migration)

type SetVersionFunction

type SetVersionFunction func(db *sql.DB, version int)

Jump to

Keyboard shortcuts

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