This repository has been archived on 2026-01-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Game/Server/common/db/etcd/etcd.go

29 lines
388 B
Go

package etcd
import (
"go.etcd.io/etcd/client/v3"
"time"
)
var cli *clientv3.Client
func Init(endpoints []string) error {
client, err := clientv3.New(clientv3.Config{
Endpoints: endpoints,
DialTimeout: 5 * time.Second,
})
cli = client
return err
}
func Client() *clientv3.Client {
return cli
}
func Close() error {
if cli != nil {
return cli.Close()
}
return nil
}