interfaceKit

package
v2.2.57 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertNotNil

func AssertNotNil(obj interface{}, name string) error

func GetZeroValue

func GetZeroValue[T any]() T

GetZeroValue 获取类型T的零值.

func IsNil deprecated

func IsNil(obj interface{}) bool

IsNil

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

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.

Jump to

Keyboard shortcuts

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