Documentation
¶
Index ¶
- func Deserialize(data []byte) (map[string]interface{}, error)
- func DeserializeFile(filename string) (map[string]interface{}, error)
- func MustDeserialize(data []byte) map[string]interface{}
- func MustDeserializeFile(filename string) map[string]interface{}
- func MustReadFile(filename string) []byte
- func MustSerialize(content map[string]interface{}, format OutputFormat) []byte
- func MustWriteFile(filename string, content []byte)
- func MustWriteSerializedFile(filename string, content map[string]interface{}, format OutputFormat)
- func ReadFile(filename string) ([]byte, error)
- func Serialize(content map[string]interface{}, format OutputFormat) ([]byte, error)
- func WriteFile(filename string, content []byte) error
- func WriteSerializedFile(filename string, content map[string]interface{}, format OutputFormat) error
- type OutputFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deserialize ¶ added in v0.1.8
Deserialize will deserialize data as a JSON or YAML object. Will return an error if deserializing fails or if it isn't an object.
func DeserializeFile ¶ added in v0.1.8
DeserializeFile will read a JSON or YAML file and return the top-level object. Will return an error if it fails reading or the content isn't an object. Reads from stdin if filename == "-".
func MustDeserialize ¶
MustDeserialize will deserialize data as a JSON or YAML object. Will panic if deserializing fails or if it isn't an object. Will never return nil.
func MustDeserializeFile ¶
MustDeserializeFile will read a JSON or YAML file and return the top-level object. Will panic if it fails reading or the content isn't an object. Reads from stdin if filename == "-". This will never return nil.
func MustReadFile ¶
MustReadFile reads file contents. Will panic if reading fails. Reads from stdin if filename == "-"
func MustSerialize ¶
func MustSerialize(content map[string]interface{}, format OutputFormat) []byte
MustSerialize will serialize the result as a JSON/YAML. Will panic if serializing fails.
func MustWriteFile ¶
MustWriteFile writes the output to a file. Will panic if writing fails. Writes to stdout if filename == "-"
func MustWriteSerializedFile ¶
func MustWriteSerializedFile(filename string, content map[string]interface{}, format OutputFormat)
MustWriteSerializedFile will serialize the data and write it to a file. Will panic if it fails. Writes to stdout if filename == "-"
func Serialize ¶ added in v0.1.14
func Serialize(content map[string]interface{}, format OutputFormat) ([]byte, error)
Serialize will serialize the result as a JSON/YAML. Format parameter is case-insensitive.
func WriteFile ¶ added in v0.1.14
WriteFile writes the output to a file. Writes to stdout if filename == "-"
func WriteSerializedFile ¶ added in v0.1.14
func WriteSerializedFile(filename string, content map[string]interface{}, format OutputFormat) error
WriteSerializedFile will serialize the data and write it to a file. Writes to stdout if filename == "-"
Types ¶
type OutputFormat ¶ added in v0.1.18
type OutputFormat string
const ( OutputFormatYaml OutputFormat = "yaml" OutputFormatJSON OutputFormat = "json" )