mirror of
https://github.com/pyihe/go-pkg.git
synced 2025-10-07 00:43:21 +08:00
style(go-pkg): rename pkg
This commit is contained in:
17
serialize/msgpack.go
Normal file
17
serialize/msgpack.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package serialize
|
||||
|
||||
import "github.com/vmihailenco/msgpack/v5"
|
||||
|
||||
type msgPack struct{}
|
||||
|
||||
func Msgpack() Serializer {
|
||||
return msgPack{}
|
||||
}
|
||||
|
||||
func (mp msgPack) Encode(v interface{}) (data []byte, err error) {
|
||||
return msgpack.Marshal(v)
|
||||
}
|
||||
|
||||
func (mp msgPack) Decode(data []byte, v interface{}) error {
|
||||
return msgpack.Unmarshal(data, v)
|
||||
}
|
Reference in New Issue
Block a user