etcdcli

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 7 Imported by: 2

README

etcdcli

连接etcd服务客户端。

使用示例

	endpoints := []string{"192.168.3.37:2379"}
    cli, err := Init(endpoints,
        WithConnectTimeout(time.Second*2),
        // WithAuth("", ""),
        // WithAutoSyncInterval(0),
        // WithLog(zap.NewNop()),
	)
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(endpoints []string, opts ...Option) (*clientv3.Client, error)

Init connecting to the etcd service

Types

type Option

type Option func(*options)

Option set the etcd client options.

func WithAuth

func WithAuth(username string, password string) Option

WithAuth set authentication

func WithAutoSyncInterval

func WithAutoSyncInterval(duration time.Duration) Option

WithAutoSyncInterval set auto sync interval value

func WithDialTimeout

func WithDialTimeout(duration time.Duration) Option

WithDialTimeout set dial timeout

func WithLog

func WithLog(l *zap.Logger) Option

WithLog set logger

func WithSecure

func WithSecure(serverNameOverride string, certFile string) Option

WithSecure set tls

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL