author | Mikael Berthe <mikael@lilotux.net> |
Sat, 04 Feb 2023 13:35:58 +0100 | |
changeset 271 | c8b8b7cc8896 |
parent 265 | 05c40b36d3b2 |
permissions | -rw-r--r-- |
260 | 1 |
package yaml |
2 |
||
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
3 |
import "gopkg.in/yaml.v3" |
260 | 4 |
|
5 |
// Codec implements the encoding.Encoder and encoding.Decoder interfaces for YAML encoding. |
|
6 |
type Codec struct{} |
|
7 |
||
8 |
func (Codec) Encode(v map[string]interface{}) ([]byte, error) { |
|
9 |
return yaml.Marshal(v) |
|
10 |
} |
|
11 |
||
12 |
func (Codec) Decode(b []byte, v map[string]interface{}) error { |
|
13 |
return yaml.Unmarshal(b, &v) |
|
14 |
} |