Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SupportedFileTypes = []Encoding{ {JSON, json.Unmarshal, jsonMarshalIndent}, {YAML, yaml.Unmarshal, yaml.Marshal}, {YML, yaml.Unmarshal, yaml.Marshal}, {TOML, toml.Unmarshal, tomlMarshal}, {HCL, hclUnmarshal, hclMarshal}, {TF, hclUnmarshal, hclMarshal}, {CSV, csvUnmarshal, jsonMarshalIndent}, {XML, xmlUnmarshal, xmlMarshal}, {INI, iniUnmarshal, iniMarshal}, {GRON, gronUnmarshal, gronMarshal}, }
Functions ¶
func Marshal ¶
func Marshal(v interface{}, outputFileType EncodingType) ([]byte, error)
func PrettyFormat ¶
func PrettyFormat(s string, fileType EncodingType, raw bool) (string, error)
func Unmarshal ¶
func Unmarshal(input []byte, inputFileType EncodingType, data interface{}) error
Types ¶
type Encoding ¶
type Encoding struct { Ext EncodingType Unmarshal func([]byte, interface{}) error Marshal func(interface{}) ([]byte, error) }
type EncodingType ¶
type EncodingType int
EncodingType represents the supported encoding types as an enum with a string representation
const ( JSON EncodingType = iota YAML YML TOML HCL TF CSV XML INI GRON )
func GetEncodingType ¶
func GetEncodingType(fileType string) (EncodingType, error)
func (EncodingType) String ¶
func (e EncodingType) String() string
Click to show internal directories.
Click to hide internal directories.