Documentation
¶
Index ¶
- func Copy(m utils.JSON) utils.JSON
- func DeepMerge(x1, x2 utils.JSON) utils.JSON
- func DeepMerge2(x1, x2 utils.JSON) utils.JSON
- func Encapsulate(envelopeName string, data utils.JSON) utils.JSON
- func GetBool(kv utils.JSON, k string) (bool, error)
- func GetBoolWithDefault(kv utils.JSON, k string, defaultValue bool) bool
- func GetFloat32(kv utils.JSON, k string) (v float32, err error)
- func GetFloat64(kv utils.JSON, k string) (v float64, err error)
- func GetInt(kv utils.JSON, k string) (v int, err error)
- func GetInt64(kv utils.JSON, k string) (v int64, err error)
- func GetInt64WithDefault(kv utils.JSON, k string, defaultValue int64) (v int64, err error)
- func GetIntWithDefault(kv utils.JSON, k string, defaultValue int) (v int, err error)
- func GetNumber[A Number](kv utils.JSON, k string) (v A, err error)
- func GetNumberWithDefault[A Number](kv utils.JSON, k string, defaultValue A) (v A)
- func GetString(kv utils.JSON, k string) (v string, err error)
- func GetTime(kv utils.JSON, k string) (v time.Time, err error)
- func GetValueWithFieldPathString(fieldPath string, data utils.JSON) (any, error)
- func MapStringStringCopy(m map[string]string) map[string]string
- func MarshalableMerge(x1, x2 any) (any, error)
- func MustGetInt64(kv utils.JSON, k string) (v int64)
- func PrettyPrint(v utils.JSON) (string, error)
- func ReplaceMergeMap(m1 utils.JSON, m2 utils.JSON) utils.JSON
- func ResponseBodyToJSON(r *http.Response) (utils.JSON, error)
- type Number
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepMerge ¶
DeepMerge merges x2 into x1 in place and returns x1. A nil x1 gets a new map, so the merge never writes to a nil map.
func GetInt64WithDefault ¶
func GetIntWithDefault ¶
func GetNumber ¶
GetNumber reads kv[k] as A. It takes A itself, any Go integer or float type, a float64 (what encoding/json decodes a number into) and the decimal text of a number as []byte (what database drivers hand back). A value A cannot hold exactly is refused, never truncated or wrapped: a fraction, NaN or an infinity for an integer type, a value outside A's range, and a float64 past 2^53 for an integer type (it has already lost digits).
func GetNumberWithDefault ¶
GetNumberWithDefault is GetNumber, with defaultValue in place of any error.
func MarshalableMerge ¶
MarshalableMerge merges the two JSON-marshalable values x1 and x2, preferring x1 over x2 except where x1 and x2 are JSON objects, in which case the keys from both objects are included and their values merged recursively.
It returns an error if x1 or x2 cannot be JSON-marshaled.