Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SupportedFileTypes = []Encoding{ {JSON, json.Unmarshal, jsn.Marshal}, {YAML, yaml.Unmarshal, yaml.Marshal}, {YML, yaml.Unmarshal, yaml.Marshal}, {TOML, toml.Unmarshal, toml.Marshal}, {HCL, hcltf.Unmarshal, hcltf.Marshal}, {TF, hcltf.Unmarshal, hcltf.Marshal}, {CSV, sv.Unmarshal, sv.Marshal}, {XML, xmll.Unmarshal, xmll.Marshal}, {INI, inii.Unmarshal, inii.Marshal}, {GRON, grn.Unmarshal, grn.Marshal}, {HTML, htm.Unmarshal, xmll.Marshal}, {LINE, lines.Unmarshal, jsn.Marshal}, {TXT, lines.Unmarshal, jsn.Marshal}, {PROTO, pb.Unmarshal, jsn.Marshal}, }
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 HTML LINE TXT PROTO )
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.