This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package GRpcUtil
import (
"dsSupport/Utils/ConfigUtil"
"dsSupport/Utils/LogUtil"
"fmt"
"github.com/0x5010/grpcp"
"google.golang.org/grpc"
)
/**
功能:获取连接
作者:黄海
时间:2020-4-15
*/
func GetConnection() *grpc.ClientConn {
//连接的服务器地址
var address = ConfigUtil.RpcServerIp + ":" + ConfigUtil.RpcServerPort
//建立链接
conn, err := grpcp.GetConn(address) // get conn with grpcp default pool
if err != nil {
LogUtil.Error("连接RPC服务器发生错误", err.Error())
fmt.Println(err.Error())
}
return conn