adamc@336: con colMeta' = fn t :: Type => {Nam : string, Show : t -> xbody} adamc@329: con colMeta = fn cols :: {Type} => $(Top.mapTT colMeta' cols) adamc@326: adamc@325: functor Make(M : sig adamc@325: con cols :: {Type} adamc@325: constraint [Id] ~ cols adamc@325: val tab : sql_table ([Id = int] ++ cols) adamc@325: adamc@325: val title : string adamc@325: adamc@327: val cols : colMeta cols adamc@325: end) = struct adamc@325: adamc@325: open constraints M adamc@325: val tab = M.tab adamc@325: adamc@337: fun delete (id : int) = adamc@337: () <- dml (DELETE FROM tab WHERE Id = {id}); adamc@337: return
adamc@337: The deed is done. adamc@337: adamc@337: adamc@337: fun confirm (id : int) = return adamc@337:Are you sure you want to delete ID #{txt _ id}?
adamc@337: adamc@337: adamc@337: adamc@337: adamc@334: fun main () : transaction page = adamc@334: rows <- queryX (SELECT * FROM tab AS T) adamc@334: (fn (fs : {T : $([Id = int] ++ M.cols)}) => adamc@326:ID | adamc@336: {foldTRX [colMeta'] [tr] adamc@336: (fn (nm :: Name) (t :: Type) (rest :: {Type}) => adamc@336: [[nm] ~ rest] => adamc@336: fn col =>
---|
{cdata col.Nam} | adamc@336: