Documentation
¶
Index ¶
- Variables
- type Migration
- type Migrations
- type Migrator
- func (m *Migrator) CanonicalScope() string
- func (m *Migrator) Migrate() (err error)
- func (m *Migrator) NewMigration(models ...PsqlModel) (Migrations, error)
- func (m *Migrator) Rollback() (err error)
- func (m *Migrator) SetConnection(dbConn db.DB)
- func (m *Migrator) SetLogger(logger logger.Logger)
- func (m *Migrator) SetMigrations(migrations interface{}) error
- func (m *Migrator) Versions() (migrated, unmigrated []int)
- type PsqlModel
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMigrationsBadType = errors.New("migrations must be slice of struct")
)
Functions ¶
This section is empty.
Types ¶
type Migrations ¶ added in v1.3.0
type Migrations []Migration
type Migrator ¶
type Migrator struct {
Scope string
DB db.DB
Logger logger.Logger
// contains filtered or unexported fields
}
func NewMigrator ¶ added in v1.3.0
func (*Migrator) CanonicalScope ¶
CanonicalScope returns valid scope name.
func (*Migrator) Migrate ¶
Migrate executes the up SQL for all the migrations that have not yet been run.
func (*Migrator) NewMigration ¶ added in v1.3.0
func (m *Migrator) NewMigration(models ...PsqlModel) (Migrations, error)
NewMigration generates migration file based on the differences between schemas in the database and psql models.
func (*Migrator) SetConnection ¶ added in v1.3.0
func (*Migrator) SetMigrations ¶
SetMigrations imports migrations.
Click to show internal directories.
Click to hide internal directories.