update code

This commit is contained in:
白茶清欢 2023-02-07 10:56:50 +08:00
parent 8b01147002
commit 28ebb480f7
10 changed files with 608 additions and 236 deletions

View File

@ -11,7 +11,7 @@ import (
"math"
"time"
"go.etcd.io/etcd/clientv3"
"github.com/coreos/etcd/clientv3"
)
// 初始化client各种默认配置

View File

@ -12,7 +12,7 @@ import (
"errors"
"time"
"go.etcd.io/etcd/clientv3"
"github.com/coreos/etcd/clientv3"
)
// DeleteWithOption ...

53
go.mod
View File

@ -7,38 +7,63 @@ replace github.com/coreos/bbolt v1.3.4 => go.etcd.io/bbolt v1.3.4
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
require (
git.zhangdeman.cn/zhangdeman/gopkg v0.0.0-20220404153548-f65ee3641a1e
github.com/coreos/etcd v3.3.27+incompatible
github.com/pkg/errors v0.9.1
go.etcd.io/etcd v3.3.27+incompatible
)
require (
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230113095943-b4b3e261e0c4
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/coreos/bbolt v1.3.4 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/coreos/pkg v0.0.0-20220810130054-c7d1c02cb6cf // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/btree v1.1.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/jonboulle/clockwork v0.3.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/tidwall/gjson v1.14.4 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 // indirect
github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
require (
github.com/Jeffail/gabs v1.4.0 // indirect
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/stretchr/testify v1.8.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

771
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,8 @@
package etcd
import (
"github.com/coreos/etcd/clientv3"
"github.com/pkg/errors"
"go.etcd.io/etcd/clientv3"
)
var (

View File

@ -11,8 +11,8 @@ import (
"context"
"time"
"github.com/coreos/etcd/clientv3"
"github.com/pkg/errors"
"go.etcd.io/etcd/clientv3"
)
// LeaseOnce 申请一个一次性租约

View File

@ -11,8 +11,8 @@ import (
"context"
"time"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/mvcc/mvccpb"
"go.etcd.io/etcd/clientv3"
)
// Put put数据

View File

@ -11,9 +11,9 @@ import (
"fmt"
"testing"
"git.zhangdeman.cn/zhangdeman/gopkg/util"
"git.zhangdeman.cn/zhangdeman/util"
"go.etcd.io/etcd/clientv3"
"github.com/coreos/etcd/clientv3"
)
func init() {
@ -51,7 +51,7 @@ func TestGet(t *testing.T) {
func TestGetWithPrefix(t *testing.T) {
prefix := "/test/dir/"
for i := 0; i < 10; i++ {
_ = Put(nil, fmt.Sprintf("%s%d", prefix, i), util.GenRandomString("", 8), 0)
_ = Put(nil, fmt.Sprintf("%s%d", prefix, i), util.String.GenRandom("", 8), 0)
}
fmt.Println(GetWithPrefix(nil, prefix, 0))
}

View File

@ -12,7 +12,7 @@ import (
"math"
"time"
"go.etcd.io/etcd/clientv3"
"github.com/coreos/etcd/clientv3"
)
// WatchKeyWithOption ...

View File

@ -12,7 +12,7 @@ import (
"testing"
"time"
"go.etcd.io/etcd/clientv3"
"github.com/coreos/etcd/clientv3"
)
// TestWatchKey ...