Documentation
¶
Overview ¶
Package migration provides a Migrator that runs a set of migrations concurrently before allowing controller-runtime runnables to start. Use WrapManager to gate runnables behind migration completion: each runnable added via the wrapped manager will block until all migrations succeed, and will return an error without starting if any migration fails.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapManager ¶
WrapManager returns a manager.Manager that gates all runnables added via Add behind the given Migrator's completion. If the migration succeeds, the runnables start normally. If the migration fails, each runnable returns the migration error without starting. If the context is canceled before migration completes, each runnable exits with nil.
Types ¶
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator manages a set of migrations and runs them concurrently when Start is called. The Done channel is closed after all migrations complete (whether or not they succeed).
func NewMigrator ¶
func NewMigrator() *Migrator
NewMigrator creates a new Migrator with no registered migrations.
func (*Migrator) Add ¶
Add registers a migration. It returns an error if the Migrator has already been started.
func (*Migrator) Done ¶
func (m *Migrator) Done() <-chan struct{}
Done returns a channel that is closed once Start has finished running all migrations.