migration

package
v0.0.0-...-69c6403 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DB_TIMESTAMP_FORMAT = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	Create(name string) (string, error)
	Up() (string, error)
	Unlock() (string, error)
	Down() (string, error)
	Latest() (string, error)
}

func NewMigrationModule

func NewMigrationModule(settings stgs.Settings, pool lib.DB) Controller

type ControllerImpl

type ControllerImpl struct {
	Service Service
}

func (*ControllerImpl) Create

func (c *ControllerImpl) Create(name string) (string, error)

func (*ControllerImpl) Down

func (c *ControllerImpl) Down() (string, error)

func (*ControllerImpl) Latest

func (c *ControllerImpl) Latest() (string, error)

func (*ControllerImpl) Unlock

func (c *ControllerImpl) Unlock() (string, error)

func (*ControllerImpl) Up

func (c *ControllerImpl) Up() (string, error)

type Migration

type Migration struct {
	Name      string
	Path      string
	UpQuery   string
	DownQuery string
}

type MigrationModule

type MigrationModule interface {
	Controller() Controller
}

type MigrationModuleImpl

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

func (*MigrationModuleImpl) Controller

func (mod *MigrationModuleImpl) Controller() Controller

type MigrationRepository

type MigrationRepository interface {
	Create(name string) error
	List() ([]Migration, error)
	Read(key string) (Migration, error)
}

type MigrationRepositoryImpl

type MigrationRepositoryImpl struct {
	Disk     lib.Disk
	Settings settings.Settings
}

func (*MigrationRepositoryImpl) Create

func (r *MigrationRepositoryImpl) Create(name string) error

func (*MigrationRepositoryImpl) List

func (r *MigrationRepositoryImpl) List() ([]Migration, error)

func (*MigrationRepositoryImpl) Read

type P

type P map[string]any

type Reference

type Reference struct {
	ID    string
	Name  string
	Date  time.Time
	Order int
}

type ReferenceRepository

type ReferenceRepository interface {
	List() ([]Reference, error)
	Up(migration Migration) error
	Down(migration Migration) error
	Lock() error
	Unlock() error
	IsLocked() (bool, error)
	Prepare() error
	GetLast() (Reference, error)
}

type ReferenceRepositoryImpl

type ReferenceRepositoryImpl struct {
	DB       lib.DB
	Settings settings.Settings
}

func (*ReferenceRepositoryImpl) Down

func (*ReferenceRepositoryImpl) GetLast

func (r *ReferenceRepositoryImpl) GetLast() (Reference, error)

func (*ReferenceRepositoryImpl) IsLocked

func (r *ReferenceRepositoryImpl) IsLocked() (bool, error)

func (*ReferenceRepositoryImpl) List

func (r *ReferenceRepositoryImpl) List() ([]Reference, error)

func (*ReferenceRepositoryImpl) Lock

func (r *ReferenceRepositoryImpl) Lock() error

func (*ReferenceRepositoryImpl) Prepare

func (r *ReferenceRepositoryImpl) Prepare() error

func (*ReferenceRepositoryImpl) Unlock

func (r *ReferenceRepositoryImpl) Unlock() error

func (*ReferenceRepositoryImpl) Up

type Relation

type Relation struct {
	Migration Migration
	Reference Reference
}

type Service

type Service interface {
	Create(name string) error
	Up() (Migration, error)
	Unlock() error
	Down() (Migration, error)
	Latest() ([]Migration, error)
}

type ServiceImpl

type ServiceImpl struct {
	Migrations MigrationRepository
	References ReferenceRepository
}

func (*ServiceImpl) Create

func (s *ServiceImpl) Create(name string) error

func (*ServiceImpl) Down

func (s *ServiceImpl) Down() (Migration, error)

func (*ServiceImpl) Latest

func (s *ServiceImpl) Latest() ([]Migration, error)

func (*ServiceImpl) Unlock

func (s *ServiceImpl) Unlock() error

func (*ServiceImpl) Up

func (s *ServiceImpl) Up() (Migration, error)

Jump to

Keyboard shortcuts

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