core

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package core contains business logic application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Cmd MigrateCmd
	To  uint
}

Config migration configuration.

type Core

type Core interface {
	Migrate(ctx context.Context, dir string, cfg Config) error
	NewMigrate(_ context.Context, dir, name string) error
}

Core manages the business logic of the application.

func New

func New(fs Fs, m Migrater) Core

New create new instance application.

type Fs

type Fs interface {
	Walk(dir string) ([]Migrate, error)
	CreateMigrate(dir, name string, m Migrate) error
}

Fs manages information from disk.

type Migrate

type Migrate struct {
	Version uint
	Query   Query
}

Migrate contains migrate information.

type MigrateCmd

type MigrateCmd uint8

MigrateCmd migration command.

const (
	Up     MigrateCmd = iota + 1 // up
	UpOne                        // up-one
	UpTo                         // up-to
	Down                         // down
	DownTo                       // down-to
	Reset                        // reset
)

Migration command.

func (MigrateCmd) String

func (i MigrateCmd) String() string

type Migrater

type Migrater interface {
	Migrate(ctx context.Context, cfg Config, m []Migrate) error
}

Migrater manage migrate logic.

type Query

type Query struct {
	Up   string
	Down string
}

Query contains `up` and `down` query.

Jump to

Keyboard shortcuts

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