models

package
v0.0.0-...-e675862 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecutionPageSize = 10

ExecutionPageSize defaults

View Source
var Gdb *gorm.DB

Gdb connection

View Source
var MasterCron *cron.Cron

MasterCron system

Functions

func GetValidator

func GetValidator() *validator.Validate

GetValidator reference

func InTx

func InTx(f func(*gorm.DB) bool)

InTx executes function in a transaction

func InitCron

func InitCron()

InitCron system

func InitDB

func InitDB()

InitDB connection

func ValidStruct

func ValidStruct(s interface{}) (bool, validator.ValidationErrors)

ValidStruct a given one

Types

type Execution

type Execution struct {
	ID       int    `gorm:"primary_key" json:"id"`
	CPU      int    `json:"cpu"`
	RAM      int    `json:"ram"`
	Bandwith int    `json:"bandwith"`
	Seconds  int    `json:"seconds"`
	Machine  string `json:"machine"`
	TaskID   string `json:"task_id"`

	CreatedAt time.Time `json:"created_at"`
}

Execution on the system

func (*Execution) AfterCreate

func (e *Execution) AfterCreate()

AfterCreate callback

type Task

type Task struct {
	ID          string    `sql:"type:varchar(100)" gorm:"primary_key" json:"id"`
	Name        string    `json:"name" validate:"required"`
	Periodicity string    `json:"periodicity" validate:"required"`
	CronID      int       `json:"-"`
	Command     string    `json:"command" validate:"required"`
	CreatedAt   time.Time `json:"created_at"`
}

Task executed recurrently

func (*Task) AfterCreate

func (t *Task) AfterCreate(txn *gorm.DB) error

AfterCreate callback

func (*Task) AfterUpdate

func (t *Task) AfterUpdate(txn *gorm.DB) error

AfterUpdate callback

func (*Task) BeforeCreate

func (t *Task) BeforeCreate()

BeforeCreate callback

func (*Task) BeforeDelete

func (t *Task) BeforeDelete(txn *gorm.DB) error

BeforeDelete callback

func (*Task) Start

func (t *Task) Start(txn *gorm.DB) error

Start the task

func (*Task) Stop

func (t *Task) Stop(txn *gorm.DB) error

Stop the task

Jump to

Keyboard shortcuts

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