Mercurial > urweb
annotate demo/more/orm.urs @ 989:0bdc4d538f1c
Orm searching
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Mon, 05 Oct 2009 17:24:21 -0400 |
parents | d923b47e483d |
children | 46803e668a89 |
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@989 | 25 |
adamc@989 | 26 con col :: Type -> Type |
adamc@989 | 27 val idCol : col id |
adamc@989 | 28 val cols : $(map col M.cols) |
adamc@989 | 29 |
adamc@989 | 30 type filter |
adamc@989 | 31 val search : filter -> transaction (list row) |
adamc@989 | 32 |
adamc@989 | 33 val eq : t ::: Type -> col t -> t -> filter |
adamc@989 | 34 val ne : t ::: Type -> col t -> t -> filter |
adamc@989 | 35 val lt : t ::: Type -> col t -> t -> filter |
adamc@989 | 36 val le : t ::: Type -> col t -> t -> filter |
adamc@989 | 37 val gt : t ::: Type -> col t -> t -> filter |
adamc@989 | 38 val ge : t ::: Type -> col t -> t -> filter |
adamc@989 | 39 |
adamc@989 | 40 val _and : filter -> filter -> filter |
adamc@989 | 41 val or : filter -> filter -> filter |
adamc@987 | 42 end |