equalutil

package
v1.71.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 8 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 AppendJSONKey added in v1.71.0

func AppendJSONKey(key []byte, v any) (out []byte, ok bool)

AppendJSONKey appends a spelling of v that two values share exactly when JSONEqual holds, NaN apart, so a set of values is searched without comparing every pair. ok is false when v is or holds a value with no such spelling (a struct or a pointer, say), which has to be compared with JSONEqual.

func EqualPtr

func EqualPtr[T comparable](a, b *T) bool

EqualPtr compares two pointers of any comparable type for equality. Both nil returns true, both non-nil with equal values returns true.

func ExactNumber added in v1.71.0

func ExactNumber(v any) *big.Float

ExactNumber returns v without rounding, or nil when v is not a number.

func JSONEqual added in v1.71.0

func JSONEqual(a, b any) bool

JSONEqual reports whether a and b are the same JSON value. Numbers compare by value at any depth, since a decoded enum member and a request value need not share a Go type.

func JSONShape added in v1.71.0

func JSONShape(v any) any

JSONShape returns v as the type a JSON decoder would give back for it, so that a named type, a typed slice or a typed map is held to the same constraints as the plain value, and a nil slice, map or pointer is null. A byte slice is left alone, since JSON writes it as a string. Only the outer value is converted; its members are converted when reached.

Types

This section is empty.

Jump to

Keyboard shortcuts

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