包装try/catch
This commit is contained in:
35
try/abstract.go
Normal file
35
try/abstract.go
Normal file
@ -0,0 +1,35 @@
|
||||
// Package try ...
|
||||
//
|
||||
// Description : try ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2023-07-20 11:26
|
||||
package try
|
||||
|
||||
// ICatchHandler 异常处理器接口约束
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:26 2023/7/20
|
||||
type ICatchHandler interface {
|
||||
Catch(errCode string, handler func(errCode string, data map[string]interface{})) ICatchHandler
|
||||
CatchAll(handler func(errCode string, data map[string]interface{})) IFinalHandler
|
||||
IFinalHandler
|
||||
}
|
||||
|
||||
// IFinalHandler 所有异常 / 逻辑执行成功之后的逻辑
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:27 2023/7/20
|
||||
type IFinalHandler interface {
|
||||
Finally(data map[string]interface{}, handlers ...func(data map[string]interface{}))
|
||||
}
|
||||
|
||||
// ILogicFunction 逻辑函数约束
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:29 2023/7/20
|
||||
type ILogicFunction func(input *LogicFuncInput) LogicFuncOutput
|
Reference in New Issue
Block a user