comparison demo/more/dbgrid.ur @ 935:2422360c78a3

Dropped in initial aggregate types
author Adam Chlipala <adamc@hcoop.net>
date Tue, 15 Sep 2009 09:40:51 -0400
parents 51bc7681c47e
children 6966d98c80b5
comparison
equal deleted inserted replaced
934:36f787c02287 935:2422360c78a3
11 Validate : t -> signal bool} 11 Validate : t -> signal bool}
12 12
13 con colMeta = fn (row :: {Type}) (global_t :: (Type * Type)) => 13 con colMeta = fn (row :: {Type}) (global_t :: (Type * Type)) =>
14 {Initialize : transaction global_t.1, 14 {Initialize : transaction global_t.1,
15 Handlers : global_t.1 -> colMeta' row global_t.2} 15 Handlers : global_t.1 -> colMeta' row global_t.2}
16
17 con aggregateMeta = fn (row :: {Type}) (acc :: Type) =>
18 {Initial : acc,
19 Step : $row -> acc -> acc,
20 Display : acc -> xbody}
16 21
17 structure Direct = struct 22 structure Direct = struct
18 con metaBase = fn actual_input :: (Type * Type) => 23 con metaBase = fn actual_input :: (Type * Type) =>
19 {Display : actual_input.2 -> xbody, 24 {Display : actual_input.2 -> xbody,
20 Edit : actual_input.2 -> xbody, 25 Edit : actual_input.2 -> xbody,
241 val cols : $(map (colMeta (key ++ row)) cols) 246 val cols : $(map (colMeta (key ++ row)) cols)
242 247
243 val keyFolder : folder key 248 val keyFolder : folder key
244 val rowFolder : folder row 249 val rowFolder : folder row
245 val colsFolder : folder cols 250 val colsFolder : folder cols
251
252 con aggregates :: {Type}
253 val aggregates : $(map (aggregateMeta (key ++ row)) aggregates)
246 end) = struct 254 end) = struct
247 open Grid.Make(struct 255 open Grid.Make(struct
248 val list = query (SELECT * FROM {{M.tab}} AS T) (fn r rs => return (r.T :: rs)) [] 256 val list = query (SELECT * FROM {{M.tab}} AS T) (fn r rs => return (r.T :: rs)) []
249 257
250 val wholeRow = @Folder.concat ! M.keyFolder M.rowFolder 258 val wholeRow = @Folder.concat ! M.keyFolder M.rowFolder
283 dml (Basis.delete M.tab (selector row)) 291 dml (Basis.delete M.tab (selector row))
284 292
285 val cols = M.cols 293 val cols = M.cols
286 294
287 val folder = M.colsFolder 295 val folder = M.colsFolder
296
297 val aggregates = M.aggregates
288 end) 298 end)
289 end 299 end