task

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

消息队列通知类型

Index

Constants

View Source
const (
	SqlTypeNormal = "normal"
	SqlTypeJs     = "js"
)
View Source
const (
	SqlEnvDsn    = "dsn"
	SqlEnvDBType = "dbType"
	SqlEnvDriver = "driver"
)
View Source
const (
	TaskTypeQueue = "queue"
	TaskTypeSql   = "sql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Group    string `json:"group"`    // 任务组名
	Type     string `json:"type"`     //任务类型:queue(消息队列消息发送)  sql(执行sql) email(邮件发送) http(http请求)
	SubType  string `json:"subType"`  //任务子类型 natsJs nats
	Name     string `json:"name"`     // 任务名称
	Code     string `json:"code"`     //任务编码
	Params   string `json:"params"`   // 任务参数
	Priority string `json:"priority"` //优先级: 6:critical 最高优先级  3: default 普通优先级 1:low 低优先级
	Queue    *Queue `json:"-"`        //消息队列类型
	Sql      *Sql   `json:"-"`        //sql执行类型
}

func (*Info) GetTypeName

func (j *Info) GetTypeName() string

func (*Info) Init

func (j *Info) Init() error

func (*Info) ToPayload

func (j *Info) ToPayload() []byte

func (*Info) ToPriority

func (j *Info) ToPriority() string

func (Info) ToTask

func (j Info) ToTask() *asynq.Task

type Queue

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

type Sql

type Sql struct {
	Type   string `json:"type"` // sql执行的类型  normal(支持环境变量的直接执行方式),js(js脚本执行)
	Sql    string `json:"sql"`  // 执行的sql
	Script string `json:"script"`
	//需要使用的环境变量 dsn:如果填写,默认使用该dsn来连接,dbType:mysql|pgsql 默认是mysql
	Env map[string]any `json:"env"`
}

Jump to

Keyboard shortcuts

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