Documentation ¶
Index ¶
- Variables
- func AddMigration(up func(*sql.Tx) error, down func(*sql.Tx) error)
- func Create(db *sql.DB, dir, name, migrationType string) error
- func CreateMigration(name, migrationType, dir string, t time.Time) (path string, err error)
- func NumericComponent(name string) (int64, error)
- func Run(command string, db *sql.DB, dir string, args ...string) error
- func SetDialect(d string) error
- type Client
- func (c *Client) AddMigration(up func(*sql.Tx) error, down func(*sql.Tx) error)
- func (c *Client) Down(db *sql.DB, dir string) error
- func (c *Client) FinalizeMigration(tx *sql.Tx, direction bool, v int64) error
- func (c *Client) GetDBVersion(db *sql.DB) (int64, error)
- func (c *Client) Redo(db *sql.DB, dir string) error
- func (c *Client) SetDialect(d string) error
- func (c *Client) Status(db *sql.DB, dir string) error
- func (c *Client) Up(db *sql.DB, dir string) error
- func (c *Client) UpByOne(db *sql.DB, dir string) error
- func (c *Client) Version(db *sql.DB, dir string) error
- type Migration
- type MigrationRecord
- type Migrations
- func (ms Migrations) Current(current int64) (*Migration, error)
- func (ms Migrations) Last() (*Migration, error)
- func (ms Migrations) Len() int
- func (ms Migrations) Less(i, j int) bool
- func (ms Migrations) Next(current int64) (*Migration, error)
- func (ms Migrations) String() string
- func (ms Migrations) Swap(i, j int)
- type MySqlDialect
- type PostgresDialect
- type SqlDialect
- type Sqlite3Dialect
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoCurrentVersion = errors.New("no current version found") ErrNoNextVersion = errors.New("no next version found") )
Functions ¶
func AddMigration ¶
AddMigration exists for legacy support of the package global use of Goose. Calling the AddMigration method on a Goose struct is the preferred method.
func CreateMigration ¶
func NumericComponent ¶
look for migration scripts with names in the form:
XXX_descriptivename.ext
where XXX specifies the version number and ext specifies the type of migration
func SetDialect ¶
Types ¶
type Client ¶
type Client struct { // TableName is the name of the table used to store migration status // for this client. TableName string // Dialect is the SqlDialect to use. Dialect SqlDialect // Migrations is the list of migrations. Migrations Migrations }
Client stores the migration state and preferences. Prefer interacting with the Goose API through a Client struct created with New rather than using the global Client and functions.
func New ¶
func New(tableName string, dialect SqlDialect) *Client
func (*Client) AddMigration ¶
AddMigration adds a new go migration to the goose struct.
func (*Client) FinalizeMigration ¶
Update the version table for the given migration, and finalize the transaction.
func (*Client) GetDBVersion ¶
retrieve the current version for this DB. Create and initialize the DB version table if it doesn't exist.
func (*Client) SetDialect ¶
type Migration ¶
type MigrationRecord ¶
type Migrations ¶
type Migrations []*Migration
func (Migrations) Last ¶
func (ms Migrations) Last() (*Migration, error)
func (Migrations) Less ¶
func (ms Migrations) Less(i, j int) bool
func (Migrations) String ¶
func (ms Migrations) String() string
func (Migrations) Swap ¶
func (ms Migrations) Swap(i, j int)
type MySqlDialect ¶
type MySqlDialect struct{}
type PostgresDialect ¶
type PostgresDialect struct{}
type SqlDialect ¶
type SqlDialect interface {
// contains filtered or unexported methods
}
SqlDialect abstracts the details of specific SQL dialects for goose's few SQL specific statements
func GetDialect ¶
func GetDialect() SqlDialect
type Sqlite3Dialect ¶
type Sqlite3Dialect struct{}