mapconv

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mapconv provides typed field extraction from map[string]any payloads.

JSON decoded with json.Unmarshal produces map[string]any where numeric values are float64 and compound values are []any or map[string]any. Each function handles these standard representations so callers do not need to branch on the raw type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64Ptr

func Int64Ptr(data map[string]any, key string) *int64

Int64Ptr extracts a nullable int64 from data[key]. Accepts float64 (standard JSON number) or string representations. Returns nil if the key is absent, nil, or unparseable.

func StringSliceVal

func StringSliceVal(data map[string]any, key string) []string

StringSliceVal extracts a []string from data[key]. Accepts a JSON array of strings or a bare string (returned as a one-element slice). Returns nil if the key is absent or the value is an empty string.

func StringVal

func StringVal(data map[string]any, key string) string

StringVal extracts a string value from data[key]. Numeric values are formatted with %g (no unnecessary trailing zeros). Returns "" if the key is absent or nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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