adamc@987: con link :: Type -> Type adamc@987: adamc@987: con meta = fn col :: Type => { adamc@987: Link : link col, adamc@987: Inj : sql_injectable col adamc@987: } adamc@987: adamc@987: functor Table(M : sig adamc@987: con cols :: {Type} adamc@987: val cols : $(map meta cols) adamc@987: constraint [Id] ~ cols adamc@987: val folder : folder cols adamc@987: end) : sig adamc@987: type id adamc@987: val inj : sql_injectable id adamc@987: val id : meta id adamc@987: adamc@988: type row = $([Id = id] ++ M.cols) adamc@988: adamc@988: val create : $M.cols -> transaction row adamc@988: val delete : row -> transaction unit adamc@988: val save : row -> transaction unit adamc@988: val lookup : id -> transaction (option row) adamc@988: val list : transaction (list row) adamc@989: adamc@989: con col :: Type -> Type adamc@989: val idCol : col id adamc@989: val cols : $(map col M.cols) adamc@989: adamc@989: type filter adamc@989: val search : filter -> transaction (list row) adamc@989: adamc@989: val eq : t ::: Type -> col t -> t -> filter adamc@989: val ne : t ::: Type -> col t -> t -> filter adamc@989: val lt : t ::: Type -> col t -> t -> filter adamc@989: val le : t ::: Type -> col t -> t -> filter adamc@989: val gt : t ::: Type -> col t -> t -> filter adamc@989: val ge : t ::: Type -> col t -> t -> filter adamc@989: adamc@989: val _and : filter -> filter -> filter adamc@989: val or : filter -> filter -> filter adamc@987: end