empty

package
v0.0.0-...-c4191a4 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package empty provides functions for checking empty/nil variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

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

IsEmpty checks whether given `value` empty. It returns true if `value` is in: 0, nil, false, "", len(slice/map/chan) == 0, or else it returns false.

The parameter `traceSource` is used for tracing to the source variable if given `value` is type of pointer that also points to a pointer. It returns true if the source is empty when `traceSource` is true. Note that it might use reflect feature which affects performance a little.

func IsNil

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

IsNil checks whether given `value` is nil, especially for interface{} type value. Parameter `traceSource` is used for tracing to the source variable if given `value` is type of pointer that also points to a pointer. It returns nil if the source is nil when `traceSource` is true. Note that it might use reflect feature which affects performance a little.

Types

This section is empty.

Jump to

Keyboard shortcuts

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