README
¶
etcdcli
Connect to the etcd service client.
Example of use
import "github.com/18721889353/sunshine/pkg/etcdcli"
endpoints := []string{"192.168.3.37:2379"}
// Way 1: setting parameters
cli, err := etcdcli.Init(
endpoints,
etcdcli.WithConnectTimeout(time.Second*2),
// etcdcli.WithAutoSyncInterval(0),
// etcdcli.WithLog(zap.NewNop()),
// etcdcli.WithAuth("", ""),
)
// Way 2: Setting up clientv3.Config
cli, err = etcdcli.Init(nil, etcdcli.WithConfig(&clientv3.Config{
Endpoints: endpoints,
DialTimeout: time.Second * 2,
//Username: "",
//Password: "",
}))
Documentation
¶
Overview ¶
Package etcdcli is use for connecting to the etcd service
Index ¶
- func Init(endpoints []string, opts ...Option) (*clientv3.Client, error)
- type Option
- func WithAuth(username string, password string) Option
- func WithAutoSyncInterval(duration time.Duration) Option
- func WithConfig(c *clientv3.Config) Option
- func WithDialTimeout(duration time.Duration) Option
- func WithLog(l *zap.Logger) Option
- func WithSecure(serverNameOverride string, certFile string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*options)
Option set the etcd client options.
func WithAutoSyncInterval ¶
WithAutoSyncInterval set auto sync interval value
func WithDialTimeout ¶
WithDialTimeout set dial timeout
func WithSecure ¶
WithSecure set tls
Click to show internal directories.
Click to hide internal directories.