Documentation
¶
Index ¶
- func GetOrDefault[T any](ptr *T, defaultValue T) T
- func GetOrNilIfEmpty[T any](val []T) *[]T
- func GetOrPointerToDefault[T any](ptr *T, defaultValue T) *T
- func MakePtr[T any](value T) *T
- func MakePtrOrNil[T comparable](value T) *T
- func NonZeroOrDefault[T comparable](val T, defaultValue T) *T
- func SetOrNil[T comparable](val T, defaultValue T) *T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOrDefault ¶
func GetOrDefault[T any](ptr *T, defaultValue T) T
GetOrDefault returns the value of a pointer or a default value
func GetOrNilIfEmpty ¶ added in v2.2.1
func GetOrNilIfEmpty[T any](val []T) *[]T
func GetOrPointerToDefault ¶ added in v2.5.0
func GetOrPointerToDefault[T any](ptr *T, defaultValue T) *T
GetOrPointerToDefault returns the value of a pointer or a pointer to default value
func MakePtrOrNil ¶ added in v2.3.1
func MakePtrOrNil[T comparable](value T) *T
MakePtrOrNil returns a pointer only when value is not empty. Otherwise Atlas versioned API interprets a pointer to an empty value as not empty.
func NonZeroOrDefault ¶ added in v2.5.0
func NonZeroOrDefault[T comparable](val T, defaultValue T) *T
NonZeroOrDefault returns the address of the given value or defaultValue when it has zero value
func SetOrNil ¶
func SetOrNil[T comparable](val T, defaultValue T) *T
SetOrNil returns the address of the given value or nil if it equals defaultValue
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.