Method: Influxer::TimeQuery#time

Defined in:
lib/influxer/metrics/relation/time_query.rb

#time(val, options = {}) ⇒ Object

Add group value to relation. To be used instead of ‘group(“time(…)”). Accepts symbols and strings.

You can set fill value within options.

Metrics.time(:hour)
# select * from metrics group by time(1h)

Metrics.time("4d", fill: 0)
# select * from metrics group by time(4d) fill(0)


29
30
31
32
33
34
35
36
37
38
# File 'lib/influxer/metrics/relation/time_query.rb', line 29

def time(val, options = {})
  @values[:time] = if val.is_a?(Symbol)
                     TIME_ALIASES[val] || '1' + val.to_s
                   else
                     val
                   end

  build_fill(options[:fill])
  self
end