BaseExpireTip

package
v5.1.34 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//OpenSub 是否启动订阅
	OpenSub = false
)

过期通知模块 * 允许直接写入过期序列,到达时间后该模块会发出nats通知,广播某个内容已经过期 1. 可以杜绝外部其他模块再去申明单独的run,用于过期处理 2. 减少系统负荷 3. 本模块自带了缓冲、持久化处理,不需要关心额外的处理 4. 注意,本模块适用于中小规模应用,超大密集应用请勿使用,会存在毫秒、秒级别阻塞。如果对该阻塞不敏感,可考虑使用。

Functions

func AppendTip

func AppendTip(args *ArgsAppendTip) (err error)

AppendTip 添加新的通知

func AppendTipNoErr

func AppendTipNoErr(args *ArgsAppendTip)

AppendTipNoErr 无错误推送 通知需订阅nats:/base/expire_tip/expire

func Init

func Init()

func Run

func Run()

Types

type ArgsAppendTip

type ArgsAppendTip struct {
	//组织ID
	OrgID int64 `db:"org_id" json:"orgID"`
	//用户ID
	UserID int64 `db:"user_id" json:"userID"`
	//系统标识码
	SystemMark string `db:"system_mark" json:"systemMark"`
	//关联ID
	BindID int64 `db:"bind_id" json:"bindID"`
	//hash
	// 用于额外的数据对比,避免异常
	// 如果不给予,则本模块自动生成,方便对照
	Hash string `db:"hash" json:"hash"`
	//过期时间
	// 请将该时间和内部时间做对比,避免没有及时通知更新造成异常行为
	ExpireAt time.Time `db:"expire_at" json:"expireAt"`
}

ArgsAppendTip 添加新的通知参数

type DataGetExpireData

type DataGetExpireData struct {
	OrgID    int64     `json:"orgID"`
	UserID   int64     `json:"userID"`
	ExpireAt time.Time `json:"expireAt"`
}

DataGetExpireData 解析数据包数据

func GetExpireData

func GetExpireData(rawData []byte) (data DataGetExpireData, err error)

GetExpireData 解析数据包 通知过期后,可使用此方法解析数据包

type FieldsTip

type FieldsTip struct {
	//ID
	ID int64 `db:"id" json:"id"`
	//创建时间
	CreateAt time.Time `db:"create_at" json:"createAt"`
	//组织ID
	OrgID int64 `db:"org_id" json:"orgID"`
	//用户ID
	UserID int64 `db:"user_id" json:"userID"`
	//系统标识码
	SystemMark string `db:"system_mark" json:"systemMark"`
	//关联ID
	BindID int64 `db:"bind_id" json:"bindID"`
	//hash
	// 用于额外的数据对比,避免异常
	// 如果不给予,则本模块自动生成,方便对照
	Hash string `db:"hash" json:"hash"`
	//过期时间
	// 请将该时间和内部时间做对比,避免没有及时通知更新造成异常行为
	ExpireAt time.Time `db:"expire_at" json:"expireAt"`
}

FieldsTip 通知消息列队

Jump to

Keyboard shortcuts

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