maputil

package
v0.0.0-...-f0e47c8 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntArg

func IntArg(args map[string]any, key string) (int, bool)

IntArg extracts an integer value from a map[string]any by key. Uses NumberArg internally and truncates to int.

func NumberArg

func NumberArg(args map[string]any, key string) (float64, bool)

NumberArg extracts a numeric value from a map[string]any by key. Handles float64, float32, int, int64, int32, uint, uint64, uint32, json.Number, and string (parsed as float64). Returns (0, false) if the key is missing, nil, or not convertible to a number.

func StringArg

func StringArg(args map[string]any, key string) string

StringArg extracts a trimmed string value from a map[string]any by key. Returns "" if the key is missing, nil, or not a string/fmt.Stringer.

func StringArgMulti

func StringArgMulti(args map[string]any, keys ...string) (string, bool)

StringArgMulti tries multiple keys in order, returning the first non-empty trimmed string value and true. Returns ("", false) if none match.

Types

This section is empty.

Jump to

Keyboard shortcuts

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