valutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MPL-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstNonZero

func FirstNonZero[T comparable](values ...T) T

FirstNonZero returns the first argument that is non-zero, or the zero value if all are zero.

func ValOrDefault

func ValOrDefault[T comparable](val, defaultVal T) T

ValOrDefault returns the given value if it's non-zero, and otherwise returns the default.

func ValOrDefaultFunc added in v0.1.0

func ValOrDefaultFunc[T comparable](val T, defaultFunc func() T) T

ValOrDefault returns the given value if it's non-zero, and otherwise invokes defaultFunc to produce a default value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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