github.com/DominikUrban/viper@v0.0.0-20220730150717-aaf74638bd32/internal/encoding/toml/codec2.go (about) 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 }