3 Star 2 Fork 1

Gitee 极速下载 / codis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/CodisLabs/codis
克隆/下载
encode.go 546 Bytes
一键复制 编辑 原始数据 按行查看 历史
spinlock 提交于 2016-01-17 23:19 . Fix, import path to CodisLabs
// Copyright 2016 CodisLabs. All Rights Reserved.
// Licensed under the MIT (MIT-LICENSE.txt) license.
package models
import (
"encoding/json"
"github.com/CodisLabs/codis/pkg/utils/errors"
"github.com/CodisLabs/codis/pkg/utils/log"
)
func jsonEncode(v interface{}) []byte {
b, err := json.MarshalIndent(v, "", " ")
if err != nil {
log.PanicErrorf(err, "encode to json failed")
}
return b
}
func jsonDecode(v interface{}, b []byte) error {
if err := json.Unmarshal(b, v); err != nil {
return errors.Trace(err)
}
return nil
}
1
https://gitee.com/mirrors/codis.git
git@gitee.com:mirrors/codis.git
mirrors
codis
codis
de1ad026e329

搜索帮助

53164aa7 5694891 3bd8fe86 5694891