Documentation ¶
Index ¶
- func DiscoverService(ctx context.Context, serviceName string) (string, error)
- func GetInstance() *clientv3.Client
- func Init(conf Conf)
- func New(conf Conf) (*clientv3.Client, error)
- func RegisterService(ctx context.Context, serviceName, serviceEndpoint string, ttlSeconds int64) error
- func Watch(ctx context.Context, key string, fn func(k, v []byte))
- func WatchService(ctx context.Context, serviceName string, fn func(k, v []byte))
- func WatchWith(ctx context.Context, key string, fn func(k, v []byte), ...)
- func WatchWithPrefix(ctx context.Context, key string, fn func(k, v []byte))
- type Conf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterService ¶ added in v3.0.4
func RegisterService(ctx context.Context, serviceName, serviceEndpoint string, ttlSeconds int64) error
RegisterService 注册服务
Types ¶
type Conf ¶
type Conf struct { Enable bool `yaml:"enable" toml:"enable" json:"enable" default:"false"` //是否启用 Endpoints []string `yaml:"endpoints" toml:"endpoints" json:"endpoints"` //地址列表,如: localhost:2379 Username string `yaml:"username" toml:"username" json:"username"` //账号 Password string `yaml:"password" toml:"password" json:"password"` //密码 Timeout int `yaml:"timeout" toml:"timeout" json:"timeout"` //连接超时时间(毫秒)默认10000ms Tls *tls.Config `yaml:"-" toml:"-" json:"-"` //tls配置 }
Click to show internal directories.
Click to hide internal directories.