[Ur] Advice on SQL tables needed

Artyom Shalkhakov artyom.shalkhakov at gmail.com
Wed Jan 20 04:35:52 EST 2010


Hello,

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.

Cheers,
Artyom Shalkhakov.



More information about the Ur mailing list