Documentation
¶
Index ¶
- Constants
- Variables
- func Cfg() *config.Config
- func CreateCommand() *capp.Cmd
- func DB() *database.DB
- func DownCommand() *capp.Cmd
- func HandleCreate(names []string) error
- func HandleDown(opt DownOption) error
- func HandleExec(opt ExecOption) error
- func HandleInit(opt InitOption) error
- func HandleShow(opt ShowOption) error
- func HandleSkip(opt SkipOption) error
- func HandleStatus(_ StatusOption) error
- func HandleUp(opt UpOption) error
- func InitCommand() *capp.Cmd
- func NewApp(name, version, description string) *capp.App
- func NewExecCommand() *capp.Cmd
- func NewShowCommand() *capp.Cmd
- func NewUpCommand() *capp.Cmd
- func SetBuildInfo(version, goVer, buildTime, gitCommit string)
- func SetCfg(c *config.Config)
- func SetDB(d *database.DB)
- func SkipCommand() *capp.Cmd
- func StatusCommand() *capp.Cmd
- type DownOption
- type ExecOption
- type InitOption
- type ShowOption
- type SkipOption
- type StatusOption
- type UpOption
Constants ¶
View Source
const TimeLayout = "2006-01-02 15:04:05"
Variables ¶
View Source
var ( // Version represents the version of the application Version = "0.1.0" BuildTime = "2025-11-05T09:00:00Z" GitCommit = "ab3cd4ef" GoVersion = "1.21" )
View Source
var ( // ShowVerbose flag ShowVerbose bool // ConfigFile path to the configuration file ConfigFile string )
View Source
var OnConfigLoaded = func(cfg *config.Config) error { return nil }
OnConfigLoaded hook. you can modify or validate the configuration here.
Functions ¶
func DownCommand ¶
DownCommand rolls back the last migration or a specific one
func HandleSkip ¶
func HandleSkip(opt SkipOption) error
HandleSkip skips one or multi migration file(s)
func NewExecCommand ¶
NewExecCommand executes SQL statement or SQL file directly
func NewShowCommand ¶
NewShowCommand shows database information like tables or table schema
func SetBuildInfo ¶ added in v0.2.0
func SetBuildInfo(version, goVer, buildTime, gitCommit string)
SetBuildInfo initializes the version, build time, and git commit
Types ¶
type DownOption ¶
DownOption represents the options for the down command
type ExecOption ¶
type ExecOption struct {
// SQL or sql-file to execute
SQLOrFile string
// Skip confirmation prompt
Yes bool
}
ExecOption represents options for the exec command
type InitOption ¶
type InitOption struct {
Drop bool
}
type ShowOption ¶
type ShowOption struct {
// Show database tables
Tables bool
// Show one table schema
Schema string
}
ShowOption represents options for the show command
type SkipOption ¶
type SkipOption struct {
FileNames []string
}
SkipOption skip migration file option
Click to show internal directories.
Click to hide internal directories.