annotate tests/crud1.ur @ 348:b88f4297167f

Improved inference of records of tuples
author Adam Chlipala <adamc@hcoop.net>
date Sat, 04 Oct 2008 19:56:59 -0400
parents 58eeeb3cbf40
children beb72f8a7218
rev   line source
adamc@325 1 table t1 : {Id : int, A : int, B : string, C : float, D : bool}
adamc@325 2
adamc@325 3 open Crud.Make(struct
adamc@325 4 val tab = t1
adamc@325 5
adamc@325 6 val title = "Crud1"
adamc@325 7
adamc@325 8 val cols = {
adamc@339 9 A = {
adamc@339 10 Nam = "A",
adamc@339 11 Show = txt _,
adamc@339 12 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
adamc@341 13 WidgetPopulated = fn (nm :: Name) n => <lform><textbox{nm} value={show _ n}/></lform>,
adamc@339 14 Parse = readError _,
adamc@339 15 Inject = sql_int
adamc@339 16 },
adamc@339 17 B = {
adamc@339 18 Nam = "B",
adamc@339 19 Show = txt _,
adamc@339 20 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
adamc@341 21 WidgetPopulated = fn (nm :: Name) s => <lform><textbox{nm} value={s}/></lform>,
adamc@339 22 Parse = readError _,
adamc@339 23 Inject = sql_string
adamc@339 24 },
adamc@339 25 C = {
adamc@339 26 Nam = "C",
adamc@339 27 Show = txt _,
adamc@339 28 Widget = fn nm :: Name => <lform><textbox{nm}/></lform>,
adamc@341 29 WidgetPopulated = fn (nm :: Name) n => <lform><textbox{nm} value={show _ n}/></lform>,
adamc@339 30 Parse = readError _,
adamc@339 31 Inject = sql_float
adamc@339 32 },
adamc@339 33 D = {
adamc@339 34 Nam = "D",
adamc@339 35 Show = txt _,
adamc@347 36 Widget = fn nm :: Name => <lform><checkbox{nm}/></lform>,
adamc@347 37 WidgetPopulated = fn (nm :: Name) b => <lform><checkbox{nm} checked={b}/></lform>,
adamc@347 38 Parse = fn x => x,
adamc@339 39 Inject = sql_bool
adamc@339 40 }
adamc@325 41 }
adamc@325 42 end)