123456789101112131415161718192021222324 |
- package etcd
- import (
- "strings"
- clientv3 "go.etcd.io/etcd/client/v3"
- )
- var cli *clientv3.Client
- func Init(addr string) {
- var err error
- cli, err = clientv3.New(clientv3.Config{
- Endpoints: strings.Split(addr, ","),
- })
- if err != nil {
- panic(err)
- }
- }
- func Get() *clientv3.Client {
- return cli
- }
|