Artyom Shalkhakov wrote:
Having written a bit more of my application, I encountered a pattern
which I'd rather abstract away, but don't know how.

In my case, there are about four tables, each of which is equipped
essentially the same code (namely, CRUD operations). What I'd like is
to provide such table to a parameterized module, which would give me
the following functions:

val create: row' ->  transaction row
val read: id ->  transaction (option row)
val update: row ->  transaction unit
val delete: row ->  transaction unit

(here, row' would be the schema of the table without the primary key,
whereas row would contain the primary key -- here, the primary key
would be a simple auto-incrementing integer)

I've studied the samples (orm and crud), but one of them unnecessarily
ties UI to the table structure, and another tries to abstract tables
away, which I don't want to do.

I would do this with a functor much like that of the Orm1 demo, but accepting the table as a value within the functor's input module.

_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to