gorm_implement

package
v0.0.0-...-c155d0e Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutoHttpTableName = "autohttp"

Functions

This section is empty.

Types

type AutoHttpTable

type AutoHttpTable struct {
	ID                  uint64 `gorm:"auto_increment:true;primary_key"` // 唯一标识ID
	BusinessType        string `gorm:"size:255;default:''"`             // 业务类型,用户自定义
	BusinessId          string `gorm:"size:255;default:''"`             // 业务主键,同一业务类型不能出现重复
	Url                 string `gorm:"size:255;default:''"`             // HTTP请求URL
	Method              string `gorm:"size:20;default:''"`              // HTTP请求方法
	Header              string `gorm:"type:text"`                       // HTTP请求头
	Body                string `gorm:"type:text"`                       // HTTP请求Body
	RetryType           bool   `gorm:"default:0"`                       // 重试类型
	RetryLadderInterval string `gorm:"size:255;default:''"`             // 阶梯性重试的间隔,使用逗号分隔
	RetryStepInterval   int64  `gorm:"default:0"`                       // 周期性重试的间隔
	RetryStepTime       int64  `gorm:"default:0"`                       // 周期性重试的次数
	RetryCount          int64  `gorm:"default:0"`                       // 重试计数
	Status              uint8  `gorm:"default:0"`                       // 状态,参见常量StatusXXX
	RequestTime         int64  `gorm:"default:0"`                       // 首次发起请求时间,Unix时间戳,单位秒
	LastRetryTime       int64  `gorm:"default:0"`                       // 上一次重试的时间,Unix时间戳,单位秒
	NextRetryTime       int64  `gorm:"default:0"`                       // 下一次重试时间,Unix时间戳,单位秒
	SuccessTime         int64  `gorm:"default:0"`                       // 成功时间,Unix时间戳,单位秒
}

func (AutoHttpTable) TableName

func (AutoHttpTable) TableName() string

type DatabaseCallbackImplement

type DatabaseCallbackImplement struct {
	// contains filtered or unexported fields
}

func (DatabaseCallbackImplement) CreateTask

func (impl DatabaseCallbackImplement) CreateTask(c context.Context, item *autohttp.Item) (err error)

创建初始任务

func (DatabaseCallbackImplement) DeleteTask

func (impl DatabaseCallbackImplement) DeleteTask(c context.Context, taskId uint64) (err error)

删除任务

func (DatabaseCallbackImplement) IncompleteTaskIdList

func (impl DatabaseCallbackImplement) IncompleteTaskIdList(c context.Context, currentTime int64) (list []uint64, err error)

查询待重试的任务(仅ID)

func (*DatabaseCallbackImplement) SetDB

func (impl *DatabaseCallbackImplement) SetDB(db *gorm.DB) (err error)

初始化结构体

func (DatabaseCallbackImplement) TaskDetail

func (impl DatabaseCallbackImplement) TaskDetail(c context.Context, taskId uint64) (item autohttp.Item, err error)

查询任务详细信息

func (DatabaseCallbackImplement) TaskDetailByBusiness

func (impl DatabaseCallbackImplement) TaskDetailByBusiness(c context.Context, businessType string, businessId string) (item autohttp.Item, err error)

查询任务详细信息

func (DatabaseCallbackImplement) TaskToCleanList

func (impl DatabaseCallbackImplement) TaskToCleanList(c context.Context, status uint8, timestamp int64) (list []uint64, err error)

待清理任务列表,status表示状态,beforeSecond表示多少秒之前(使用RequestTime计算)的任务

func (DatabaseCallbackImplement) UpdateTask

func (impl DatabaseCallbackImplement) UpdateTask(c context.Context, item *autohttp.Item) (err error)

更新任务

Jump to

Keyboard shortcuts

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