public void Limit_the_number_points_returned_and_include_a_GROUP_BY_clause() { var query = InfluxQuery.From(h2o_feet) .Select((f, t) => new { mean = Aggregations.MEAN(f.water_level) }) .Where("time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:42:00Z'") .GroupBy(TimeSpan.FromMinutes(12), t => t) .Limit(2); query.Statement.Text.ShouldBe("SELECT MEAN(water_level) AS mean FROM h2o_feet WHERE time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:42:00Z' GROUP BY time(12m),location LIMIT 2"); }
public void Return_the_newest_points_first_and_include_a_GROUP_BY_time_clause() { var query = InfluxQuery.From(h2o_feet) .Select(f => new { mean = Aggregations.MEAN(f.water_level) }) .Where("time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:42:00Z'") .GroupBy(TimeSpan.FromMinutes(12)) .OrderByTimeDesc(); query.Statement.Text.ShouldBe("SELECT MEAN(water_level) AS mean FROM h2o_feet WHERE time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:42:00Z' GROUP BY time(12m) ORDER BY time DESC"); }
public void Paginate_points_and_include_several_clauses() { var query = InfluxQuery.From(h2o_feet) .Select(f => new { mean = Aggregations.MEAN(f.water_level) }) .Where("time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:42:00Z'") .GroupBy(TimeSpan.FromMinutes(12), t => t) .OrderByTimeDesc() .Limit(2) .Offset(2) .SLimit(1); query.Statement.Text.ShouldBe("SELECT MEAN(water_level) AS mean FROM h2o_feet WHERE time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:42:00Z' GROUP BY time(12m),location ORDER BY time DESC LIMIT 2 OFFSET 2 SLIMIT 1"); }