コード例 #1
0
ファイル: conn.go プロジェクト: afrolovskiy/vitess
func (conn *vtgateConn) SplitQuery(ctx context.Context, keyspace string, query tproto.BoundQuery, splitColumn string, splitCount int) ([]proto.SplitQueryPart, error) {
	request := &pb.SplitQueryRequest{
		Keyspace:    keyspace,
		Query:       tproto.BoundQueryToProto3(query.Sql, query.BindVariables),
		SplitColumn: splitColumn,
		SplitCount:  int64(splitCount),
	}
	response, err := conn.c.SplitQuery(ctx, request)
	if err != nil {
		return nil, err
	}
	return proto.ProtoToSplitQueryParts(response), nil
}
コード例 #2
0
ファイル: conn.go プロジェクト: xgwubin/vitess
func (conn *vtgateConn) SplitQuery(ctx context.Context, keyspace string, query string, bindVars map[string]interface{}, splitColumn string, splitCount int) ([]proto.SplitQueryPart, error) {
	request := &pb.SplitQueryRequest{
		CallerId:    callerid.EffectiveCallerIDFromContext(ctx),
		Keyspace:    keyspace,
		Query:       tproto.BoundQueryToProto3(query, bindVars),
		SplitColumn: splitColumn,
		SplitCount:  int64(splitCount),
	}
	response, err := conn.c.SplitQuery(ctx, request)
	if err != nil {
		return nil, vterrors.FromGRPCError(err)
	}
	return proto.ProtoToSplitQueryParts(response), nil
}