Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNotNil ¶
func IsNil ¶
func IsNil(obj interface{}) bool
IsNil Deprecated: 反射有性能问题,应尽可能避免使用此方法.
go里面的类型包含 type 和 value 的,一般对于业务我们更在意value是不是空.
e.g.
var src interface{} = nil
var src1 []string = nil
var src2 map[string]interface{} = nil
type bean struct {
}
var src3 *bean = nil
fmt.Println(interfaceKit.IsNil(src)) // true
fmt.Println(interfaceKit.IsNil(src1)) // true
fmt.Println(interfaceKit.IsNil(src2)) // true
fmt.Println(interfaceKit.IsNil(src3)) // true
func IsZeroValue ¶
func IsZeroValue[T comparable](v T) bool
IsZeroValue 传参v是否是类型T的零值?
e.g. [interface{}](nil) => true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.