driver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mysql

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

Mysql is one of driver impls.

func (*Mysql) Close

func (m *Mysql) Close() error

Close mysql connection.

func (*Mysql) CreateVersionTableIfNotExists

func (m *Mysql) CreateVersionTableIfNotExists() error

CreateVersionTableIfNotExists creates schema version table if table does not exist.

func (*Mysql) DeleteVersion

func (m *Mysql) DeleteVersion(version uint64) error

DeleteVersion deletes version column from database.

func (*Mysql) Exec

func (m *Mysql) Exec(query string) error

Exec executes query.

func (*Mysql) GetAppliedTimeList added in v1.0.0

func (m *Mysql) GetAppliedTimeList() (map[uint64]time.Time, error)

GetAppliedTimeList returns list of migration applied times.

func (*Mysql) GetCurrentVersion

func (m *Mysql) GetCurrentVersion() (uint64, error)

GetCurrentVersion returns current migration version of database.

func (*Mysql) Open

func (m *Mysql) Open(dsn string) error

Open mysql connection.

func (*Mysql) SetVersion

func (m *Mysql) SetVersion(version uint64) error

SetVersion appends new version.

func (*Mysql) Transaction

func (m *Mysql) Transaction(fn func() error) error

Transaction executes a function atomically. Roll back the process if function returns error.

type Row added in v1.0.0

type Row struct {
	Version   uint64
	CreatedAt time.Time
}

Row is TDriver's row

type TDriver

type TDriver struct {
	CountOfExec int
	Rows        []*Row
	Created     bool
	JustCreated bool
	// contains filtered or unexported fields
}

TDriver is driver impl for test. Don't use expect in test.

func (*TDriver) Close

func (td *TDriver) Close() error

Close ...

func (*TDriver) CreateVersionTableIfNotExists

func (td *TDriver) CreateVersionTableIfNotExists() error

CreateVersionTableIfNotExists ...

func (*TDriver) DeleteVersion

func (td *TDriver) DeleteVersion(version uint64) error

DeleteVersion ...

func (*TDriver) Exec

func (td *TDriver) Exec(query string) error

Exec ...

func (*TDriver) GetAppliedTimeList added in v1.0.0

func (td *TDriver) GetAppliedTimeList() (map[uint64]time.Time, error)

GetAppliedTimeList returns list of migration applied times.

func (*TDriver) GetCurrentVersion

func (td *TDriver) GetCurrentVersion() (uint64, error)

GetCurrentVersion ...

func (*TDriver) Open

func (td *TDriver) Open(dsn string) error

Open ...

func (*TDriver) SetVersion

func (td *TDriver) SetVersion(version uint64) error

SetVersion ...

func (*TDriver) Transaction

func (td *TDriver) Transaction(fn func() error) error

Transaction ...

func (*TDriver) Versions

func (td *TDriver) Versions() []uint64

Versions returns only version columns

Jump to

Keyboard shortcuts

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