Documentation ¶
Index ¶
- Constants
- func Exists(file string) bool
- func GetEnv() string
- func MigrationHandler(option MigrationOption, conn Executor, data string) error
- func ReadFile(file string, obj interface{}) ([]byte, error)
- func ReadFileLines(file string) ([]string, error)
- func WriteFile(file string, obj interface{}) error
- type AppConfig
- type CmdService
- func (service *CmdService) AddTag(name string, handler Handler) error
- func (service *CmdService) Execute(option MigrationOption, number int, mode ExecutorMode) (int, error)
- func (service *CmdService) Reconfigure(options ...CmdServiceOption)
- func (m *CmdService) Start() error
- func (m *CmdService) Stop() error
- type CmdServiceOption
- type Controller
- func (controller *Controller) CreateMigrationHandler(ctx echo.Context) error
- func (controller *Controller) DeleteMigrationHandler(ctx echo.Context) error
- func (controller *Controller) DeleteMigrationsHandler(ctx echo.Context) error
- func (controller *Controller) GetMigrationHandler(ctx echo.Context) error
- func (controller *Controller) GetMigrationsHandler(ctx echo.Context) error
- func (controller *Controller) RegisterRoutes(web manager.IWeb) error
- type CreateMigrationRequest
- type CustomMode
- type DBConfig
- type DeleteMigrationRequest
- type ErrorResponse
- type Executor
- type ExecutorDatabase
- type ExecutorMode
- type ExecutorRabbitMq
- type GetMigrationRequest
- type Handler
- type IStorageDB
- type Interactor
- func (interactor *Interactor) CreateMigration(newMigration *Migration) error
- func (interactor *Interactor) DeleteMigration(idMigration string) error
- func (interactor *Interactor) DeleteMigrations() error
- func (interactor *Interactor) ExecuteMigration(migration string) error
- func (interactor *Interactor) GetMigration(idMigration string) (*Migration, error)
- func (interactor *Interactor) GetMigrations(values map[string][]string) (ListMigration, error)
- type ListMigration
- type Migration
- type MigrationCommand
- type MigrationConfig
- type MigrationOption
- type StoragePostgres
- func (storage *StoragePostgres) CreateMigration(newMigration *Migration) error
- func (storage *StoragePostgres) DeleteMigration(idMigration string) error
- func (storage *StoragePostgres) DeleteMigrations() error
- func (storage *StoragePostgres) ExecuteMigration(migration string) error
- func (storage *StoragePostgres) GetMigration(idMigration string) (*Migration, error)
- func (storage *StoragePostgres) GetMigrations(values map[string][]string) (ListMigration, error)
- type Tag
- type WebService
- type WebServiceOption
Constants ¶
View Source
const ( CmdMigrate MigrationCommand = "migrate" CmdNumber MigrationCommand = "number" CmdMode MigrationCommand = "mode" OptionUp MigrationOption = "up" OptionDown MigrationOption = "down" FileTagMigrate Tag = "-- migrate %s" FileTagMigrateUp Tag = "-- migrate up" FileTagMigrateDown Tag = "-- migrate down" FileTagCustom Tag = "-- %s %s" FileTagCustomUp Tag = "-- %s up" FileTagCustomDown Tag = "-- %s down" )
View Source
const ( DefaultURL = "http://localhost:8001" CREATE_MIGRATION_TABLES = `` /* 469-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func MigrationHandler ¶
func MigrationHandler(option MigrationOption, conn Executor, data string) error
func ReadFileLines ¶
Types ¶
type AppConfig ¶
type AppConfig struct {
Migration *MigrationConfig `json:"migration"`
}
AppConfig ...
type CmdService ¶
type CmdService struct {
// contains filtered or unexported fields
}
func NewCmdService ¶
func NewCmdService(options ...CmdServiceOption) (*CmdService, error)
func (*CmdService) Execute ¶
func (service *CmdService) Execute(option MigrationOption, number int, mode ExecutorMode) (int, error)
execute ...
func (*CmdService) Reconfigure ¶
func (service *CmdService) Reconfigure(options ...CmdServiceOption)
Reconfigure ...
type CmdServiceOption ¶
type CmdServiceOption func(client *CmdService)
CmdServiceOption ...
func WithCmdConfiguration ¶
func WithCmdConfiguration(config *MigrationConfig) CmdServiceOption
WithCmdConfiguration ...
func WithCmdLogLevel ¶
func WithCmdLogLevel(level logger.Level) CmdServiceOption
WithCmdLogLevel ...
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(logger logger.ILogger, interactor *Interactor) *Controller
func (*Controller) CreateMigrationHandler ¶
func (controller *Controller) CreateMigrationHandler(ctx echo.Context) error
func (*Controller) DeleteMigrationHandler ¶
func (controller *Controller) DeleteMigrationHandler(ctx echo.Context) error
func (*Controller) DeleteMigrationsHandler ¶
func (controller *Controller) DeleteMigrationsHandler(ctx echo.Context) error
func (*Controller) GetMigrationHandler ¶
func (controller *Controller) GetMigrationHandler(ctx echo.Context) error
func (*Controller) GetMigrationsHandler ¶
func (controller *Controller) GetMigrationsHandler(ctx echo.Context) error
func (*Controller) RegisterRoutes ¶
func (controller *Controller) RegisterRoutes(web manager.IWeb) error
type CreateMigrationRequest ¶
type CreateMigrationRequest struct { Body struct { IdMigration string `json:"id_migration" validate:"nonzero"` } }
type CustomMode ¶
type CustomMode string
type DeleteMigrationRequest ¶
type DeleteMigrationRequest struct {
IdMigration string `json:"id_migration"`
}
type ErrorResponse ¶
type Executor ¶
type Executor interface { Open() error Begin() error Execute(arg interface{}, args ...interface{}) error Commit() error Rollback() error Close() error }
func NewExecutor ¶
func NewExecutor(service *CmdService, mode ExecutorMode) Executor
type ExecutorDatabase ¶
func NewExecutorDatabase ¶
func NewExecutorDatabase(service *CmdService) *ExecutorDatabase
func (*ExecutorDatabase) Begin ¶
func (e *ExecutorDatabase) Begin() (err error)
func (*ExecutorDatabase) Close ¶
func (e *ExecutorDatabase) Close() error
func (*ExecutorDatabase) Commit ¶
func (e *ExecutorDatabase) Commit() error
func (*ExecutorDatabase) Execute ¶
func (e *ExecutorDatabase) Execute(arg interface{}, args ...interface{}) error
func (*ExecutorDatabase) Open ¶
func (e *ExecutorDatabase) Open() (err error)
func (*ExecutorDatabase) Rollback ¶
func (e *ExecutorDatabase) Rollback() error
type ExecutorMode ¶
type ExecutorMode string
const ( ExecutorModeAll ExecutorMode = "all" ExecutorModeDatabase ExecutorMode = "database" ExecutorModeRabbitMq ExecutorMode = "rabbitmq" )
type ExecutorRabbitMq ¶
type ExecutorRabbitMq struct {
// contains filtered or unexported fields
}
func NewExecutorRabbitMq ¶
func NewExecutorRabbitMq(service *CmdService) *ExecutorRabbitMq
func (*ExecutorRabbitMq) Begin ¶
func (e *ExecutorRabbitMq) Begin() error
func (*ExecutorRabbitMq) Close ¶
func (e *ExecutorRabbitMq) Close() error
func (*ExecutorRabbitMq) Commit ¶
func (e *ExecutorRabbitMq) Commit() error
func (*ExecutorRabbitMq) Execute ¶
func (e *ExecutorRabbitMq) Execute(arg interface{}, args ...interface{}) error
func (*ExecutorRabbitMq) Open ¶
func (e *ExecutorRabbitMq) Open() (err error)
func (*ExecutorRabbitMq) Rollback ¶
func (e *ExecutorRabbitMq) Rollback() error
type GetMigrationRequest ¶
type GetMigrationRequest struct {
IdMigration string `json:"id_migration" validate:"nonzero"`
}
type IStorageDB ¶
type IStorageDB interface { GetMigration(idMigration string) (*Migration, error) GetMigrations(values map[string][]string) (ListMigration, error) CreateMigration(newMigration *Migration) error DeleteMigration(idMigration string) error DeleteMigrations() error ExecuteMigration(migration string) error }
type Interactor ¶
type Interactor struct {
// contains filtered or unexported fields
}
func NewInteractor ¶
func NewInteractor(logger logger.ILogger, storageDB IStorageDB) *Interactor
func (*Interactor) CreateMigration ¶
func (interactor *Interactor) CreateMigration(newMigration *Migration) error
func (*Interactor) DeleteMigration ¶
func (interactor *Interactor) DeleteMigration(idMigration string) error
func (*Interactor) DeleteMigrations ¶
func (interactor *Interactor) DeleteMigrations() error
func (*Interactor) ExecuteMigration ¶
func (interactor *Interactor) ExecuteMigration(migration string) error
func (*Interactor) GetMigration ¶
func (interactor *Interactor) GetMigration(idMigration string) (*Migration, error)
func (*Interactor) GetMigrations ¶
func (interactor *Interactor) GetMigrations(values map[string][]string) (ListMigration, error)
type ListMigration ¶
type ListMigration []*Migration
type Migration ¶
type Migration struct { IdMigration string `json:"id_migration"` Mode ExecutorMode `json:"mode"` User string `json:"user"` ExecutedAt time.Time `json:"executed_at"` }
type MigrationCommand ¶
type MigrationCommand string
type MigrationConfig ¶
type MigrationConfig struct { Host string `json:"host"` Path struct { Database string `json:"database"` Rabbitmq string `json:"rabbitmq"` } `json:"path"` Db *DBConfig `json:"db"` RabbitMq *struct { Host string `json:"host"` VHost *string `json:"vhost"` } `json:"rabbitmq"` Log struct { Level string `json:"level"` } `json:"log"` }
MigrationConfig ...
type MigrationOption ¶
type MigrationOption string
type StoragePostgres ¶
type StoragePostgres struct {
// contains filtered or unexported fields
}
func NewStoragePostgres ¶
func NewStoragePostgres(logger logger.ILogger, connection manager.IDB) *StoragePostgres
func (*StoragePostgres) CreateMigration ¶
func (storage *StoragePostgres) CreateMigration(newMigration *Migration) error
func (*StoragePostgres) DeleteMigration ¶
func (storage *StoragePostgres) DeleteMigration(idMigration string) error
func (*StoragePostgres) DeleteMigrations ¶
func (storage *StoragePostgres) DeleteMigrations() error
func (*StoragePostgres) ExecuteMigration ¶
func (storage *StoragePostgres) ExecuteMigration(migration string) error
func (*StoragePostgres) GetMigration ¶
func (storage *StoragePostgres) GetMigration(idMigration string) (*Migration, error)
func (*StoragePostgres) GetMigrations ¶
func (storage *StoragePostgres) GetMigrations(values map[string][]string) (ListMigration, error)
type WebService ¶
type WebService struct {
// contains filtered or unexported fields
}
func NewWebService ¶
func NewWebService(options ...WebServiceOption) (*WebService, error)
NewWebService ...
func (*WebService) Reconfigure ¶
func (service *WebService) Reconfigure(options ...WebServiceOption)
Reconfigure ...
type WebServiceOption ¶
type WebServiceOption func(client *WebService)
WebServiceOption ...
func WithWebConfiguration ¶
func WithWebConfiguration(config *MigrationConfig) WebServiceOption
WithWebConfiguration ...
Source Files ¶
Click to show internal directories.
Click to hide internal directories.