github.com/micro/go-micro/v2@v2.9.1/config/encoder/xml/xml.go (about) 1 package xml 2 3 import ( 4 "encoding/xml" 5 6 "github.com/micro/go-micro/v2/config/encoder" 7 ) 8 9 type xmlEncoder struct{} 10 11 func (x xmlEncoder) Encode(v interface{}) ([]byte, error) { 12 return xml.Marshal(v) 13 } 14 15 func (x xmlEncoder) Decode(d []byte, v interface{}) error { 16 return xml.Unmarshal(d, v) 17 } 18 19 func (x xmlEncoder) String() string { 20 return "xml" 21 } 22 23 func NewEncoder() encoder.Encoder { 24 return xmlEncoder{} 25 }