Documentation ¶
Index ¶
- Constants
- func Formatter(pattern string, args ...any)
- func MigrationCommand(driver Migration, autExec ...string) *cobra.Command
- func NewMigrationFile(root, name, ext string, stages ...string) error
- type FS
- type File
- func (file File) Content() string
- func (file File) DownScripts(stage string) (string, error)
- func (file File) Extension() string
- func (file File) HumanizedName() string
- func (file File) Is(name string) bool
- func (file File) Name() string
- func (file File) Timestamp() int64
- func (file File) UpScripts(stage string) (string, error)
- type Migrated
- type Migration
- type Summary
Constants ¶
const ( RESET = "\033[0m" BOLD = "\033[1m" UNDERLINE = "\033[4m" STRIKE = "\033[9m" ITALIC = "\033[3m" )
const ( RED = "\033[31m" GREEN = "\033[32m" YELLOW = "\033[33m" BLUE = "\033[34m" PURPLE = "\033[35m" CYAN = "\033[36m" GRAY = "\033[37m" WHITE = "\033[37m" )
Variables ¶
This section is empty.
Functions ¶
func Formatter ¶ added in v2.2.4
styling patterns
{R}: RESET, {B}: BOLD ,{U}: UNDERLINE ,{S}: STRIKE {I}: ITALIC ,{r}: RED ,{g}: GREEN ,{y}: YELLOW
{b}: BLUE ,{p}: PURPLE ,{c}: CYAN ,{m}: GRAY {w}: WHITE
func MigrationCommand ¶
MigrationCommand migration cli commands
func NewMigrationFile ¶ added in v2.6.0
NewMigrationFile generate new migration file
Types ¶
type FS ¶ added in v2.6.0
type FS []File
FS migration file system
func NewEmbedFS ¶ added in v2.6.0
NewEmbedFS generate new migration filesystem from embedded files
func (FS) ExcludeMigrated ¶ added in v2.6.0
ExcludeMigrated exclude files from file system
func (FS) FilterMigrated ¶ added in v2.6.0
FilterMigrated exclude files from file system
type File ¶ added in v2.5.0
type File struct {
// contains filtered or unexported fields
}
File migration file
func (File) DownScripts ¶ added in v2.6.0
DownScripts get down section scripts
func (File) HumanizedName ¶ added in v2.6.0
HumanizedName get file readable name withut timestamp and extension
type Migration ¶ added in v2.5.0
type Migration interface { // Root Get Root directory Root() string // Extension Get file extension Extension() string // Path get full path of file Path(name string) string // Init initialize database migration Init() error // Summary get migration summery Summary() (Summary, error) // StageSummary get migration summery for stage StageSummary(stage string) (Summary, error) // Up run migration stage // // pass only to run migrate on certain files only Up(stage string, only ...string) ([]string, error) // Down rollback migration stage // // pass only to run rollback on certain files only Down(stage string, only ...string) ([]string, error) }
func NewDirMigration ¶ added in v2.6.0
NewDirMigration create new migration instance from physical dir files
func NewEmbedMigration ¶ added in v2.6.0
NewEmbedMigration create new migration instance from embedded files
type Summary ¶ added in v2.6.0
type Summary []Migrated
func (Summary) GroupByFile ¶ added in v2.6.0
GroupByFile group migrated files by file name
func (Summary) GroupByStage ¶ added in v2.6.0
GroupByStage group migrated files by stage