empty

package
v0.0.0-...-2910145 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

包 empty 提供了检查空/nil 变量的函数。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(value interface{}, traceSource ...bool) bool

IsEmpty 检查给定的 `value` 是否为空。 当 `value` 为以下情形之一时,返回 true:0, nil, false, "", 切片/映射/通道长度为0, 否则返回 false。

参数 `traceSource` 用于在 `value` 类型为指针且指向另一个指针时追踪到源变量。 如果 `traceSource` 为 true 并且源变量为空,则它会返回 true。 注意,这可能会使用 reflect 特性,对性能稍有影响。

func X是否为Nil

func X是否为Nil(value interface{}, traceSource ...bool) bool

IsNil 检查给定的 `value` 是否为 nil,特别是对 interface{} 类型的值。 参数 `traceSource` 用于在 `value` 是指针类型且指向另一个指针时,追踪到源变量。如果源变量为 nil 并且 `traceSource` 为真,则返回 nil。 注意,该函数可能会使用 reflect 特性,这会对性能造成一定的影响。

Types

This section is empty.

Jump to

Keyboard shortcuts

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