dbmigrator

package
v0.0.0-...-970f38b Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Dialect string = "postgres"

Dialect of supported database management system

View Source
const (
	// MainFileName const
	MainFileName = "main.go"
)

Variables

This section is empty.

Functions

func Add

func Add(i api.Migration)

Add method adds a migration to the DBMigrator

func Create

func Create(p api.MigrationCreateParams) (err error)

Create new migration file

func DBVersion

func DBVersion() (uint, error)

DBVersion returns ID of last applied migration

func Down

func Down(quantity int) (err error)

Down migration

func Init

func Init(ctx context.Context, config api.Configuration, logger api.Logger) error

Init initialises DBMigrator instance

func InitTool

func InitTool(ctx context.Context, config api.Configuration, logger api.Logger) (err error)

InitTool is the func for initialisation DBMigrator as a tool

func Redo

func Redo() (err error)

Redo a one last migration

func Status

func Status() ([]migration.Log, error)

Status returns slice of logs of migrations

func Up

func Up(quantity int) (err error)

Up migration

Types

type DBMigrator

type DBMigrator struct {
	// contains filtered or unexported fields
}

DBMigrator struct

func NewDBMigrator

func NewDBMigrator(ctx context.Context, config api.Configuration, logger api.Logger, repository migration.IRepository, ms migration.MigrationsList) (*DBMigrator, error)

NewDBMigrator returns a new instance of DBMigrator

func (*DBMigrator) Create

func (m *DBMigrator) Create(p api.MigrationCreateParams) (err error)

Create new migration file

func (*DBMigrator) DBVersion

func (m *DBMigrator) DBVersion() (uint, error)

DBVersion returns ID of last applied migration

func (*DBMigrator) Down

func (m *DBMigrator) Down(quantity int) (err error)

Down migration

func (*DBMigrator) Redo

func (m *DBMigrator) Redo() (err error)

Redo a one last migration

func (*DBMigrator) Status

func (m *DBMigrator) Status() ([]migration.Log, error)

Status returns slice of logs of migrations

func (*DBMigrator) Up

func (m *DBMigrator) Up(quantity int) (err error)

Up migration

type DBMigratorTool

type DBMigratorTool struct {
	*DBMigrator
}

DBMigratorTool is DBMigrator as a tool nolint

func NewDBMigratorTool

func NewDBMigratorTool(m *DBMigrator) (*DBMigratorTool, error)

NewDBMigratorTool returns new DBMigratorTool

func (*DBMigratorTool) Create

func (m *DBMigratorTool) Create(p api.MigrationCreateParams) (err error)

Create a migration

func (*DBMigratorTool) Down

func (m *DBMigratorTool) Down(quantity int) (err error)

Down migrations

func (*DBMigratorTool) Exec

func (m *DBMigratorTool) Exec(action string) (err error)

Exec migrations

func (*DBMigratorTool) Redo

func (m *DBMigratorTool) Redo() (err error)

Redo a one last migration

func (*DBMigratorTool) Up

func (m *DBMigratorTool) Up(quantity int) (err error)

Up migrations

type Domain

type Domain struct {
	Migration struct {
		Repository migration.IRepository
		Service    migration.IService
	}
}

Domain is a Domain Layer Entry Point

type IDBMigrator

type IDBMigrator interface {
	Up(quantity int) (err error)
	Down(quantity int) (err error)
	Redo() (err error)
	Status() ([]migration.Log, error)
	DBVersion() (uint, error)
	Create(p api.MigrationCreateParams) (err error)
}

IDBMigrator is the interface for DBMigrator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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