1 Star 0 Fork 1.2K

和光文化/BookStack

forked from 进击的皇虫/BookStack 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gob.go 438 Bytes
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 2018-02-22 15:19 +08:00 . 假装第一次提交
package utils
import (
"bytes"
"encoding/gob"
)
//解码
func Decode(value string,r interface{}) (error) {
network := bytes.NewBuffer([]byte(value));
dec := gob.NewDecoder(network)
return dec.Decode(r);
}
//编码
func Encode(value interface{}) (string,error) {
network:= bytes.NewBuffer(nil);
enc := gob.NewEncoder(network)
err := enc.Encode(value);
if err != nil {
return "",err;
}
return network.String(),nil;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/bruno_gao/BookStack.git
git@gitee.com:bruno_gao/BookStack.git
bruno_gao
BookStack
BookStack
v1.3.1

搜索帮助