spf13--viper/internal/encoding/yaml/codec.go
Mark Sagi-Kazar e42b933dbe feat!: drop yaml v2 support
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2023-01-19 16:02:48 +01:00

14 lines
341 B
Go

package yaml
import "gopkg.in/yaml.v3"
// Codec implements the encoding.Encoder and encoding.Decoder interfaces for YAML encoding.
type Codec struct{}
func (Codec) Encode(v map[string]interface{}) ([]byte, error) {
return yaml.Marshal(v)
}
func (Codec) Decode(b []byte, v map[string]interface{}) error {
return yaml.Unmarshal(b, &v)
}