This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// === Around === | |
type Ctx struct { | |
Uniq string // 包名+接口名+方法名 | |
} | |
type CtxFunc func(ctx Ctx, method any, args []any) (res []any) | |
var ( | |
customCtxMap = make(map[string]CtxFunc) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IsZeror 可自定义类型实现IsZero方法,用于自定义空值检查,比如要对字符串做TrimSpace操作后再与空值比较 | |
type IsZeror interface { | |
IsZero() bool | |
} | |
// IsZero 判断值v是否为所属类型的零值 | |
// 即使是int和int64两个case也不能合并 | |
func IsZero(v interface{}) bool { | |
switch vv := v.(type) { |