1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

move encoders out to plugins

This commit is contained in:
Asim Aslam
2020-12-30 08:46:31 +00:00
parent f64ffdbab1
commit 20b5755788
15 changed files with 2185 additions and 14 deletions

View File

@ -0,0 +1,25 @@
package xml
import (
"encoding/xml"
"github.com/micro/go-micro/v2/config/encoder"
)
type xmlEncoder struct{}
func (x xmlEncoder) Encode(v interface{}) ([]byte, error) {
return xml.Marshal(v)
}
func (x xmlEncoder) Decode(d []byte, v interface{}) error {
return xml.Unmarshal(d, v)
}
func (x xmlEncoder) String() string {
return "xml"
}
func NewEncoder() encoder.Encoder {
return xmlEncoder{}
}