25 lines
646 B
Go
25 lines
646 B
Go
package grpcclient
|
|
|
|
import (
|
|
"git.hlsq.asia/alex/proto/proto/rs/rspb"
|
|
"git.hlsq.asia/alex/service-common/discover"
|
|
"git.hlsq.asia/alex/service-common/discover/common"
|
|
"git.hlsq.asia/alex/service-common/net/grpc/resolver"
|
|
)
|
|
|
|
func CourtNewClient(sid ...int64) (rspb.CourtClient, error) {
|
|
c, err := discover.FindServer(common.KeyDiscoverCourt, sid...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rspb.NewCourtClient(c), nil
|
|
}
|
|
|
|
func CourtNewClientLB() (rspb.CourtClient, error) {
|
|
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameCourt)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rspb.NewCourtClient(c), nil
|
|
}
|