29 lines
694 B
Go
29 lines
694 B
Go
|
// Package apollo...
|
||
|
//
|
||
|
// Description : 扩展第三方库的一些函数
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 2021-11-24 10:16 下午
|
||
|
package apollo
|
||
|
|
||
|
import (
|
||
|
"git.zhangdeman.cn/zhangdeman/gopkg/util"
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
// GetValueWithReceiver 读取数据,并解析到指定的数据结构中
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 10:18 下午 2021/11/24
|
||
|
func GetValueWithReceiver(key string, receiver interface{}) error {
|
||
|
var (
|
||
|
result string
|
||
|
)
|
||
|
if result = Client.GetStringValue(key, ""); len(result) == 0 {
|
||
|
return errors.New("key is not found : " + key)
|
||
|
}
|
||
|
return util.JSONUnmarshalWithNumber([]byte(result), receiver)
|
||
|
}
|