예제 #1
0
        /// <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)));
        }
예제 #2
0
        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);
        }
예제 #3
0
 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;
 }
예제 #5
0
 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));
 }
예제 #6
0
 public HGrid(HaystackGrid source)
 {
     Source = source;
 }
예제 #7
0
 public HaystackException(HaystackGrid grid)
     : base(ReadStringOrNull(grid, "dis") ?? "server side error")
 {
     Grid = grid;
 }