xtype

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 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, min, max T) T

Clamp returns value clamped between min and max

func Coalesce added in v0.0.2

func Coalesce[T comparable](vals ...T) T

Coalesce returns first non-zero value

func Compare 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

func Deref added in v0.0.2

func Deref[T any](p *T) T

Deref returns value pointed to, or default value if nil

func DerefOr added in v0.0.2

func DerefOr[T any](p *T, def T) T

DerefOr returns value pointed to, or the provided default

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

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

Max returns the maximum of two ordered values

func Min added in v0.0.2

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

Min returns the minimum of two ordered values

func Ptr added in v0.0.2

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

Ptr returns pointer to value

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