Documentation
¶
Overview ¶
Package codec is the codec package for encoding and decoding
Package codec is the codec package for encoding and decoding ¶
Package codec is the codec package for encoding and decoding
Index ¶
- Variables
- func Decode(rd io.Reader, obj any, ext string) error
- func DecodeFromFile(name string, obj any) error
- func DecodeINIFile(name string, obj any) error
- func DecodeJSONFile(name string, obj any) error
- func DecodeTOMLFile(name string, obj any) error
- func DecodeXMLFile(name string, obj any) error
- func DecodeYAMLFile(name string, obj any) error
- func Encode(w io.Writer, obj any, st Type) error
- func EncodeINIFile(name string, obj any) error
- func EncodeJSONFile(name string, obj any) error
- func EncodeTOMLFile(name string, obj any) error
- func EncodeToFile(name string, obj any) error
- func EncodeXMLFile(name string, obj any) error
- func EncodeYAMLFile(name string, obj any) error
- func IsSupported(s string) bool
- type Codec
- type DecodeReader
- type Decoder
- type EncodeWriter
- type Encoder
- type Hooker
- type Type
- func (s Type) Exts() []string
- func (s Type) IsSupported() bool
- func (s Type) Marshal(v interface{}) ([]byte, error)
- func (s Type) Name() string
- func (s Type) NewDecoder(r io.Reader) Decoder
- func (s Type) NewEncoder(w io.Writer) Encoder
- func (i Type) String() string
- func (s Type) Unmarshal(data []byte, v interface{}) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnsupportedDecodeType = errors.New("codec: unsupported decode type")
)
var (
ErrUnsupportedEncodeType = errors.New("codec: unsupported encode type")
)
Functions ¶
func DecodeFromFile ¶ added in v0.0.13
DecodeFromFile Decodes the given file
func DecodeINIFile ¶ added in v0.0.17
DecodeINIFile Decodes the given INI file
func DecodeJSONFile ¶
DecodeJSONFile Decodes the given JSON file
func DecodeTOMLFile ¶
DecodeTOMLFile Decodes the given TOML file
func DecodeXMLFile ¶ added in v0.0.17
DecodeXMLFile Decodes the given XML file
func DecodeYAMLFile ¶
DecodeYAMLFile Decodes the given YAML file
func EncodeINIFile ¶ added in v0.0.17
EncodeINIFile Encodes the given INI file
func EncodeJSONFile ¶
EncodeJSONFile Encodes the given JSON file
func EncodeTOMLFile ¶
EncodeTOMLFile Encodes the given TOML file
func EncodeToFile ¶ added in v0.0.13
EncodeToFile Encodes the given file
func EncodeXMLFile ¶ added in v0.0.17
EncodeXMLFile Encodes the given XML file
func EncodeYAMLFile ¶
EncodeYAMLFile Encodes the given YAML file
func IsSupported ¶ added in v0.3.16
IsSupported returns true if the codec type is supported.
Types ¶
type DecodeReader ¶ added in v0.3.17
func FileDecoder ¶ added in v0.3.17
func FileDecoder(name string, hooks ...Hooker) (DecodeReader, error)
type EncodeWriter ¶ added in v0.3.17
func FileEncoder ¶ added in v0.3.17
func FileEncoder(name string, hooks ...Hooker) (EncodeWriter, error)
type Type ¶ added in v0.0.5
type Type int
func TypeFromExt ¶ added in v0.0.13
TypeFromExt returns the codec type from the file extension.
func TypeFromPath ¶ added in v0.0.25
TypeFromPath returns the codec type from the file path.
func TypeFromString ¶ added in v0.0.13
TypeFromString returns the codec type from the string.
func (Type) IsSupported ¶ added in v0.0.13
Directories
¶
| Path | Synopsis |
|---|---|
|
Package json provides the json functions based on standard library
|
Package json provides the json functions based on standard library |
|
Package toml provides the toml functions
|
Package toml provides the toml functions |
|
Package yaml provides the yaml functions
|
Package yaml provides the yaml functions |