1
0

xml.go 410 B

12345678910111213141516171819202122232425
  1. package xml
  2. import (
  3. "encoding/xml"
  4. "gogs.baozhida.cn/zoie/OAuth-core/config/encoder"
  5. )
  6. type xmlEncoder struct{}
  7. func (x xmlEncoder) Encode(v interface{}) ([]byte, error) {
  8. return xml.Marshal(v)
  9. }
  10. func (x xmlEncoder) Decode(d []byte, v interface{}) error {
  11. return xml.Unmarshal(d, v)
  12. }
  13. func (x xmlEncoder) String() string {
  14. return "xml"
  15. }
  16. func NewEncoder() encoder.Encoder {
  17. return xmlEncoder{}
  18. }