data type使用枚举类型

This commit is contained in:
2024-11-25 14:25:26 +08:00
parent b435398a94
commit 91423fb146
3 changed files with 9 additions and 4 deletions

5
any.go
View File

@ -10,6 +10,7 @@ package wrapper
import (
"fmt"
"git.zhangdeman.cn/zhangdeman/consts"
"git.zhangdeman.cn/zhangdeman/consts/enums"
"git.zhangdeman.cn/zhangdeman/serialize"
"reflect"
)
@ -34,7 +35,7 @@ func AnyDataType(data any) *AnyType {
// Date : 18:19 2023/6/1
type AnyType struct {
data any
dataType string
dataType enums.DataType
}
// IsNil 是否为 nil
@ -62,7 +63,7 @@ func (at *AnyType) IsNil() bool {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 18:22 2023/6/1
func (at *AnyType) Type() string {
func (at *AnyType) Type() enums.DataType {
if len(at.dataType) > 0 {
// 已经处理过的,无需在处理
return at.dataType