funcs_serdes

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON(str string) map[string]interface{}

fromJSON converts a JSON document into a map[string]interface{}.

This is not a general-purpose JSON parser, and will not parse all valid JSON documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string into m["Error"] in the returned map.

func FromJSONArray

func FromJSONArray(str string) []interface{}

fromJSONArray converts a JSON array into a []interface{}.

This is not a general-purpose JSON parser, and will not parse all valid JSON documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string as the first and only item in the returned array.

func FromYAML

func FromYAML(str string) map[string]interface{}

fromYAML converts a YAML document into a map[string]interface{}.

This is not a general-purpose YAML parser, and will not parse all valid YAML documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string into m["Error"] in the returned map.

func FromYAMLArray

func FromYAMLArray(str string) []interface{}

fromYAMLArray converts a YAML array into a []interface{}.

This is not a general-purpose YAML parser, and will not parse all valid YAML documents. Additionally, because its intended use is within templates it tolerates errors. It will insert the returned error message string as the first and only item in the returned array.

func FuncMap

func FuncMap() template.FuncMap

func ToJSON

func ToJSON(v interface{}) string

toJSON takes an interface, marshals it to json, and returns a string. It will always return a string, even on marshal error (empty string).

This is designed to be called from a template.

func ToTOML

func ToTOML(v interface{}) string

toTOML takes an interface, marshals it to toml, and returns a string. It will always return a string, even on marshal error (empty string).

This is designed to be called from a template.

func ToYAML

func ToYAML(v interface{}) string

toYAML takes an interface, marshals it to yaml, and returns a string. It will always return a string, even on marshal error (empty string).

This is designed to be called from a template.

Types

This section is empty.

Jump to

Keyboard shortcuts

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