代码拉取完成,页面将自动刷新
package service
import "strings"
// Key
/** 一个KEY 值是由路径+服务名称组合 */
type Key struct {
Path string
Service string
}
func (k Key) ToKey() string {
if len(k.Service) > 0 {
return k.Path + "/" + k.Service
}
return k.Path
}
func (k Key) ToMap() map[string]interface{} {
//{"type": "service", "service":""}
//{"type": "keyprefix", "prefix": k.ToKey()}
return map[string]interface{}{"type": "key", "key": k.ToKey()}
}
func NewKey(key string) Key {
index := strings.LastIndexByte(key, '/')
if index == -1 {
return Key{Service: key}
}
return Key{key[0:index], key[index+1:]}
}
type Data struct {
Key
Value string //json format
}
type Config interface {
Set(data Data) error
Get(key Key) ([]*Data, error)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。