view 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
line wrap: on
line source
con link :: Type -> Type

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

functor Table(M : sig
		  con cols :: {Type}
		  val cols : $(map meta cols)
		  constraint [Id] ~ cols
		  val folder : folder cols
	      end) : sig
    type id
    val inj : sql_injectable id
    val id : meta id

    type row = $([Id = id] ++ M.cols)

    val create : $M.cols -> transaction row
    val delete : row -> transaction unit
    val save : row -> transaction unit
    val lookup : id -> transaction (option row)
    val list : transaction (list row)
end