val

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default added in v0.0.11

func Default[T any]() T

Default returns the default value of any type (if pointer, it is nil).

func Pointer

func Pointer[T any](v T) *T

AsPointer returns a pointer of a given value, useful if you need to generate a pointer to a string. For example, val.AsPointer("string")

func PointerNil added in v0.0.2

func PointerNil[T comparable](v T) *T

PointerNil behaves similarly to Pointer, except if the value of v is a zeroed value (eg. empty string), it returns nil instead.

func PointerValue

func PointerValue[T any](v *T) T

PointerValue returns the shallow deferenced pointer of a given value, or the zeroed value if nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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