json

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCustomFields added in v1.1.0

func AddCustomFields(obj map[string]interface{}, cf map[string]interface{})

AddCustomFields add custom filed to json object.

func CopyExcept added in v1.1.0

func CopyExcept(json map[string]interface{}, flds ...string) map[string]interface{}

CopyExcept copies all fields except fields with given names.

func MarshalWithCustomFields

func MarshalWithCustomFields(v interface{}, cf map[string]interface{}) ([]byte, error)

MarshalWithCustomFields marshals value merged with custom fields defined in the map into JSON bytes.

func MergeCustomFields

func MergeCustomFields(v interface{}, cf map[string]interface{}) (map[string]interface{}, error)

MergeCustomFields converts value to the JSON-like map and merges it with custom fields map cf.

func Select added in v1.1.0

func Select(json map[string]interface{}, flds ...string) map[string]interface{}

Select copies only fields with given names.

func ShallowCopyObj added in v1.1.0

func ShallowCopyObj(json map[string]interface{}) map[string]interface{}

ShallowCopyObj creates new json object with copied fields form provided object.

func SplitJSONObj added in v1.1.0

func SplitJSONObj(json map[string]interface{}, flds ...string) (map[string]interface{}, map[string]interface{})

SplitJSONObj splits provides fields into separate object.

func ToMap

func ToMap(v interface{}) (map[string]interface{}, error)

ToMap convert object, string or bytes to json object represented by map.

func UnmarshalWithCustomFields

func UnmarshalWithCustomFields(data []byte, v interface{}, cf map[string]interface{}) error

UnmarshalWithCustomFields unmarshals JSON into value v and puts all JSON fields which do not belong to value into custom fields map cf.

Types

This section is empty.

Jump to

Keyboard shortcuts

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