コード例 #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
ファイル: server.go プロジェクト: afrolovskiy/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)
	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
}