1 Star 0 Fork 0

sun / common_pkg

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
gob_encoding.go 500 Bytes
Copy Edit Raw Blame History
yzsunjianguo authored 2023-09-19 21:35 . init
package encoding
import (
"bytes"
"encoding/gob"
)
// GobEncoding gob encode
type GobEncoding struct{}
// Marshal gob encode
func (g GobEncoding) Marshal(v interface{}) ([]byte, error) {
var (
buffer bytes.Buffer
)
err := gob.NewEncoder(&buffer).Encode(v)
return buffer.Bytes(), err
}
// Unmarshal gob encode
func (g GobEncoding) Unmarshal(data []byte, value interface{}) error {
err := gob.NewDecoder(bytes.NewReader(data)).Decode(value)
if err != nil {
return err
}
return nil
}
Go
1
https://gitee.com/jianguosun_admin/common_pkg.git
git@gitee.com:jianguosun_admin/common_pkg.git
jianguosun_admin
common_pkg
common_pkg
v1.0.4

Search

53164aa7 5694891 3bd8fe86 5694891