migration

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package migration provides database schema migration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicTask

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

func (*BasicTask) CreateTime

func (t *BasicTask) CreateTime() time.Time

func (*BasicTask) Description

func (t *BasicTask) Description() string

func (*BasicTask) Down

func (t *BasicTask) Down(tx *sql.Tx, a db.Adapter) error

func (*BasicTask) Name

func (t *BasicTask) Name() string

func (*BasicTask) Up

func (t *BasicTask) Up(tx *sql.Tx, a db.Adapter) error

type Direction

type Direction bool
const (
	Up   Direction = true
	Down Direction = false
)

func (Direction) String

func (d Direction) String() string

type Status

type Status int
const (
	Success  Status = 1
	Failed   Status = 2
	Rollback Status = 3
)

type Task

type Task interface {
	CreateTime() time.Time
	Name() string
	Description() string
	// Up does not need to commit or rollback, runner with handle it based on error
	Up(tx *sql.Tx, a db.Adapter) error
	// Down does not need to commit or rollback, runner with handle it based on error
	Down(tx *sql.Tx, a db.Adapter) error
}

func InitTask

func InitTask() Task

func NewTask

func NewTask(t time.Time, name string, desc string, up TaskFunc, down TaskFunc) Task

type TaskFunc

type TaskFunc func(tx *sql.Tx, a db.Adapter) error

type TaskRunner

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

func NewRunner

func NewRunner(db *db.Wrapper) *TaskRunner

func (*TaskRunner) Run

func (r *TaskRunner) Run(task Task, direction Direction) error

type Tracker

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

func NewTracker

func NewTracker(db *db.Wrapper) *Tracker

func (*Tracker) GetExecuted

func (t *Tracker) GetExecuted() error

Jump to

Keyboard shortcuts

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