event/base.go

43 lines
1.1 KiB
Go
Raw Normal View History

2024-07-17 12:47:09 +08:00
// Package event ...
//
// Description : event ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-07-17 12:31
package event
import (
"git.zhangdeman.cn/zhangdeman/event/abstract"
"git.zhangdeman.cn/zhangdeman/event/define"
)
type base struct {
panicCallback abstract.PanicCallback
parseFailCallback abstract.EventParseFailCallback
}
// SetPanicCallback 出现任何panic的回调
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 18:02 2024/6/26
func (b *base) SetPanicCallback(panicCallback abstract.PanicCallback) {
if nil == panicCallback {
panicCallback = define.DefaultPanicCallback
}
b.panicCallback = panicCallback
}
// SetEventParseFailCallback 设置事件解析失败回回调函数
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 18:42 2024/6/27
func (b *base) SetEventParseFailCallback(parseFailCallbackCallback abstract.EventParseFailCallback) {
if nil == parseFailCallbackCallback {
parseFailCallbackCallback = define.DefaultParseFailCallbackFunc
}
b.parseFailCallback = parseFailCallbackCallback
}