view demo/more/orm.urs @ 1909:659d1f4e95bf

make dist: Use fewer wildcards The remaining ones only work by accident: http://www.gnu.org/software/automake/manual/html_node/Wildcards.html and they have some practical problems too (we don?t really want to distribute include/urweb/config.h or src/config.sml), but this is enough for now to pass ?make distcheck? as long as we don?t run it from a separate build directory. Signed-off-by: Anders Kaseorg <andersk@mit.edu> --- Makefile.am | 6 +++--- src/c/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
author Anders Kaseorg <andersk@mit.edu>
date Fri, 22 Nov 2013 09:36:14 -0500
parents bb3fc575cfe7
children
line wrap: on
line source
con link :: (Type * Type) -> Type
val noParent : t ::: Type -> link (t, unit)

con meta = fn (col :: Type, parent :: Type) => {
	      Link : link (col, parent),
	      Inj : sql_injectable col
	      }

val local : t :: Type -> sql_injectable t -> meta (t, unit)

functor Table(M : sig
		  con cols :: {(Type * Type)}
		  val cols : $(map meta cols)
		  constraint [Id] ~ cols
		  val folder : folder cols
	      end) : sig
    type id
    type row' = $(map fst M.cols)
    type row = $([Id = id] ++ map fst M.cols)

    val inj : sql_injectable id
    val id : meta (id, row)

    val create : row' -> transaction row
    val delete : row -> transaction unit
    val save : row -> transaction unit
    val lookup : id -> transaction (option row)
    val list : transaction (list row)

    con col :: Type -> Type
    val idCol : col id
    val cols : $(map (fn (colm :: Type, parent :: Type) =>
                         {Col : col colm,
                          Parent : row -> transaction (option parent)}) M.cols)

    type filter
    val find : filter -> transaction (option row)
    val search : filter -> transaction (list row)

    val eq : t ::: Type -> col t -> t -> filter
    val ne : t ::: Type -> col t -> t -> filter
    val lt : t ::: Type -> col t -> t -> filter
    val le : t ::: Type -> col t -> t -> filter
    val gt : t ::: Type -> col t -> t -> filter
    val ge : t ::: Type -> col t -> t -> filter

    val _and : filter -> filter -> filter
    val or : filter -> filter -> filter
end