import std.datetime: SysTime, DateTime, UTC;
import std.array: array;
auto series = MeasurementSeries("coolness",
["time", "foo", "bar"],
[
["2015-06-11T20:46:02Z", "red", "blue"],
["2013-02-09T12:34:56Z", "green", "yellow"],
]);
series.rows[0]["foo"].shouldEqual("red");
series.rows[0]["time"].shouldEqual("2015-06-11T20:46:02Z");
series.rows[0].time.shouldEqual(SysTime(DateTime(2015, 06, 11, 20, 46, 2), UTC()));
series.rows[1]["bar"].shouldEqual("yellow");
series.rows[1]["time"].shouldEqual("2013-02-09T12:34:56Z");
series.rows[1].time.shouldEqual(SysTime(DateTime(2013, 2, 9, 12, 34, 56), UTC()));
series.rows["time"][0].shouldEqual("2015-06-11T20:46:02Z");
series.rows["bar"][1].shouldEqual("yellow");
series.rows.array.shouldEqual(
[
MeasurementSeries.Rows.Row(["time", "foo", "bar"],
["2015-06-11T20:46:02Z", "red", "blue"],
),
MeasurementSeries.Rows.Row(["time", "foo", "bar"],
["2013-02-09T12:34:56Z", "green", "yellow"],
),
]
);
auto series = MeasurementSeries("coolness",
["time", "foo", "bar"],
[["2015-06-11T20:46:02Z", "red", "blue"]]);
series.rows[0].get("foo", "oops").shouldEqual("red");
series.rows[0].get("quux", "oops").shouldEqual("oops");
import std.conv: to;
auto series = MeasurementSeries("coolness",
["time", "foo", "bar"],
[["2015-06-11T20:46:02Z", "red", "blue"]]);
series.rows[0].to!string.shouldEqual("Row(time: 2015-06-11T20:46:02Z, foo: red, bar: blue)");
import std.datetime: SysTime, DateTime, UTC, usecs;
import std.array: array;
auto series = MeasurementSeries("coolness",
["time", "foo", "bar"],
[
["2017-05-10T14:47:38.82524801Z", "red", "blue"],
]);
series.rows[0].time.shouldEqual(SysTime(DateTime(2017, 05, 10, 14, 47, 38), 825248.usecs, UTC()));
Data for one measurement