numutil

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONNumberType = reflect.TypeOf(json.Number(""))

JSONNumberType is the reflect.Type of encoding/json.Number. Marshaling code recognizes it and emits a DynamoDB N value so a decoded number that cannot be represented exactly by int64 or float64 survives a rewrite unchanged.

Functions

func ClampIntToInt32

func ClampIntToInt32(n int) int32

ClampIntToInt32 converts n to int32, clamping to the int32 range.

func ParseNumber

func ParseNumber(value string) (any, error)

ParseNumber converts a DynamoDB numeric string into a Go value that preserves the exact persisted value. Integers that fit int64 become int64; decimals that a float64 reproduces exactly become float64; every other valid number becomes json.Number so no precision is lost. Malformed input returns an error.

func ParseNumberSet

func ParseNumberSet(values []string) ([]any, error)

ParseNumberSet converts DynamoDB number-set elements with the same exactness guarantees as ParseNumber.

Types

This section is empty.

Jump to

Keyboard shortcuts

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