On 14 June 2010 17:14, Brenton <bashw...@gmail.com> wrote:
> The current version is what I would consider to be a working prototype
> and I would love to get feedback from the community before I do much
> more work on this.

I've been thinking about a similar problem.

Most database mappers have three components:

1. The model instance
2. The model collection
3. The model factory

I've been considering how to represent specific model instances in
Clojure. We probably expect a model instance to:

1. Locally cache its value
2. Be able to save changes on request
3. Be able to refresh itself on request

In Clojure, this might look something like:

user=> @user
Log: Fetching data from database
User{:login "jbloggs"}

user=> @user
User{:login "jbloggs"}

user=> (refresh user)
nil
user=> @user
Log: Fetching data from database
User{:login "jbloggs"}

user=> (update user assoc :name "Joe Bloggs")
User{:login "jbloggs", :name "Joe Bloggs"}

user=> (save user)
Log: Saving data to database
User{:login "jbloggs", :name "Joe Bloggs"}

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to