database

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func ApplyMigrations(dir migrate.MigrationDirection, dryrun bool, limit int) error

ApplyMigrations applies migration (or not depending on dryrun flag)

func DB

func DB() *sql.DB

DB returns the current sql.DB object

func DBMap

func DBMap(db *sql.DB) *gorp.DbMap

DBMap returns a propor intialized gorp.DBMap pointer

func Init

func Init() (*sql.DB, error)

Init initialize sql.DB object by checking environment variables and connecting to database

func InitSchemas

func InitSchemas(sqlDB *sql.DB, sqlfile string) error

InitSchemas checks that all tables are correct, and create them if not

func Set

func Set(d *sql.DB)

Set is for tetsing purpose, we need to set manually the connection

func Status

func Status() string

Status returns database driver and status in a printable string

Types

type Executer

type Executer interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
}

Executer executes SQL query

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

type WorkerModel sdk.Model

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

Jump to

Keyboard shortcuts

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