Documentation ¶
Index ¶
- Variables
- func ApplyMigrations(dir migrate.MigrationDirection, dryrun bool, limit int) error
- func DB() *sql.DB
- func DBMap(db *sql.DB) *gorp.DbMap
- func Init() (*sql.DB, error)
- func InitSchemas(sqlDB *sql.DB, sqlfile string) error
- func Set(d *sql.DB)
- func Status() string
- type Executer
- type MigrationLock
- type PipelineScheduler
- type PipelineSchedulerExecution
- type Querier
- type QueryExecuter
- type Scanner
- type TemplateExtension
- type WorkerModel
Constants ¶
This section is empty.
Variables ¶
var DBCmd = &cobra.Command{
Use: "database",
Short: "Manage CDS database",
Long: "Manage CDS database",
}
DBCmd is the root command for database management
Functions ¶
func ApplyMigrations ¶
ApplyMigrations applies migration (or not depending on dryrun flag)
func Init ¶
Init initialize sql.DB object by checking environment variables and connecting to database
func InitSchemas ¶
InitSchemas checks that all tables are correct, and create them if not
Types ¶
type MigrationLock ¶
type MigrationLock struct { Id string `db:"id"` Locked *time.Time `db:"locked"` Unlocked *time.Time `db:"unlocked"` }
MigrationLock is used to lock the migration (managed by gorp)
type PipelineScheduler ¶
type PipelineScheduler sdk.PipelineScheduler
PipelineScheduler is a gorp wrapper around sdk.PipelineScheduler
func (*PipelineScheduler) PostGet ¶
func (p *PipelineScheduler) PostGet(s gorp.SqlExecutor) error
PostGet is a DB Hook to get all data from DB
func (*PipelineScheduler) PostInsert ¶
func (p *PipelineScheduler) PostInsert(s gorp.SqlExecutor) error
PostInsert is a DB Hook on PipelineScheduler to store params as JSON in DB
func (*PipelineScheduler) PostUpdate ¶
func (p *PipelineScheduler) PostUpdate(s gorp.SqlExecutor) error
PostUpdate is a DB Hook on PipelineScheduler to store params as JSON in DB
func (*PipelineScheduler) PreDelete ¶
func (p *PipelineScheduler) PreDelete(s gorp.SqlExecutor) error
PreDelete is a DB Hook on PipelineScheduler to store params as JSON in DB
type PipelineSchedulerExecution ¶
type PipelineSchedulerExecution sdk.PipelineSchedulerExecution
PipelineSchedulerExecution is a gorp wrapper around sdk.PipelineSchedulerExecution
type Querier ¶
type Querier interface { Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row }
Querier executes query in database
type QueryExecuter ¶
type QueryExecuter interface { Exec(query string, args ...interface{}) (sql.Result, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row }
QueryExecuter executes and queries SQL query
type Scanner ¶
type Scanner interface {
Scan(dest ...interface{}) error
}
Scanner is implemented by sql.Row and sql.Rows
type TemplateExtension ¶
type TemplateExtension sdk.TemplateExtension
TemplateExtension is a gorp wrapper around sdk.TemplateExtension
func (*TemplateExtension) PostInsert ¶
func (t *TemplateExtension) PostInsert(s gorp.SqlExecutor) error
PostInsert is a DB Hook on TemplateExtension to store params as JSON in DB
func (*TemplateExtension) PostUpdate ¶
func (t *TemplateExtension) PostUpdate(s gorp.SqlExecutor) error
PostUpdate is a DB Hook on TemplateExtension to store params as JSON in DB
func (*TemplateExtension) PreDelete ¶
func (t *TemplateExtension) PreDelete(s gorp.SqlExecutor) error
PreDelete is a DB Hook on TemplateExtension to store params as JSON in DB
type WorkerModel ¶
WorkerModel is a gorp wrapper around sdk.Model
func (*WorkerModel) PostInsert ¶
func (m *WorkerModel) PostInsert(s gorp.SqlExecutor) error
PostInsert is a DB Hook on WorkerModel
func (*WorkerModel) PostSelect ¶
func (m *WorkerModel) PostSelect(s gorp.SqlExecutor) error
PostSelect load capabilitites and createdBy user
func (*WorkerModel) PostUpdate ¶
func (m *WorkerModel) PostUpdate(s gorp.SqlExecutor) error
PostUpdate is a DB Hook on WorkerModel
func (*WorkerModel) PreDelete ¶
func (m *WorkerModel) PreDelete(s gorp.SqlExecutor) error
PreDelete is a DB Hook on WorkerModel