Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBConnection ¶
type DBConnection interface { Begin(ctx context.Context) (pgx.Tx, error) Close(ctx context.Context) error Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) }
DBConnection wrapper interface for interactions with db
func BuildConnector ¶
func BuildConnector(ctx context.Context, str string) (conn DBConnection, err error)
type ExecutionContext ¶
type ImplModels ¶
type ImplModels struct {
Db DBConnection
}
ImplModels implementation of models interface with underlying database
func (*ImplModels) CreateMetaTable ¶
func (models *ImplModels) CreateMetaTable() error
CreateMetaTable creates table named __pg_mig_meta that will be used for storing migration info
func (*ImplModels) Execute ¶
func (models *ImplModels) Execute(executionContext ExecutionContext) error
Execute runs a migration within a transaction and updates meta table
func (*ImplModels) GetMigrationsList ¶
func (models *ImplModels) GetMigrationsList() ([]int64, error)
GetMigrationsList - fetches timestamps of migrations that has been executed in current DB
func (*ImplModels) SquashMigrations ¶
SquashMigrations deletes all migration instances in meta table between given timestamps (both inclusive). and writes a new squash migration with timestamp set to `to` variable value
Click to show internal directories.
Click to hide internal directories.