codec.go (361B)
1 package toml 2 3 import ( 4 "github.com/pelletier/go-toml/v2" 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) { 11 return toml.Marshal(v) 12 } 13 14 func (Codec) Decode(b []byte, v map[string]interface{}) error { 15 return toml.Unmarshal(b, &v) 16 }