包装try/catch
This commit is contained in:
50
try/define.go
Normal file
50
try/define.go
Normal file
@ -0,0 +1,50 @@
|
||||
// Package try ...
|
||||
//
|
||||
// Description : try ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2023-07-20 11:29
|
||||
package try
|
||||
|
||||
// LogicFuncInput 逻辑函数输入参数
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:30 2023/7/20
|
||||
type LogicFuncInput struct {
|
||||
Parameter map[string]interface{}
|
||||
}
|
||||
|
||||
// LogicFuncOutput ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:30 2023/7/20
|
||||
type LogicFuncOutput struct {
|
||||
ErrCode string // 错误标识码
|
||||
Data map[string]interface{} // 错误时返回的数据
|
||||
}
|
||||
|
||||
// NewLogicFuncOutput 获取逻辑函数输出数据
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:33 2023/7/20
|
||||
func NewLogicFuncOutput(code string, data map[string]interface{}) LogicFuncOutput {
|
||||
if data == nil {
|
||||
data = map[string]interface{}{}
|
||||
}
|
||||
r := LogicFuncOutput{
|
||||
ErrCode: code,
|
||||
Data: data,
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
const (
|
||||
// NilLogicFunc 。。。
|
||||
NilLogicFunc = "NIL_LOGIC_FUNC"
|
||||
// LogicFuncPanic ...
|
||||
LogicFuncPanic = "LOGIC_FUNC_PANIC"
|
||||
)
|
Reference in New Issue
Block a user