Documentation ¶
Index ¶
Constants ¶
View Source
const ( TaskGroupTypeQueue = "queue" TaskGroupTypeSql = "sql" TaskGroupTypeScript = "script" )
View Source
const ( TaskTypeTiming = 1 //定时任务 TaskTypeDelay = 2 //延时任务 TaskTypeQueue = 3 //消息触发任务 )
View Source
const ( SqlTypeNormal = "normal" SqlTypeJs = "js" )
View Source
const ( QueueTypeNats = "nats" QueueTypeNatsJs = "natsJs" )
View Source
const ( SqlEnvDsn = "dsn" SqlEnvDBType = "dbType" SqlEnvDriver = "driver" )
View Source
const ( PriorityCritical = "critical" //最高优先级 PriorityDefault = "default" //默认优先级 PriorityLow = "low" //最低优先级 )
Variables ¶
View Source
var (
Priorities = []string{PriorityDefault, PriorityCritical, PriorityLow}
)
Functions ¶
func ToPriority ¶
Types ¶
type ConfigSql ¶
type ConfigSql struct {
Database map[string]SqlDBConfig `json:"database"`
}
type ParamQueue ¶
type ParamScript ¶
type Script ¶
type Script struct { Param ParamScript Config ConfigSql }
type SqlDBConfig ¶
type TaskInfo ¶
type TaskInfo struct { ID int64 `json:"id"` // 任务ID Params string `json:"params,omitempty"` // 任务参数,延时任务如果没有传任务参数会拿数据库的参数来执行 Code string `json:"code"` //任务编码 GroupType string `json:"-"` //组类型:queue(消息队列消息发送) sql(执行sql) email(邮件发送) http(http请求) GroupSubType string `json:"-"` //组子类型 natsJs nats normal js GroupCode string `json:"groupCode"` //组编码 //需要使用的环境变量 sql类型中 dsn:如果填写,默认使用该dsn来连接,dbType:mysql|pgsql 默认是mysql Env map[string]string `json:"env"` Queue *ParamQueue `json:"queue"` //队列消息 Sql *Sql `json:"sql"` //sql执行类型 Script *Script `json:"script"` //脚本执行类型 }
Click to show internal directories.
Click to hide internal directories.