Class: WideEvent::Store::QueryResult

Inherits:
Object
  • Object
show all
Defined in:
lib/wide_event/store/query_result.rb

Overview

An immutable, already-bounded result of a JSON /v1/query request (store/internal/httpapi/query.go's {"columns":...,"rows":...,"truncated":...} body, parsed). rows is an array of arrays in column order; a nil element is a SQL NULL. truncated is true when the store cut the result off at its row or response-size limit.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns:, rows:, truncated:) ⇒ QueryResult

Returns a new instance of QueryResult.



11
12
13
14
15
16
# File 'lib/wide_event/store/query_result.rb', line 11

def initialize(columns:, rows:, truncated:)
  @columns = columns.map(&:to_s).freeze
  @rows = rows.map { |row| row.freeze }.freeze
  @truncated = truncated == true
  freeze
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



9
10
11
# File 'lib/wide_event/store/query_result.rb', line 9

def columns
  @columns
end

#rowsObject (readonly)

Returns the value of attribute rows.



9
10
11
# File 'lib/wide_event/store/query_result.rb', line 9

def rows
  @rows
end

#truncatedObject (readonly)

Returns the value of attribute truncated.



9
10
11
# File 'lib/wide_event/store/query_result.rb', line 9

def truncated
  @truncated
end