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 ¶
- Constants
- func Decode(rd io.Reader, obj any, ext string) error
- func DecodeFromFile(name string, obj any) error
- func DecodeJSONFile(name string, obj any) error
- func DecodeTOMLFile(name string, obj any) error
- func DecodeYAMLFile(name string, obj any) error
- func Encode(w io.Writer, obj any, st Type) error
- func EncodeJSONFile(name string, obj any) error
- func EncodeTOMLFile(name string, obj any) error
- func EncodeToFile(name string, obj any) error
- func EncodeYAMLFile(name string, obj any) error
- type Decoder
- type Encoder
- 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 ¶
View Source
const (
ErrUnsupportedDecodeType = errors.String("codec: unsupported decode type")
)
View Source
const (
ErrUnsupportedEncodeType = errors.String("codec: unsupported encode type")
)
Variables ¶
This section is empty.
Functions ¶
func DecodeFromFile ¶ added in v0.0.13
DecodeFromFile Decodes the given file
func DecodeJSONFile ¶
DecodeJSONFile Decodes the given JSON file
func DecodeTOMLFile ¶
DecodeTOMLFile Decodes the given TOML file
func DecodeYAMLFile ¶
DecodeYAMLFile Decodes the given YAML 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 EncodeYAMLFile ¶
EncodeYAMLFile Encodes the given YAML file
Types ¶
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 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 |
Click to show internal directories.
Click to hide internal directories.