util

package
v1.1.68-test Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsArray

func AsArray(v any) []any

AsArray returns v as a []any, or nil.

func Bool

func Bool(p *bool) bool

Bool dereferences an optional boolean (nil → false).

func ContainsStr

func ContainsStr(ss []string, s string) bool

ContainsStr reports whether ss contains s.

func Difference

func Difference(a, b []string) []string

Difference returns the elements of a not present in b.

func Float64

func Float64(p *float64) float64

Float64 dereferences an optional number (nil → 0).

func GetBool

func GetBool(m map[string]any, key string) bool

GetBool returns m[key] as a bool, or false if absent/nil/not a bool.

func GetStr

func GetStr(m map[string]any, key string) string

GetStr returns m[key] as a string, or "" if absent/nil/not a string.

func NumOf

func NumOf(v any) (float64, bool)

NumOf coerces a decoded-JSON number (float64 or int) to float64.

func Ptr

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

Ptr returns a pointer to v, for filling an optional field.

func Truthy

func Truthy(v any) bool

Truthy mirrors JS truthiness for a decoded-JSON value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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