Documentation ¶
Overview ¶
encoding package handles marshal and unmarshaling documents into various formats, such as json, bson, yaml, etc. Do not directly use the yaml.Unmarshal, etc, use these.
Index ¶
- Constants
- func Marshal(format string, in interface{}) (data []byte, err error)
- func MarshalFile(fs aferox.Aferox, path string, in interface{}) error
- func MarshalJson(in interface{}) ([]byte, error)
- func MarshalToml(in interface{}) ([]byte, error)
- func MarshalYaml(in interface{}) ([]byte, error)
- func Unmarshal(format string, data []byte, out interface{}) error
- func UnmarshalFile(fs aferox.Aferox, path string, out interface{}) error
- func UnmarshalJson(data []byte, out interface{}) error
- func UnmarshalToml(data []byte, out interface{}) error
- func UnmarshalYaml(data []byte, out interface{}) error
Constants ¶
const ( Yaml = "yaml" Json = "json" Toml = "toml" )
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal a struct to the specified format. Supported formats are: yaml, json, and toml.
func MarshalFile ¶
MarshalFile encodes the specified struct to a file. Supported file extensions are: yaml, yml, json, and toml.
func MarshalJson ¶
MarshalJson converts the input struct to json.
func MarshalToml ¶
MarshalToml converts the input to toml.
func MarshalYaml ¶
MarshalYaml converts the input to yaml.
func Unmarshal ¶
Unmarshal from the specified format into a struct. Supported formats are: yaml, json, and toml.
func UnmarshalFile ¶
Unmarshal from the specified file into a struct. Supported file extensions are: yaml, yml, json, and toml.
func UnmarshalJson ¶
UnmarshalJson converts the input json to a struct.
func UnmarshalToml ¶
UnmarshalToml converts the input toml to a struct.
func UnmarshalYaml ¶
UnmarshalYaml converts the input yaml to a struct.
Types ¶
This section is empty.