| | | 1 | | using TDengine.Driver; |
| | | 2 | | |
| | | 3 | | namespace pva.SuperV.Engine.HistoryRetrieval |
| | | 4 | | { |
| | | 5 | | /// <summary> |
| | | 6 | | /// Row of history for a specific timestamp. |
| | | 7 | | /// </summary> |
| | | 8 | | /// <remarks> |
| | | 9 | | /// Builds a row from a TDengine row. |
| | | 10 | | /// </remarks> |
| | | 11 | | /// <param name="row">TDengine row</param> |
| | | 12 | | /// <param name="fields">List of statistic fields.</param> |
| | | 13 | | /// /// <param name="keepFieldType">Whether to convert values to field type or keep as is.</param> |
| | | 14 | | public class HistoryStatisticRow(IRows row, List<HistoryStatisticField> fields, bool keepFieldType) |
| | 61 | 15 | | : HistoryRow(row, [.. fields.Select(field => field.Field)], keepFieldType) |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Start time of interval if an interval was specified. |
| | | 19 | | /// </summary> |
| | 52 | 20 | | public DateTime StartTime { get; } = ((DateTime)row.GetValue(row.FieldCount - 5)).ToUniversalTime(); |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// End time of interval if an interval was specified. |
| | | 24 | | /// </summary> |
| | 52 | 25 | | public DateTime EndTime { get; } = ((DateTime)row.GetValue(row.FieldCount - 4)).ToUniversalTime(); |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Duration of interval if an interval was specified. |
| | | 29 | | /// </summary> |
| | 52 | 30 | | public TimeSpan Duration { get; } = TimeSpan.FromMicroseconds(((long)row.GetValue(row.FieldCount - 3)) / 1000); |
| | | 31 | | } |
| | | 32 | | } |