Class: BigQuery::ResultSet

Inherits:
Struct
  • Object
show all
Defined in:
lib/bigquery-client/query_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#column_namesObject

Returns the value of attribute column_names

Returns:

  • (Object)

    the current value of column_names



2
3
4
# File 'lib/bigquery-client/query_result.rb', line 2

def column_names
  @column_names
end

#column_typesObject

Returns the value of attribute column_types

Returns:

  • (Object)

    the current value of column_types



2
3
4
# File 'lib/bigquery-client/query_result.rb', line 2

def column_types
  @column_types
end

#job_idObject

Returns the value of attribute job_id

Returns:

  • (Object)

    the current value of job_id



2
3
4
# File 'lib/bigquery-client/query_result.rb', line 2

def job_id
  @job_id
end

#recordsObject

Returns the value of attribute records

Returns:

  • (Object)

    the current value of records



2
3
4
# File 'lib/bigquery-client/query_result.rb', line 2

def records
  @records
end

Instance Method Details

#to_aObject



3
4
5
6
7
8
9
10
# File 'lib/bigquery-client/query_result.rb', line 3

def to_a
  records.map {|record|
    values = record.map.with_index do |value, index|
      Attribute.new(value: value, type: column_types[index]).parse
    end
    [column_names, values].transpose.to_h
  }
end