Class: Riak::TimeSeries::Query
Overview
A query for Riak Time Series. Supports SQL for querying (data manipulation language, or DML).
Instance Attribute Summary collapse
-
#client ⇒ Riak::Client
readonly
The Riak client to use for the TS query.
-
#interpolations ⇒ Object
Values to be interpolated into the query, support planned in Riak TS 1.2.
-
#query_text ⇒ String
The SQL query to run.
-
#results ⇒ Riak::Client::BeefcakeProtobuffsBackend::TsQueryResp
readonly
#!attribute [r] results.
Instance Method Summary collapse
-
#initialize(client, query_text, interpolations = {}) ⇒ Query
constructor
Initialize a query object.
-
#issue! ⇒ Object
Run the query against Riak TS, and store the results in the ‘results` attribute.
Constructor Details
#initialize(client, query_text, interpolations = {}) ⇒ Query
Initialize a query object
29 30 31 32 33 |
# File 'lib/riak/time_series/query.rb', line 29 def initialize(client, query_text, interpolations = {}) @client = client @query_text = query_text @interpolations = interpolations end |
Instance Attribute Details
#client ⇒ Riak::Client (readonly)
Returns the Riak client to use for the TS query.
17 18 19 |
# File 'lib/riak/time_series/query.rb', line 17 def client @client end |
#interpolations ⇒ Object
Values to be interpolated into the query, support planned in Riak TS 1.2
13 14 15 |
# File 'lib/riak/time_series/query.rb', line 13 def interpolations @interpolations end |
#query_text ⇒ String
Returns the SQL query to run.
9 10 11 |
# File 'lib/riak/time_series/query.rb', line 9 def query_text @query_text end |
#results ⇒ Riak::Client::BeefcakeProtobuffsBackend::TsQueryResp (readonly)
#!attribute [r] results
22 23 24 |
# File 'lib/riak/time_series/query.rb', line 22 def results @results end |
Instance Method Details
#issue! ⇒ Object
Run the query against Riak TS, and store the results in the ‘results` attribute
37 38 39 40 41 42 |
# File 'lib/riak/time_series/query.rb', line 37 def issue! @results = client.backend do |be| op = be.time_series_query_operator(client.) op.query(query_text, interpolations) end end |