变更 interface{} => any
This commit is contained in:
@ -69,12 +69,12 @@ type CustomDiffFunc func(field string, inputVal wrapper.Map, storageVal wrapper.
|
||||
//
|
||||
// Date : 11:10 2024/3/8
|
||||
type DiffResult struct {
|
||||
Field string `json:"field"` // 字段名
|
||||
OldVal interface{} `json:"old_val"` // 当前field在storageVal中的值
|
||||
NewVal interface{} `json:"new_val"` // 当前field在inputVal中的值
|
||||
IsSame bool `json:"is_same"` // 两个值是否相同
|
||||
DiffReason string `json:"diff_reason"` // 两个值不同的原因
|
||||
Err error `json:"err"` // 对比过程中是否出现异常
|
||||
Field string `json:"field"` // 字段名
|
||||
OldVal any `json:"old_val"` // 当前field在storageVal中的值
|
||||
NewVal any `json:"new_val"` // 当前field在inputVal中的值
|
||||
IsSame bool `json:"is_same"` // 两个值是否相同
|
||||
DiffReason string `json:"diff_reason"` // 两个值不同的原因
|
||||
Err error `json:"err"` // 对比过程中是否出现异常
|
||||
}
|
||||
|
||||
const (
|
||||
@ -86,7 +86,7 @@ const (
|
||||
|
||||
var (
|
||||
// 当前仅支持基础类型的比较,不支持slice/map/struct等复杂类型的比较
|
||||
supportValueTypeTable = map[reflect.Kind]interface{}{
|
||||
supportValueTypeTable = map[reflect.Kind]any{
|
||||
reflect.Bool: true,
|
||||
reflect.Int: true,
|
||||
reflect.Int8: true,
|
||||
@ -135,9 +135,9 @@ func DefaultDiffFunc(field string, inputVal wrapper.Map, storageVal wrapper.Map,
|
||||
Err: nil,
|
||||
}
|
||||
var (
|
||||
inputFieldVal interface{}
|
||||
inputFieldVal any
|
||||
inputFieldValExist bool
|
||||
storageFieldVal interface{}
|
||||
storageFieldVal any
|
||||
storageFieldValExist bool
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user