client/client.go
func (c *Client) stdPagedQuery(service *bigquery.Service, pageSize int, dataset, project, queryStr string, dataChan chan Data) ([][]interface{}, []string, error) {
	c.printDebug("std paged query")
	datasetRef := &bigquery.DatasetReference{
		DatasetId: dataset,
		ProjectId: project,
	}

	query := &bigquery.QueryRequest{
		DefaultDataset: datasetRef,
		MaxResults:     int64(pageSize),
		Kind:           "json",
		Query:          queryStr,
	}

	qr, err := service.Jobs.Query(project, query).Do()

	// extract the initial rows that have already been returned with the Query
	headers, rows := c.headersAndRows(qr.Schema, qr.Rows)

	if err != nil {
		c.printDebug("Error loading query: ", err)
		if dataChan != nil {
			dataChan <- Data{Err: err}
		}

		return nil, nil, err
	}

	return c.processPagedQuery(qr.JobReference, qr.PageToken, dataChan, headers, rows)
}
func (c *Client) stdPagedQuery(service *bigquery.Service, pageSize int, dataset, project, queryStr string, dataChan chan Data) ([][]interface{}, []string, error) {
	c.printDebug("std paged query")
	datasetRef := &bigquery.DatasetReference{
		DatasetId: dataset,
		ProjectId: project,
	}

	query := &bigquery.QueryRequest{
		DefaultDataset: datasetRef,
		MaxResults:     int64(pageSize),
		Kind:           "json",
		Query:          queryStr,
	}

	qr, err := service.Jobs.Query(project, query).Do()

	// extract the initial rows that have already been returned with the Query
	headers, rows := c.headersAndRows(qr.Schema, qr.Rows)

	if err != nil {
		c.printDebug("Error loading query: ", err)
		if dataChan != nil {
			dataChan <- Data{Err: err}
		}

		return nil, nil, err
	}

	return c.processPagedQuery(qr.JobReference, qr.PageToken, dataChan, headers, rows)
}
// stdPagedQuery executes a query using default job parameters and paging over the results, returning them over the data chan provided