-
Notifications
You must be signed in to change notification settings - Fork 15
/
paramQuery.ur
49 lines (39 loc) · 1.25 KB
/
paramQuery.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
42
43
44
45
46
47
48
49
open Bootstrap
functor Make(M : sig
type input
con fs :: {Type}
val query : input -> 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
fun create inp = queryL (query inp)
fun onload _ = return ()
fun render _ a = <xml>
<table class="bs-table">
<thead><tr>
{@mapX [fn _ => string] [tr]
(fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] lab => <xml><th>{[lab]}</th></xml>)
fl labels}
</tr></thead>
<tbody>
{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}
</tbody>
</table>
</xml>
fun notification _ _ = <xml></xml>
fun buttons _ _ = <xml></xml>
fun ui inp = {Create = create inp,
Onload = onload,
Render = render,
Notification = notification,
Buttons = buttons}
end