author | Mikael Berthe <mikael@lilotux.net> |
Tue, 23 Aug 2022 22:39:43 +0200 | |
changeset 260 | 445e01aede7e |
permissions | -rw-r--r-- |
260 | 1 |
//go:build !viper_toml1 |
2 |
// +build !viper_toml1 |
|
3 |
||
4 |
package toml |
|
5 |
||
6 |
import ( |
|
7 |
"github.com/pelletier/go-toml/v2" |
|
8 |
) |
|
9 |
||
10 |
// Codec implements the encoding.Encoder and encoding.Decoder interfaces for TOML encoding. |
|
11 |
type Codec struct{} |
|
12 |
||
13 |
func (Codec) Encode(v map[string]interface{}) ([]byte, error) { |
|
14 |
return toml.Marshal(v) |
|
15 |
} |
|
16 |
||
17 |
func (Codec) Decode(b []byte, v map[string]interface{}) error { |
|
18 |
return toml.Unmarshal(b, &v) |
|
19 |
} |