Documentation
¶
Index ¶
- func Clamp[T cmp.Ordered](v, lo, hi T) T
- func Coalesce[T comparable](vals ...T) Tdeprecated
- func Compare[T cmp.Ordered](a, b T) intdeprecated
- func Deref[T any](p *T) T
- func DerefOr[T any](p *T, def T) T
- func FromJSON(data string, target any) error
- func FromJSONMust(data string, target any)
- func Max[T cmp.Ordered](a, b T) Tdeprecated
- func Min[T cmp.Ordered](a, b T) Tdeprecated
- func Ptr[T any](v T) *Tdeprecated
- func ToJSON(v any) string
- func ToJSONPretty(v any) string
- func ToMap(v any) (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce
deprecated
added in
v0.0.2
func Coalesce[T comparable](vals ...T) T
Coalesce returns the first non-zero value.
Deprecated: use cmp.Or directly.
func Compare
deprecated
added in
v0.0.2
Compare returns -1, 0, or 1 depending on ordering of a and b.
Deprecated: use cmp.Compare directly.
func Deref ¶ added in v0.0.2
func Deref[T any](p *T) T
Deref returns the value pointed to, or the zero value if p is nil.
func DerefOr ¶ added in v0.0.2
func DerefOr[T any](p *T, def T) T
DerefOr returns the value pointed to, or def if p is nil.
func FromJSONMust ¶ added in v0.0.2
FromJSONMust parses JSON string into target, panics on error
func ToJSONPretty ¶ added in v0.0.2
ToJSONPretty converts any value to pretty-printed JSON string
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.