Mercurial > urweb
annotate demo/more/orm.urs @ 988:d923b47e483d
Basic CRUD operations in Orm
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Mon, 05 Oct 2009 17:00:04 -0400 |
parents | 6dd122f10c0c |
children | 0bdc4d538f1c |
rev | line source |
---|---|
adamc@987 | 1 con link :: Type -> Type |
adamc@987 | 2 |
adamc@987 | 3 con meta = fn col :: Type => { |
adamc@987 | 4 Link : link col, |
adamc@987 | 5 Inj : sql_injectable col |
adamc@987 | 6 } |
adamc@987 | 7 |
adamc@987 | 8 functor Table(M : sig |
adamc@987 | 9 con cols :: {Type} |
adamc@987 | 10 val cols : $(map meta cols) |
adamc@987 | 11 constraint [Id] ~ cols |
adamc@987 | 12 val folder : folder cols |
adamc@987 | 13 end) : sig |
adamc@987 | 14 type id |
adamc@987 | 15 val inj : sql_injectable id |
adamc@987 | 16 val id : meta id |
adamc@987 | 17 |
adamc@988 | 18 type row = $([Id = id] ++ M.cols) |
adamc@988 | 19 |
adamc@988 | 20 val create : $M.cols -> transaction row |
adamc@988 | 21 val delete : row -> transaction unit |
adamc@988 | 22 val save : row -> transaction unit |
adamc@988 | 23 val lookup : id -> transaction (option row) |
adamc@988 | 24 val list : transaction (list row) |
adamc@987 | 25 end |