goProject/trunk/goutil/grpc-util/client/readme.md
皮蛋13361098506 1b77f62820 初始化项目
2025-01-06 16:01:02 +08:00

29 lines
577 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

client简单封装了grpc相关调用方法缓存了connection连接
整体文档入口请参考:[传送门](../readme.md)
## 使用方式如下:
### 1.导入包
```go
import (
"vast.com/goutil/grpc-util/client"
)
```
### 2.获取连接
```go
con, err := client.GetClientConn(host)
```
### 3.清理某个连接
```go
client.ClearClientConn("ip:port")
```
### 4.设置连接的默认超时时间
```go
client.SetDefaultTimeOut(time.Second * 3)
```
注意:
1.设置后对后续创建的连接生效,已经创建的不生效
2.默认的超时 时间为1s