优化IsNil判断

This commit is contained in:
白茶清欢 2024-08-13 16:30:16 +08:00
parent 3533617196
commit da44ae07ab
2 changed files with 8 additions and 2 deletions

5
any.go
View File

@ -43,7 +43,10 @@ type AnyType struct {
//
// Date : 18:21 2023/6/1
func (at *AnyType) IsNil() bool {
return at.data == nil
if at.data == nil {
return true
}
return reflect.ValueOf(at.data).IsNil()
}
// Type 获取类型

View File

@ -71,7 +71,10 @@ func (ot *ObjectType) IsValid() bool {
//
// Date : 18:50 2023/6/1
func (ot *ObjectType) IsNil() bool {
return ot.source == nil
if ot.source == nil {
return true
}
return reflect.ValueOf(ot.source).IsNil()
}
// ToString 转字符串