Documentation ¶
Overview ¶
Package handler includes handling migration executions related logic, and it can be used by client code that acts as user entrypoint (for example CLI entrypoint).
Index ¶
- type ExecutedMigration
- type ExecutionPlan
- func (plan *ExecutionPlan) AllExecuted() []ExecutedMigration
- func (plan *ExecutionPlan) AllToBeExecuted() []migration.Migration
- func (plan *ExecutionPlan) FinishedExecutionsCount() int
- func (plan *ExecutionPlan) LastExecuted() ExecutedMigration
- func (plan *ExecutionPlan) NextToExecute() migration.Migration
- func (plan *ExecutionPlan) RegisteredMigrationsCount() int
- type ExecutionPlanBuilder
- type MigrationsHandler
- func (handler *MigrationsHandler) ForceDown(version uint64) (ExecutedMigration, error)
- func (handler *MigrationsHandler) ForceUp(version uint64) (ExecutedMigration, error)
- func (handler *MigrationsHandler) MigrateDown(numOfRuns NumOfRuns) ([]ExecutedMigration, error)
- func (handler *MigrationsHandler) MigrateUp(numOfRuns NumOfRuns) ([]ExecutedMigration, error)
- type NumOfRuns
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutedMigration ¶
type ExecutedMigration struct { Migration migration.Migration Execution *execution.MigrationExecution }
ExecutedMigration Value object that groups information related to a migration execution
type ExecutionPlan ¶
type ExecutionPlan struct {
// contains filtered or unexported fields
}
ExecutionPlan Entity which decides what can be migrated. Helpful for seeing the current migrations & executions state
func NewPlan ¶
func NewPlan( registry migration.MigrationsRegistry, repository execution.Repository, ) (*ExecutionPlan, error)
NewPlan Creates a new ExecutionPlan. Errors if it finds that migrations and executions loaded from the provided registry & repository are in an inconsistent state. An inconsistent state can be: more executions in the repository than the total number of registered migrations
func (*ExecutionPlan) AllExecuted ¶
func (plan *ExecutionPlan) AllExecuted() []ExecutedMigration
func (*ExecutionPlan) AllToBeExecuted ¶
func (plan *ExecutionPlan) AllToBeExecuted() []migration.Migration
func (*ExecutionPlan) FinishedExecutionsCount ¶
func (plan *ExecutionPlan) FinishedExecutionsCount() int
func (*ExecutionPlan) LastExecuted ¶
func (plan *ExecutionPlan) LastExecuted() ExecutedMigration
func (*ExecutionPlan) NextToExecute ¶
func (plan *ExecutionPlan) NextToExecute() migration.Migration
func (*ExecutionPlan) RegisteredMigrationsCount ¶
func (plan *ExecutionPlan) RegisteredMigrationsCount() int
type ExecutionPlanBuilder ¶
type ExecutionPlanBuilder func( registry migration.MigrationsRegistry, repository execution.Repository, ) (*ExecutionPlan, error)
type MigrationsHandler ¶
type MigrationsHandler struct {
// contains filtered or unexported fields
}
MigrationsHandler A service which handles all migration related requests. Core service which should include all behaviour related to running the migrations
func NewHandler ¶
func NewHandler( registry migration.MigrationsRegistry, repository execution.Repository, newExecutionPlan ExecutionPlanBuilder, ) (*MigrationsHandler, error)
func (*MigrationsHandler) ForceDown ¶
func (handler *MigrationsHandler) ForceDown(version uint64) (ExecutedMigration, error)
func (*MigrationsHandler) ForceUp ¶
func (handler *MigrationsHandler) ForceUp(version uint64) (ExecutedMigration, error)
func (*MigrationsHandler) MigrateDown ¶
func (handler *MigrationsHandler) MigrateDown(numOfRuns NumOfRuns) ([]ExecutedMigration, error)
func (*MigrationsHandler) MigrateUp ¶
func (handler *MigrationsHandler) MigrateUp(numOfRuns NumOfRuns) ([]ExecutedMigration, error)