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 DecodeFile(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 EncodeFile(name string, obj any) error
- func EncodeJSONFile(name string, obj any) error
- func EncodeTOMLFile(name string, obj any) error
- func EncodeYAMLFile(name string, obj any) error
- func MustBytes(data []byte, err error) []byte
- func MustString(data string, err error) string
- func MustToString(data []byte, err error) string
- func NewSource(path string) config.Source
- func SourceDecoder(src *config.KeyValue, target map[string]interface{}) error
- type Decoder
- type Encoder
- type Type
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 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 EncodeYAMLFile ¶
EncodeYAMLFile Encodes the given YAML file
Types ¶
type Type ¶ added in v0.0.5
type Type int
func SupportTypeFromExt ¶ added in v0.0.5
SupportTypeFromExt returns the codec type from the file extension.
func SupportTypeFromString ¶ added in v0.0.5
SupportTypeFromString returns the codec type from the string.
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.