Help us shape the future of Go! Take the 2026 Go Developer Survey

lifecycle

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package lifecycle adapts Goose providers to startup policy and native commands. Callers own database modules and supply fresh, late-bound providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commands

func Commands(config lifecycle.Config, modules []lifecycle.Module, provider func(context.Context) (*goose.Provider, error)) *urfavecli.Command

Commands returns a fresh native migrate group using exactly modules, with services suppressed. Supply database modules only, excluding startup policy. Resolvers run after setup. Help/usage starts nothing; Action owns signals and reverse cleanup. Use fresh trees and bindings for independent invocations. Status may initialize the version table; it does not run migration bodies.

func Module

func Module(name string, policy Policy, provider func(context.Context) (*goose.Provider, error)) (lifecycle.Module, error)

Module declares startup migration work without resolving provider yet. Register it after the database module and before dependent modules. The resolver must return fresh registrations and clean up any partial acquisition. Teardown never closes the provider: the database module owns its database.

Types

type Policy

type Policy string

Policy selects migration behavior during module setup.

const (
	// Apply runs pending migrations before later modules start.
	Apply Policy = "apply"
	// Require fails setup when migrations are pending. This is a point-in-time
	// check, not a deployment lock; Goose may initialize its version table.
	Require Policy = "require"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL