Documentation
¶
Overview ¶
Package typeutil adds functions for types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Default ¶
func Default[T comparable](val, def T) T
Default returns `val` if it is not zero, otherwise returns `def`.
v := Default("", "hello") // return "hello" v := Default("world", "hello") // return "world"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.