You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
419 B
26 lines
419 B
package yaml
|
|
|
|
import (
|
|
"io"
|
|
|
|
"gitoa.ru/go-4devs/encoding"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
var (
|
|
_ encoding.Decode = Decode
|
|
_ encoding.Encode = Encode
|
|
)
|
|
|
|
// Decode from reader to value.
|
|
func Decode(r io.Reader, v interface{}) error {
|
|
return yaml.NewDecoder(r).Decode(v)
|
|
}
|
|
|
|
// Encode from value to writer.
|
|
func Encode(w io.Writer, v interface{}) error {
|
|
enc := yaml.NewEncoder(w)
|
|
defer enc.Close()
|
|
|
|
return enc.Encode(v)
|
|
}
|
|
|