1 Star 0 Fork 0

剑麟 / core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
pk.go 426 Bytes
一键复制 编辑 原始数据 按行查看 历史
lunny 提交于 2015-03-14 22:16 . bug fixed for PK marshal & unmarshl
package core
import (
"bytes"
"encoding/gob"
)
type PK []interface{}
func NewPK(pks ...interface{}) *PK {
p := PK(pks)
return &p
}
func (p *PK) ToString() (string, error) {
buf := new(bytes.Buffer)
enc := gob.NewEncoder(buf)
err := enc.Encode(*p)
return buf.String(), err
}
func (p *PK) FromString(content string) error {
dec := gob.NewDecoder(bytes.NewBufferString(content))
err := dec.Decode(p)
return err
}
Go
1
https://gitee.com/576981955/core.git
git@gitee.com:576981955/core.git
576981955
core
core
master

搜索帮助