You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
870 B
30 lines
870 B
package client |
|
|
|
import ( |
|
"sig-pub/api/pb" |
|
"sig-pub/pkg/grpc/discovery" |
|
|
|
"google.golang.org/grpc" |
|
) |
|
|
|
// NewMarketClient new MarketServer grpc client |
|
func NewMarketClient(options ...grpc.DialOption) (marketClient pb.MarketServiceClient, err error) { |
|
grpcUrl := discovery.ConsulDialUrl(pb.MarketService_ServiceDesc.ServiceName) |
|
grpcConn, err := grpc.NewClient(grpcUrl, options...) |
|
if err != nil { |
|
panic(err) |
|
} |
|
marketClient = pb.NewMarketServiceClient(grpcConn) |
|
return |
|
} |
|
|
|
// NewExchangeClient new ExchangeServer grpc client |
|
func NewExchangeClient(options ...grpc.DialOption) (exchangeClient pb.ExchangeServiceClient, err error) { |
|
grpcUrl := discovery.ConsulDialUrl(pb.ExchangeService_ServiceDesc.ServiceName) |
|
grpcConn, err := grpc.NewClient(grpcUrl, options...) |
|
if err != nil { |
|
panic(err) |
|
} |
|
exchangeClient = pb.NewExchangeServiceClient(grpcConn) |
|
return |
|
}
|
|
|