-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleQuery.ur
41 lines (32 loc) · 1015 Bytes
/
simpleQuery.ur
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
open Bootstrap3
functor Make(M : sig
con fs :: {Type}
val query : sql_query [] [] [] fs
val fl : folder fs
val show : $(map show fs)
val labels : $(map (fn _ => string) fs)
end) = struct
open M
type a = list $fs
val create = queryL query
fun onload _ = return ()
fun render _ a = <xml>
<table class="bs3-table table-striped">
<tr>
{@mapX [fn _ => string] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] lab => <xml><th>{[lab]}</th></xml>)
fl labels}
</tr>
{List.mapX (fn fs => <xml>
<tr>
{@mapX2 [show] [ident] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] (_ : show t) (v : t) => <xml><td>{[v]}</td></xml>)
fl show fs}
</tr>
</xml>) a}
</table>
</xml>
val ui = {Create = create,
Onload = onload,
Render = render}
end