增加watch方法

This commit is contained in:
2021-11-23 15:13:50 +08:00
parent 0898107e92
commit c3f8e40133
2 changed files with 35 additions and 0 deletions

View File

@ -10,6 +10,8 @@ package etcd
import (
"math"
"time"
"go.etcd.io/etcd/clientv3"
)
// 初始化client各种默认配置
@ -33,3 +35,6 @@ const (
// DefaultGetTimeout get 默认超时时间
DefaultGetTimeout = time.Second
)
// WatcherHandler 监听key变化的处理函数
type WatcherHandler func(event *clientv3.Event)