Documentation
¶
Index ¶
- type Adapter
- type DownMigrations
- type Migration
- type Migrations
- type Migrator
- func (m *Migrator) CreateTable() error
- func (m *Migrator) Down() error
- func (m *Migrator) DownWithStep(step int) error
- func (m *Migrator) FindMigrations() error
- func (m *Migrator) Reset() error
- func (m *Migrator) RunMigration(mg *Migration) error
- func (m *Migrator) Status(out io.Writer) error
- func (m *Migrator) Up() error
- func (m *Migrator) UpWithVersion(version string) error
- type MySQLAdapter
- type PostgreSQLAdapter
- func (a *PostgreSQLAdapter) CreateDatabase() error
- func (a *PostgreSQLAdapter) CreateMigrationsTable(ctx context.Context) error
- func (a *PostgreSQLAdapter) DropDatabase() error
- func (a *PostgreSQLAdapter) GetAdapter() string
- func (a *PostgreSQLAdapter) GetDBName() string
- func (a *PostgreSQLAdapter) Open() error
- type SQLiteAdapter
- type UpMigrations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
Open() error
CreateDatabase() error
DropDatabase() error
CreateMigrationsTable(ctx context.Context) error
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
GetAdapter() string
GetDBName() string
}
type DownMigrations ¶
type DownMigrations Migrations
func (DownMigrations) Len ¶
func (ms DownMigrations) Len() int
func (DownMigrations) Less ¶
func (ms DownMigrations) Less(i, j int) bool
func (DownMigrations) Swap ¶
func (ms DownMigrations) Swap(i, j int)
type Migration ¶
func ParseMigrationFilename ¶
type Migrations ¶
type Migrations []*Migration
type Migrator ¶
type Migrator struct {
Adapter Adapter
MigrationsPath string
MigrationsTable string
UpMigrations UpMigrations
DownMigrations DownMigrations
}
func NewMigrator ¶
func (*Migrator) CreateTable ¶
func (*Migrator) DownWithStep ¶
func (*Migrator) FindMigrations ¶
func (*Migrator) RunMigration ¶
func (*Migrator) UpWithVersion ¶
type MySQLAdapter ¶ added in v0.1.7
func NewMySQLAdapter ¶ added in v0.1.7
func NewMySQLAdapter(config *schema.Config) *MySQLAdapter
func (*MySQLAdapter) CreateDatabase ¶ added in v0.1.7
func (a *MySQLAdapter) CreateDatabase() error
func (*MySQLAdapter) CreateMigrationsTable ¶ added in v0.1.7
func (a *MySQLAdapter) CreateMigrationsTable(ctx context.Context) error
create migrations table with atlas
func (*MySQLAdapter) DropDatabase ¶ added in v0.1.7
func (a *MySQLAdapter) DropDatabase() error
func (*MySQLAdapter) GetAdapter ¶ added in v0.1.7
func (a *MySQLAdapter) GetAdapter() string
func (*MySQLAdapter) GetDBName ¶ added in v0.1.7
func (a *MySQLAdapter) GetDBName() string
func (*MySQLAdapter) Open ¶ added in v0.1.7
func (a *MySQLAdapter) Open() error
type PostgreSQLAdapter ¶
func NewPostgreSQLAdapter ¶
func NewPostgreSQLAdapter(config *schema.Config) *PostgreSQLAdapter
func (*PostgreSQLAdapter) CreateDatabase ¶
func (a *PostgreSQLAdapter) CreateDatabase() error
func (*PostgreSQLAdapter) CreateMigrationsTable ¶
func (a *PostgreSQLAdapter) CreateMigrationsTable(ctx context.Context) error
create migrations table with atlas
func (*PostgreSQLAdapter) DropDatabase ¶
func (a *PostgreSQLAdapter) DropDatabase() error
func (*PostgreSQLAdapter) GetAdapter ¶
func (a *PostgreSQLAdapter) GetAdapter() string
func (*PostgreSQLAdapter) GetDBName ¶
func (a *PostgreSQLAdapter) GetDBName() string
func (*PostgreSQLAdapter) Open ¶
func (a *PostgreSQLAdapter) Open() error
type SQLiteAdapter ¶
func NewSQLiteAdapter ¶
func NewSQLiteAdapter(config *schema.Config) *SQLiteAdapter
func (*SQLiteAdapter) CreateDatabase ¶
func (a *SQLiteAdapter) CreateDatabase() error
func (*SQLiteAdapter) CreateMigrationsTable ¶
func (a *SQLiteAdapter) CreateMigrationsTable(ctx context.Context) error
create migrations table with atlas
func (*SQLiteAdapter) DropDatabase ¶
func (a *SQLiteAdapter) DropDatabase() error
func (*SQLiteAdapter) GetAdapter ¶
func (a *SQLiteAdapter) GetAdapter() string
func (*SQLiteAdapter) GetDBName ¶
func (a *SQLiteAdapter) GetDBName() string
func (*SQLiteAdapter) Open ¶
func (a *SQLiteAdapter) Open() error
type UpMigrations ¶
type UpMigrations Migrations
func (UpMigrations) Len ¶
func (ms UpMigrations) Len() int
func (UpMigrations) Less ¶
func (ms UpMigrations) Less(i, j int) bool
func (UpMigrations) Swap ¶
func (ms UpMigrations) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.