Class: Cql::Client::QueryResult

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/cql/client/query_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata, rows) ⇒ QueryResult

Returns a new instance of QueryResult.



12
13
14
15
# File 'lib/cql/client/query_result.rb', line 12

def initialize(, rows)
  @metadata = ResultMetadata.new()
  @rows = rows
end

Instance Attribute Details

#metadataResultMetadata (readonly)

Returns:



9
10
11
# File 'lib/cql/client/query_result.rb', line 9

def 
  @metadata
end

Instance Method Details

#each {|row| ... } ⇒ Enumerable<Hash> Also known as: each_row

Iterates over each row in the result set.

Yield Parameters:

  • row (Hash)

    each row in the result set as a hash

Returns:

  • (Enumerable<Hash>)


28
29
30
# File 'lib/cql/client/query_result.rb', line 28

def each(&block)
  @rows.each(&block)
end

#empty?Boolean

Returns whether or not there are any rows in this result set

Returns:

  • (Boolean)


19
20
21
# File 'lib/cql/client/query_result.rb', line 19

def empty?
  @rows.empty?
end