Documentation
¶
Index ¶
- func MigrateUp(db *sql.DB) error
- type DbApi
- func (api *DbApi) Acquire() (*pgxpool.Conn, error)
- func (api *DbApi) CreateDb(params *CreateDbParams, q *Queries) (*Db, error)
- func (api *DbApi) CreateDbTask(params *CreateDbTaskParams, q *Queries) (*DbTask, error)
- func (api *DbApi) GetDb(dbId int64, q *Queries) (*Db, error)
- func (api *DbApi) GetDbByName(name string, q *Queries) (*Db, error)
- func (api *DbApi) ListDbs(q *Queries) ([]Db, error)
- func (api *DbApi) MigrateDB(quitCtx context.Context) error
- func (api *DbApi) NotifyDbStatusChanged(db *Db)
- func (api *DbApi) Query(queryFunc QueryFunc) error
- func (api *DbApi) QueryWithRollback(queryFunc QueryWithRollbackFunc) error
- func (api *DbApi) ToProtoDatabases(dbs []Db) []*proto.Database
- func (api *DbApi) UpdateDbStatus(db *Db, q *Queries) error
- func (api *DbApi) UpdateTaskStatus(task *DbTask, q *Queries) error
- type DbTaskData
- type QueryFunc
- type QueryWithRollbackFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DbApi ¶
type DbApi struct { DbConfig *config.DbConfig DbPool *pgxpool.Pool ConnCtx context.Context Cancel context.CancelFunc DbStatusNotifier server.Producer }
func (*DbApi) CreateDbTask ¶
func (*DbApi) GetDbByName ¶
func (*DbApi) NotifyDbStatusChanged ¶
func (api *DbApi) NotifyDbStatusChanged(db *Db)
func (*DbApi) QueryWithRollback ¶
func (api *DbApi) QueryWithRollback(queryFunc QueryWithRollbackFunc) error
func (*DbApi) ToProtoDatabases ¶
func (*DbApi) UpdateDbStatus ¶
func (*DbApi) UpdateTaskStatus ¶
type DbTaskData ¶
type DbTaskData struct { // This task depends on other tasks // Valid in all tasks DependsOn []uuid.UUID `json:"depends_on"` // When the task is failed or canceled, // this field contains the reason of the failure // Valid in all tasks ErrReason string `json:"err_reason"` // The pg instance to run backup task BackupFrom string `json:"backup_from"` // The backup path of the database, in format of `pg-<major>/<database name>/<timestamp>.sql` // e.g. `pg-12/mydb/2021-01-01T01:01:01.sql` // // This path is relative to DbConfig.BackupRootPath // // Valid in following tasks: // - backup // - remote-backup // - restore BackupPath string `json:"backup_path"` Owner string `json:"owner"` // Do not save password to database Password string `json:"-"` }
type QueryWithRollbackFunc ¶
type QueryWithRollbackFunc func(pgx.Tx) error
Click to show internal directories.
Click to hide internal directories.