interfaceKit

package
v2.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetZeroValue

func GetZeroValue[T any]() T

GetZeroValue 获取类型T的零值.

func IsNil deprecated

func IsNil(obj interface{}) bool

IsNil

Deprecated: 反射有性能问题,应尽可能避免使用此方法.

PS: (1) 如果某一变量的类型"不为指针",那么可以直接用"== nil"来判空. (2) 如果某一变量的类型"可能为指针",那么需要用此方法来判空.

func IsZeroValue

func IsZeroValue[T comparable](v T) bool

IsZeroValue 传参v是否是类型T的零值?

e.g. [interface{}](nil) => true

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL