gappmigration

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 5 Imported by: 0

README

gapp-migration

Documentation

Index

Constants

View Source
const (
	// ContainerID defines the id to be used as the container
	// registration id of a migrator instance, and as a base id of all
	// other migration package instances registered in the application
	// container.
	ContainerID = gapp.ContainerID + ".migrator"

	// ContainerDaoID defines the id to be used as the container
	// registration id of the migrator DAO.
	ContainerDaoID = ContainerID + ".dao"

	// ContainerMigrationTag defines the default tag to be used
	// to identify a migration entry in the container.
	ContainerMigrationTag = ContainerID + ".migration"
)

Variables

View Source
var (
	// ErrNilPointer defines a nil pointer argument error
	ErrNilPointer = gapp.ErrNilPointer

	// ErrConversion defines a type conversion error
	ErrConversion = gapp.ErrConversion
)
View Source
var (
	// Database defines the default migration manager rdb name.
	Database = genv.String("GAPP_MIGRATOR_DATABASE", "primary")

	// AutoMigrate defines the flag that will be used to enable
	// the auto migration on application boot.
	AutoMigrate = genv.Bool("GAPP_MIGRATOR_AUTO_MIGRATE", true)
)

Functions

func GetDao

GetDao will try to retrieve a new migration DAO instances from the application service container.

func GetMigrations

func GetMigrations(c gapp.ServiceContainer) ([]gmigration.Migration, error)

GetMigrations will try to retrieve the registered the list of migration instances from the application service container.

func GetMigrator

func GetMigrator(c gapp.ServiceContainer) (*gmigration.Migrator, error)

GetMigrator will try to retrieve a new migrator instance from the application service container.

Types

type Provider

type Provider struct{}

Provider defines the gapp/migration module service provider to be used on the application initialization to register the migrations service.

func (Provider) Boot

func (p Provider) Boot(c gapp.ServiceContainer) error

Boot will start the migration package If the auto migration is defined as true, ether by global variable or by environment variable, the migrator will automatically try to migrate to the last registered migration

func (Provider) Register

func (p Provider) Register(c gapp.ServiceContainer) error

Register will register the migration package instances in the application container

Jump to

Keyboard shortcuts

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