xtype

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp added in v0.0.2

func Clamp[T cmp.Ordered](v, lo, hi T) T

Clamp returns v clamped between lo and hi.

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

func Compare[T cmp.Ordered](a, b T) int

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 FromJSON added in v0.0.2

func FromJSON(data string, target any) error

FromJSON parses JSON string into target

func FromJSONMust added in v0.0.2

func FromJSONMust(data string, target any)

FromJSONMust parses JSON string into target, panics on error

func Max deprecated added in v0.0.2

func Max[T cmp.Ordered](a, b T) T

Max returns the maximum of two ordered values.

Deprecated: use the built-in max function.

func Min deprecated added in v0.0.2

func Min[T cmp.Ordered](a, b T) T

Min returns the minimum of two ordered values.

Deprecated: use the built-in min function.

func Ptr deprecated added in v0.0.2

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

Ptr returns a pointer to v.

Deprecated: use new(v), supported since Go 1.26.

func ToJSON added in v0.0.2

func ToJSON(v any) string

ToJSON converts any value to JSON string

func ToJSONPretty added in v0.0.2

func ToJSONPretty(v any) string

ToJSONPretty converts any value to pretty-printed JSON string

func ToMap added in v0.0.2

func ToMap(v any) (map[string]any, error)

ToMap converts struct to map[string]any

Types

This section is empty.

Jump to

Keyboard shortcuts

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