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