action

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFileName = errors.New("the migration name should contain letters, digits, underscore and/or backslash characters only")
)

Functions

This section is empty.

Types

type Console

type Console interface {
	Confirm(s string) bool
	Info(message string)
	InfoLn(message string)
	Infof(message string, a ...any)
	Success(message string)
	SuccessLn(message string)
	Successf(message string, a ...any)
	Warn(message string)
	WarnLn(message string)
	Warnf(message string, a ...any)
	Error(message string)
	ErrorLn(message string)
	Errorf(message string, a ...any)
	Fatal(err error)
	NumberPlural(count int, one, many string) string
}

type Create

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

func NewCreate

func NewCreate(
	time timex.Time,
	file File,
	console Console,
	fileNameBuilder FileNameBuilder,
	migrationDir string,
) *Create

func (*Create) Run

func (c *Create) Run(_ context.Context, cmdArgs ...string) error

type Downgrade

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

func NewDowngrade

func NewDowngrade(
	service MigrationService,
	fileNameBuilder FileNameBuilder,
	interactive bool,
) *Downgrade

func (*Downgrade) Run

func (d *Downgrade) Run(ctx context.Context, cmdArgs ...string) error

type File

type File interface {
	Create(filename string) error
	Exists(path string) (bool, error)
}

type FileNameBuilder

type FileNameBuilder interface {
	// Up builds a file name for migration update
	Up(version string, forceSafely bool) (fname string, safely bool)
	// Down builds a file name for migration downgrade
	Down(version string, forceSafely bool) (fname string, safely bool)
}

type History

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

func NewHistory

func NewHistory(
	service MigrationService,
) *History

func (*History) Run

func (h *History) Run(ctx context.Context, cmdArgs ...string) error

type HistoryNew

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

func NewHistoryNew

func NewHistoryNew(
	service MigrationService,
) *HistoryNew

func (*HistoryNew) Run

func (h *HistoryNew) Run(ctx context.Context, cmdArgs ...string) error

type MigrationService

type MigrationService interface {
	// Migrations returns an entities of migrations
	Migrations(ctx context.Context, limit int) (entity.Migrations, error)
	// NewMigrations returns an entities of new migrations
	//todo: domain.Migrations
	NewMigrations(ctx context.Context) (entity.Migrations, error)
	// ApplyFile applies new migration
	//todo: domain.Migration
	ApplyFile(ctx context.Context, entity *entity.Migration, fileName string, safely bool) error
	// RevertFile reverts the migration
	RevertFile(ctx context.Context, entity *entity.Migration, fileName string, safely bool) error
}

type Redo

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

func NewRedo

func NewRedo(
	service MigrationService,
	fileNameBuilder FileNameBuilder,
	interactive bool,
) *Redo

func (*Redo) Run

func (r *Redo) Run(ctx context.Context, cmdArgs ...string) error

type To

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

func NewTo

func NewTo(
	service MigrationService,
	fileNameBuilder FileNameBuilder,
	interactive bool,
) *To

func (*To) Run

func (t *To) Run(_ context.Context, _ ...string) error

type Upgrade

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

func NewUpgrade

func NewUpgrade(
	console Console,
	service MigrationService,
	fileNameBuilder FileNameBuilder,
	interactive bool,
) *Upgrade

func (*Upgrade) Run

func (u *Upgrade) Run(ctx context.Context, cmdArgs ...string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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