domain

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: AGPL-3.0 Imports: 0 Imported by: 0

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

Functions

func ToPriority

func ToPriority(level int64) string

Types

type ConfigSql

type ConfigSql struct {
	Database map[string]SqlDBConfig `json:"database"`
}

type ParamQueue

type ParamQueue struct {
	Topic   string `json:"topic"`
	Payload string `json:"payload"`
}

type ParamScript

type ParamScript struct {
	Param       map[string]string `json:"param"` //脚本参数,会通过函数入参传进去
	ExecContent string            `json:"execContent"`
}

type ParamSql

type ParamSql struct {
	Sql string `json:"sql"`
}

type Script

type Script struct {
	Param  ParamScript
	Config ConfigSql
}

type ScriptLog

type ScriptLog struct {
	Level       string `json:"level"`   //info warn error
	Content     string `json:"content"` //上下文
	CreatedTime int64  `json:"createdTime"`
}

type Sql

type Sql struct {
	Param  ParamSql
	Config ConfigSql
}

type SqlDBConfig

type SqlDBConfig struct {
	DSN    string `json:"dsn"`    //数据库连接串
	DBType string `json:"dbType"` //数据库类型(默认mysql)
	Driver string `json:"driver"` //连接的驱动
}

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"` //脚本执行类型
}

Jump to

Keyboard shortcuts

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