model

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB(dialect string, args ...interface{})

func DB

func DB() *gorm.DB

func Transactions

func Transactions(fn func(tx *gorm.DB) error) error

Types

type Client

type Client struct {
	gorm.Model
	Name           string `gorm:"not null"`
	State          int
	DaemonTaskNum  int
	CrontabTaskNum int
	Addr           string `gorm:"unique;not null"`
	Mail           string
}

type CrontabArgs

type CrontabArgs struct {
	Weekday string
	Month   string
	Day     string
	Hour    string
	Minute  string
}

func (*CrontabArgs) Scan

func (c *CrontabArgs) Scan(v interface{}) error

func (CrontabArgs) Value

func (c CrontabArgs) Value() (driver.Value, error)

type CrontabTask

type CrontabTask struct {
	gorm.Model
	Name               string `gorm:"unique;not null"`
	Command            string
	Depends            DependsTasks `gorm:"type:TEXT"`
	PipeCommands       PipeComamnds `gorm:"type:TEXT"`
	State              int          // 0/1/2
	Args               string
	Create             int64
	LastCostTime       int64
	LastExecTime       int64
	LastExitStatus     string
	Timeout            int64
	NumberProcess      int32
	TimerCounter       int32
	UnexpectedExitMail bool
	UnexpectedExitApi  bool
	Sync               bool // 脚本是否同步执行
	MailTo             string
	ApiTo              string
	MaxConcurrent      int         // 脚本最大并发量
	OpTimeout          string      // email/kill/email_and_kill/ignore/api
	C                  CrontabArgs `gorm:"type:TEXT"`
}

type DaemonTask

type DaemonTask struct {
	gorm.Model
	Name          string `gorm:"unique;not null"`
	MailNotify    bool
	ApiNotify     bool
	Status        int
	MailTo        string
	ApiTo         string
	FailedRestart bool
	ProcessNum    int
	StartAt       time.Time
	Command       string
	Args          string
}

type DependsTask

type DependsTask struct {
	Name         string
	Dest         string
	From         string
	TaskId       uint
	Id           string `json:"-"`
	TaskEntityId string `json:"-"`
	Command      string
	Args         string
	Timeout      int64
	Err          string `json:"-"`
	LogContent   []byte `json:"-"`
}

type DependsTasks

type DependsTasks []DependsTask

func (*DependsTasks) Scan

func (d *DependsTasks) Scan(v interface{}) error

func (DependsTasks) Value

func (d DependsTasks) Value() (driver.Value, error)

type PipeComamnds

type PipeComamnds [][]string

func (*PipeComamnds) Scan

func (p *PipeComamnds) Scan(v interface{}) error

func (PipeComamnds) Value

func (p PipeComamnds) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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