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