package
Version:
v2.0.14
Opens a new window with list of versions in this module.
Published: Apr 20, 2023
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
func GetZeroValue[T any]() T
GetZeroValue 获取类型T的零值.
func IsNil(obj interface{}) bool
IsNil
Deprecated: 反射有性能问题,应尽可能避免使用此方法.
PS:
(1) 如果某一变量的类型"不为指针",那么可以直接用"== nil"来判空.
(2) 如果某一变量的类型"可能为指针",那么需要用此方法来判空.
IsZeroValue 传参v是否是类型T的零值?
e.g.
[interface{}](nil) => true
Source Files
¶
Click to show internal directories.
Click to hide internal directories.