Class: Libsql::QueryResult

Inherits:
Object
  • Object
show all
Defined in:
lib/libsql.rb

Defined Under Namespace

Classes: Row

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ QueryResult

Returns a new instance of QueryResult.



127
128
129
# File 'lib/libsql.rb', line 127

def initialize(response)
  @results = response.results
end

Instance Method Details

#rowsObject



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/libsql.rb', line 131

def rows
  @results.first["response"]["result"]["rows"].map do |register|
    row = Row.new

    register.map.with_index do |r, index|
      row.set(cols[index]["name"], r["value"])
    end

    row
  end.flatten
end