Documentation ¶
Overview ¶
Package gg implements simple "extensions" to Go language. Based on https://github.com/icza/gog
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstOr ¶
func FirstOr[T comparable](or T, values ...T) T
FirstOr is a generic helper function that returns the first non-zero value from a list of comparable values, or a default value if all the values are zero.
func If ¶
func If[T comparable](v T, orElse T) T
If returns v if it is a non-zero value, orElse otherwise.
This is similar to elvis operator (?:) in Groovy and other languages. Note: Different from the real elvis operator, the orElse expression will always get evaluated.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.