migrations

package
Version: v0.0.0-...-b425644 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Con

type Con interface {
	QueryRow(query string, args ...interface{}) *sql.Row
	Query(query string, args ...interface{}) (*sql.Rows, error)
	Prepare(query string) (*sql.Stmt, error)
	Exec(query string, args ...interface{}) (sql.Result, error)
}

type Migration

type Migration struct {
	Idx       int
	Statement string
	Func      func(Con) error
	Logger    logger
	MD5       string
	Executed  bool
}

func (*Migration) Execute

func (m *Migration) Execute(tx Tx) error

type Migrations

type Migrations struct {
	Logger logger
	// contains filtered or unexported fields
}

func New

func New(migrations ...interface{}) *Migrations

func (Migrations) All

func (list Migrations) All(tx Tx) (out []*Migration, err error)

func (Migrations) Execute

func (list Migrations) Execute(db *sql.DB) error

func (Migrations) ExecuteTx

func (list Migrations) ExecuteTx(tx Tx) error

type Tx

type Tx interface {
	Con
	Commit() error
	Rollback() error
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL