Thanks very much for the feedback!

On Feb 27, 2011, at 5:59 AM, Gijs S. wrote:

> To talk in terms of entities is perhaps too much structure for the
> simpledb.

I would agree -- although if the data one is storing in SDB is regular enough, 
you should be able to build ORM-esque functionality on top of the approach I'm 
proposing.

> I would suggest a way to define serialization and
> deserialization per attribute per domain in code. This would mean that
> there is no encoding of the type of an attribute in its name or value
> in the storage. get-attr and put-attr take the domain as an argument,
> which can be used to lookup the proper serialization and
> deserialization function per attribute.
> 
> This approach would do away with storing type information into
> simpledb. It is also possible to provide this functionality on top of
> the existing simpledb library or the library with the suggested
> improvements.

If I'm understanding you properly, you could build this on top of the 
:encode/:decode functions in the configuration object as well.  I've added this 
example to the design notes:

Or, if you wanted to avoid storing any type indicators in SDB, you could 
explicitly map formats to attribute names (which would then be used on a 
per-domain basis):

(def config {:sdb-client (AmazonSimpleDBClient. …)
            :encode (fn [[k v]]
                      [(str k)
                       (case k
                         (:mls :asking-price) (encode-integer v)
                         (:address :agent-name) (str v)
                         :listing-date (encode-date v)
                         (str v))])
            :decode …})

If the above is common usage, a helper function that takes a simple map of 
attribute names -> value types and returns a corresponding configuration object 
would be nice.

Is that what you were describing?

- Chas

-- 
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