model

package
v0.0.0-...-c59559d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultStatusWaiting = "waiting"
	ResultStatusSuccess = "success"
	ResultStatusError   = "error"
)

Variables

This section is empty.

Functions

func EnsureTables

func EnsureTables(db *sqlx.DB) error

func InputGetOne

func InputGetOne(e sqlx.Ext, id int, input *Input) error

func JobGetOne

func JobGetOne(e sqlx.Ext, id int, job *Job) error

func NewDB

func NewDB(driverName string, dataSourceName string) (*sqlx.DB, error)

func ResultGetOne

func ResultGetOne(e sqlx.Ext, id int, result *Result) error

func ResultGetOneByUUID

func ResultGetOneByUUID(e sqlx.Ext, uuid string, result *Result) error

func ResultGetOneByUUIDWithItems

func ResultGetOneByUUIDWithItems(e sqlx.Ext, uuid string, result *Result) error

func ResultItemGetOne

func ResultItemGetOne(e sqlx.Ext, id int, resultItem *ResultItem) error

func TaskGetOne

func TaskGetOne(e sqlx.Ext, id int, task *Task) error

func TaskSwapSeq

func TaskSwapSeq(e sqlx.Ext, t1 *Task, t2 *Task) error

Types

type Input

type Input struct {
	ID        int                  `json:"id"`
	TaskID    int                  `json:"taskID" db:"task_id"`
	Name      string               `json:"name"`
	Value     *watchful.InputValue `json:"value"`
	Type      watchful.ParamType   `json:"type" db:"type"`
	CreatedAt time.Time            `json:"createdAt" db:"created_at" `
	UpdatedAt time.Time            `json:"updatedAt" db:"updated_at"`
	DeletedAt *time.Time           `json:"deletedAt" db:"deleted_at"`
}

func InputAllByJobID

func InputAllByJobID(e sqlx.Ext, jobID int) ([]*Input, error)

func (*Input) Create

func (i *Input) Create(e sqlx.Ext) error

func (*Input) Delete

func (i *Input) Delete(e sqlx.Ext) error

func (*Input) Update

func (i *Input) Update(e sqlx.Ext) error

type Job

type Job struct {
	ID        int           `json:"id"`
	Name      string        `json:"name"`
	Active    bool          `json:"active"`
	Status    *ResultStatus `json:"status" db:"status"`
	Cron      string        `json:"cron" db:"cron"`
	LastRun   *time.Time    `json:"lastRun" db:"last_run"`
	CreatedAt time.Time     `json:"createdAt" db:"created_at" `
	UpdatedAt time.Time     `json:"updatedAt" db:"updated_at"`
	DeletedAt *time.Time    `json:"deletedAt" db:"deleted_at"`
}

func JobAll

func JobAll(e sqlx.Ext) ([]*Job, error)

func (*Job) Create

func (j *Job) Create(e sqlx.Ext) error

func (*Job) Update

func (j *Job) Update(e sqlx.Ext) error

func (*Job) Validate

func (j *Job) Validate() error

type Result

type Result struct {
	ID          int           `json:"id"`
	UUID        string        `json:"uuid" db:"uuid"`
	TestRun     bool          `json:"testRun" db:"test_run"`
	JobID       int           `json:"jobID" db:"job_id"`
	Status      ResultStatus  `json:"status" db:"status"`
	ResultItems []*ResultItem `json:"resultItems"`
	CreatedAt   time.Time     `json:"createdAt" db:"created_at" `
	UpdatedAt   time.Time     `json:"updatedAt" db:"updated_at"`
}

func ResultAllByJobID

func ResultAllByJobID(e sqlx.Ext, jobID int, limit int, offset int) ([]*Result, error)

func (*Result) Create

func (r *Result) Create(e sqlx.Ext) error

func (*Result) Update

func (r *Result) Update(e sqlx.Ext) error

type ResultItem

type ResultItem struct {
	ID        int          `json:"id"`
	ResultID  int          `json:"resultID" db:"result_id"`
	TaskID    int          `json:"taskID" db:"task_id"`
	Output    string       `json:"output" db:"output"`
	Error     string       `json:"error"`
	Status    ResultStatus `json:"status"`
	CreatedAt time.Time    `json:"createdAt" db:"created_at" `
	UpdatedAt time.Time    `json:"updatedAt" db:"updated_at"`
}

func ResultItemAllByResultID

func ResultItemAllByResultID(e sqlx.Ext, resultID int) ([]*ResultItem, error)

func (*ResultItem) Create

func (r *ResultItem) Create(e sqlx.Ext) error

func (*ResultItem) Update

func (r *ResultItem) Update(e sqlx.Ext) error

type ResultStatus

type ResultStatus string

type Task

type Task struct {
	ID         int        `json:"id"`
	JobID      int        `json:"jobID" db:"job_id"`
	Executable string     `json:"executable"`
	Inputs     []*Input   `json:"inputs"`
	Seq        int        `json:"seq"`
	CreatedAt  time.Time  `json:"createdAt" db:"created_at" `
	UpdatedAt  time.Time  `json:"updatedAt" db:"updated_at"`
	DeletedAt  *time.Time `json:"deletedAt" db:"deleted_at"`
}

func TaskAllByJobID

func TaskAllByJobID(e sqlx.Ext, jobID int) ([]*Task, error)

func TasksWithInputsByJobID

func TasksWithInputsByJobID(e sqlx.Ext, jobID int) ([]*Task, error)

func (*Task) Create

func (t *Task) Create(e sqlx.Ext) error

func (*Task) Delete

func (t *Task) Delete(e sqlx.Ext) error

func (*Task) Update

func (t *Task) Update(e sqlx.Ext) error

Jump to

Keyboard shortcuts

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