mysql

package
v0.0.0-...-ebdf1d9 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mysql implements MySQL migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TearDown

func TearDown(db *sqlx.DB, dbName string) error

TearDown removes the unit test database.

Types

type Configuration

type Configuration struct {
	driver.Info
}

Configuration defines the shared configuration interface.

func SetUp

func SetUp(envPath string, dbName string) (*migration.Info, Configuration)

SetUp is a function for unit tests on a separate database.

func (Configuration) New

func (c Configuration) New() (*migration.Info, error)

New creates a migration connection to the database.

type Entity

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

Entity defines fulfills the migration interface.

func (*Entity) CreateTable

func (t *Entity) CreateTable() error

CreateTable returns true if the migration was created

func (*Entity) Extension

func (t *Entity) Extension() string

Extension returns the file extension with a period

func (*Entity) Migrate

func (t *Entity) Migrate(qry string) error

Migrate runs a query and returns error

func (*Entity) RecordDown

func (t *Entity) RecordDown(name string) error

RecordDown removes a record from the database and updates the AUTO_INCREMENT value

func (*Entity) RecordUp

func (t *Entity) RecordUp(name string) error

RecordUp adds a record to the database

func (*Entity) Status

func (t *Entity) Status() (string, error)

Status returns last migration name

func (*Entity) TableExist

func (t *Entity) TableExist() error

TableExist returns true if the migration table exists

type Item

type Item struct {
	ID        uint32    `db:"id"`
	Name      string    `db:"name"`
	CreatedAt time.Time `db:"created_at"`
}

Item defines the migration table.

Jump to

Keyboard shortcuts

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