/// <summary> /// Read a grid of "ts" and "val" data. /// </summary> /// <param name="grid">Grid to read.</param> /// <returns>List of history items.</returns> public static IEnumerable <HaystackHistoryItem> ReadGrid(HaystackGrid grid) { var ts = grid.Column("ts"); var val = grid.Column("val"); return(grid.Rows .Select(row => new HaystackHistoryItem(row))); }
private static string ReadStringOrNull(HaystackGrid grid, string tagName) { if (!grid.Meta.ContainsKey(tagName)) { return(null); } var dis = grid.Meta[tagName]; return(dis is HaystackString str ? str.Value : null); }
public static HGrid Map(HaystackGrid value) { return(new HGrid(value)); }
public HaystackRow(HaystackGrid grid, params HaystackValue[] values) : base(new Lazy <IDictionary <string, HaystackValue> >(() => ToDictionary(grid, values))) { Grid = grid; }
internal HGrid(HDict meta, List <HCol> cols, List <List <HVal> > rowLists) { Source = new HaystackGrid(cols.Select(M.Map).ToList(), rowLists.Select(l => l.Select(M.Map).ToArray()).ToList(), M.Map(meta)); }
public HGrid(HaystackGrid source) { Source = source; }
public HaystackException(HaystackGrid grid) : base(ReadStringOrNull(grid, "dis") ?? "server side error") { Grid = grid; }