Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Marshals = map[string]Marshal{ "json": json.Marshal, "xml": xml.Marshal, "yaml": yaml.Marshal, "yml": yaml.Marshal, "toml": func(v interface{}) ([]byte, error) { b := bytes.NewBuffer(nil) defer b.Reset() err := toml.NewEncoder(b).Encode(v) if err != nil { return nil, err } return b.Bytes(), nil }, } Unmarshals = map[string]Unmarshal{ "json": json.Unmarshal, "xml": xml.Unmarshal, "yaml": yaml.Unmarshal, "yml": yaml.Unmarshal, "toml": toml.Unmarshal, } )
View Source
var DefaultPrefix = "/ceres/config/"
Functions ¶
Types ¶
type Config ¶
type Config struct { *clientv3.Config Prefix string // etcd配置路径 TrimPrefix string // 删除掉的头部字符串 Encoding string // 加解密 Ctx context.Context }
func (*Config) WithEndpoints ¶ added in v1.0.4
Addr 连接地址
func (*Config) WithPrefix ¶ added in v1.0.4
Prefix 前缀
func (*Config) WithStripPrefix ¶ added in v1.0.4
TrimPrefix 去掉前缀前缀
Click to show internal directories.
Click to hide internal directories.