Documentation ¶
Index ¶
- Variables
- type Config
- type Core
- func (c *Core) DownTo(ctx context.Context, versionTo uint, migrates ...Migrate) error
- func (c *Core) Migrate(ctx context.Context, dir string, cfg Config) error
- func (c *Core) NewMigrate(_ context.Context, dir, name string) error
- func (c *Core) Reset(ctx context.Context, migrates ...Migrate) error
- func (c *Core) Up(ctx context.Context, migrates ...Migrate) error
- func (c *Core) UpTo(ctx context.Context, versionTo uint, migrates ...Migrate) error
- type FS
- type Migrate
- type MigrateCmd
- type Query
- type Repo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicateVersion = errors.New("duplicate version") ErrNotCorrectVersion = errors.New("version must be above 0") ErrNotSetUp = errors.New("not set up function") ErrNotSetDown = errors.New("not set down function") )
Errors.
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core contains business logic for migrate database.
func (*Core) NewMigrate ¶
NewMigrate create and save new migrate file.
type FS ¶ added in v0.8.0
type FS interface { fs.FS // Walk for walks on dir. Walk(string, func(string, fs.FileInfo) error) error // Mkdir make new dir if doesn't exist dir name. Mkdir(path string) error // SaveFile save new file. SaveFile(path string, buf []byte) error }
FS manages file system.
type MigrateCmd ¶
type MigrateCmd uint8
MigrateCmd migration command.
const ( Up MigrateCmd = iota + 1 // up UpTo // up-to DownTo // down-to Reset // reset )
Migration enum.
func (MigrateCmd) String ¶
func (i MigrateCmd) String() string
type Repo ¶ added in v0.8.0
type Repo interface { // Up makes migrate to database. Up(context.Context, Migrate) error // Rollback one migrate. Rollback(context.Context, Migrate) error // Version returns current migrate version from database. Version(context.Context) (uint, error) }
Repo provides to database.
Click to show internal directories.
Click to hide internal directories.