annotate tests/crud.urs @ 362:24a31b35e08f

Reusable column handlers for Crud
author Adam Chlipala <adamc@hcoop.net>
date Tue, 14 Oct 2008 17:18:59 -0400
parents 2205d5cb416a
children 4f75cc2e1373
rev   line source
adamc@352 1 con colMeta = fn t_formT :: (Type * Type) =>
adamc@352 2 {Nam : string,
adamc@352 3 Show : t_formT.1 -> xbody,
adamc@352 4 Widget : nm :: Name -> xml form [] [nm = t_formT.2],
adamc@352 5 WidgetPopulated : nm :: Name -> t_formT.1
adamc@352 6 -> xml form [] [nm = t_formT.2],
adamc@352 7 Parse : t_formT.2 -> t_formT.1,
adamc@352 8 Inject : sql_injectable t_formT.1}
adamc@346 9 con colsMeta = fn cols :: {(Type * Type)} => $(mapT2T colMeta cols)
adamc@326 10
adamc@362 11 val default : t ::: Type -> show t -> read t -> sql_injectable t -> string -> colMeta (t, string)
adamc@362 12 val int : string -> colMeta (int, string)
adamc@362 13 val float : string -> colMeta (float, string)
adamc@362 14 val string : string -> colMeta (string, string)
adamc@362 15 val bool : string -> colMeta (bool, bool)
adamc@362 16
adamc@325 17 functor Make(M : sig
adamc@352 18 con cols :: {(Type * Type)}
adamc@352 19 constraint [Id] ~ cols
adamc@352 20 val tab : sql_table ([Id = int] ++ mapT2T fstTT cols)
adamc@325 21
adamc@352 22 val title : string
adamc@325 23
adamc@352 24 val cols : colsMeta cols
adamc@352 25 end) : sig
adamc@352 26 val main : unit -> transaction page
adamc@325 27 end