Forgot the link:  https://gist.github.com/846363


> If you have time, I posted a gist containing a data access library I built
> on top of Rich's sdb library (data.clj), and the modifications I made to his
> sdb library (sdb.clj) for consistent reads, etc.  This is some of the first
> real clojure code I wrote, so not the prettiest, but maybe you can see some
> of the pain points I had using the current sdb library.
>
> To summarize:
>
>  - Whether or not to add asynchronous client support
>  - Not a nice generic way of building up select dsl maps
>  - I believe the select dsl 'where' clause only handles up to two
> predicates
>  - How to account for nil / blank values
>  - Automatically sync domains with a specified list
>
> Certainly some of this belongs above the level of the sdb library, but some
> of it should be handled there.
>
>  - Mark
>
>
> On Sun, Feb 27, 2011 at 9:15 AM, Gijs S. <gijsstuur...@gmail.com> wrote:
>
>> Yes, my suggestion without type indicators in SDB would look something
>> like this:
>>
>> (def config {:sdb-client (AmazonSimpleDBClient. ...)
>>             :mapping {"Link" {"url" {:encode encode-string :decode
>> decode-string}
>>                               "points" sdb/integer-encoding
>>                               "date" {:encode encode-jodadate :decode
>> decode-jodadate}}
>>                       "AnotherDomain" {...}})
>>
>> sdb/integer-encoding would be a library provided encoding/decoding
>> map.
>>
>> In this approach each encoding/decoding pair is defined at the level
>> of an attribute in a domain.
>>
>> A (get-attr config "Link" "id") will go through the mapping in the
>> config to create a clojure datastructure with each attr properly
>> decoded.
>>
>> A mapping map would allow for a bit more composition then one big
>> encode fn in the config where a case construct needs to be extended
>> for each attribute. For instance the mapping could be constructed like
>> this: {:mapping (merge link-domain-map another-domain-map ...)}.
>> Perhaps a library could provide a macro that expands (defdomain Link
>> [url :string, point :int, date {:encode .. :decode ..}]) into such a
>> mapping map.
>>
>> Because this approach doesn't have any type indicators in SDB, every
>> attribute needs to have an encoding/decoding defined or there needs to
>> be a default encode/decoding, which for Clojure could be print-string/
>> read-string.
>>
>> -Gijs
>>
>> --
>> 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
>>
>
>

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