예제 #1
0
파일: server.go 프로젝트: payintel/vitess
// SplitQuery is the RPC version of vtgateservice.VTGateService method
func (vtg *VTGate) SplitQuery(ctx context.Context, request *pb.SplitQueryRequest) (response *pb.SplitQueryResponse, err error) {

	defer vtg.server.HandlePanic(&err)
	ctx = callerid.NewContext(callinfo.GRPCCallInfo(ctx),
		request.CallerId,
		callerid.NewImmediateCallerID("grpc client"))
	reply := new(proto.SplitQueryResult)
	if err := vtg.server.SplitQuery(ctx,
		request.Keyspace,
		string(request.Query.Sql),
		tproto.Proto3ToBindVariables(request.Query.BindVariables),
		request.SplitColumn,
		int(request.SplitCount),
		reply); err != nil {
		return nil, err
	}
	return proto.SplitQueryPartsToProto(reply.Splits), nil
}
예제 #2
0
// SplitQuery is the RPC version of vtgateservice.VTGateService method
func (vtg *VTGate) SplitQuery(ctx context.Context, request *pb.SplitQueryRequest) (response *pb.SplitQueryResponse, err error) {

	defer vtg.server.HandlePanic(&err)
	query := &proto.SplitQueryRequest{
		Keyspace: request.Keyspace,
		Query: tproto.BoundQuery{
			Sql:           string(request.Query.Sql),
			BindVariables: tproto.Proto3ToBindVariables(request.Query.BindVariables),
		},
		SplitColumn: request.SplitColumn,
		SplitCount:  int(request.SplitCount),
	}
	reply := new(proto.SplitQueryResult)
	if err := vtg.server.SplitQuery(ctx, query, reply); err != nil {
		return nil, err
	}
	return proto.SplitQueryPartsToProto(reply.Splits), nil
}