etcdKit

package
v2.8.173 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotSetupError = errorKit.New("Haven’t been set up correctly")
)

Functions

func Exist

func Exist(kv clientv3.KV, ctx context.Context, key string) (bool, error)

Exist key是否存在?

func GetClient

func GetClient() (*clientv3.Client, error)

GetClient

PS: (1) 要使用 KV 的情况下,建议调用 clientv3.NewKV() 以实例化一个用于操作etcd的KV(内置错误重试机制). (2) 租约相关需要用到 *clientv3.Client实例.

func MustSetUp

func MustSetUp(config *Config)

Types

type Config

type Config struct {
	Endpoints []string `json:"endpoints" yaml:"endpoints"`
	// LogPath etcd客户端的日志输出(默认: 输出到控制台)
	LogPath string `json:"logPath,optional" yaml:"logPath"`
}

func (*Config) Check

func (config *Config) Check() error

Jump to

Keyboard shortcuts

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