Class: ROM::InfluxDB::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ROM::InfluxDB::Gateway
- Defined in:
- lib/rom/influxdb/gateway.rb
Instance Attribute Summary collapse
-
#sets ⇒ Object
readonly
Returns the value of attribute sets.
Instance Method Summary collapse
-
#[](name) ⇒ Dataset
Return dataset with the given name.
- #command_namespace ⇒ Object
-
#dataset(name) ⇒ Dataset
Return dataset with the given name.
-
#dataset?(name) ⇒ Boolean
Check if dataset exists.
-
#connect(uri, options) ⇒ Gateway
constructor
InfluxDB gateway interface.
Constructor Details
#connect(uri, options) ⇒ Gateway
InfluxDB gateway interface
23 24 25 26 |
# File 'lib/rom/influxdb/gateway.rb', line 23 def initialize(uri, = {}) @connection = connect(uri, ) @sets = {} end |
Instance Attribute Details
#sets ⇒ Object (readonly)
Returns the value of attribute sets.
8 9 10 |
# File 'lib/rom/influxdb/gateway.rb', line 8 def sets @sets end |
Instance Method Details
#[](name) ⇒ Dataset
Return dataset with the given name
46 47 48 |
# File 'lib/rom/influxdb/gateway.rb', line 46 def [](name) sets.fetch(name) end |
#command_namespace ⇒ Object
62 63 64 |
# File 'lib/rom/influxdb/gateway.rb', line 62 def command_namespace InfluxDB::Commands end |
#dataset(name) ⇒ Dataset
Return dataset with the given name
35 36 37 |
# File 'lib/rom/influxdb/gateway.rb', line 35 def dataset(name) sets[name] = Dataset.new(name, connection) end |
#dataset?(name) ⇒ Boolean
Check if dataset exists
55 56 57 58 59 60 |
# File 'lib/rom/influxdb/gateway.rb', line 55 def dataset?(name) connection.query("select * from #{name} limit 1") true rescue ::InfluxDB::Error false end |