Class: InfluxDB::Rails::Sql::Query
- Inherits:
-
Object
- Object
- InfluxDB::Rails::Sql::Query
- Defined in:
- lib/influxdb/rails/sql/query.rb
Overview
:nodoc:
Constant Summary collapse
- TRACKED_SQL_COMMANDS =
%w[SELECT INSERT UPDATE DELETE].freeze
- UNTRACKED_NAMES =
%w[SCHEMA].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #class_name ⇒ Object
-
#initialize(payload) ⇒ Query
constructor
A new instance of Query.
- #operation ⇒ Object
- #track? ⇒ Boolean
Constructor Details
#initialize(payload) ⇒ Query
Returns a new instance of Query.
12 13 14 15 |
# File 'lib/influxdb/rails/sql/query.rb', line 12 def initialize(payload) @query = payload[:sql].to_s.dup.upcase @name = payload[:name].to_s.dup end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/influxdb/rails/sql/query.rb', line 7 def name @name end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
7 8 9 |
# File 'lib/influxdb/rails/sql/query.rb', line 7 def query @query end |
Instance Method Details
#class_name ⇒ Object
21 22 23 |
# File 'lib/influxdb/rails/sql/query.rb', line 21 def class_name name.split.first end |
#operation ⇒ Object
17 18 19 |
# File 'lib/influxdb/rails/sql/query.rb', line 17 def operation query.split.first end |
#track? ⇒ Boolean
25 26 27 28 |
# File 'lib/influxdb/rails/sql/query.rb', line 25 def track? @track ||= query.start_with?(*TRACKED_SQL_COMMANDS) && !name.upcase.start_with?(*UNTRACKED_NAMES) end |