package service

import (
	"common/discover"
	"common/discover/common"
	"common/net/grpc/resolver"
	"common/proto/ss/grpc_pb"
)

func UserNewClient(sid ...int64) (grpc_pb.UserClient, error) {
	c, err := discover.FindServer(common.KeyDiscoverUser, sid...)
	if err != nil {
		return nil, err
	}
	return grpc_pb.NewUserClient(c), nil
}

func UserNewClientLB() (grpc_pb.UserClient, error) {
	c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameUser)
	if err != nil {
		return nil, err
	}
	return grpc_pb.NewUserClient(c), nil
}
