pingles/clj-hector — pull request #12 by nickmbailey (2011-12-22 00:05:14+00:00)
Title: Refactor of the schema macros as well as unification of the 'put' functi...

This pull request does a few things.

* It unifies the 'put' functions. 'put-counter' no longer exists. Instead you can either add a ':counter true' option to the call to put, or you can use the with-schema macro to indicate that the cf is a counter cf to avoid the extra args.
* It also modifes the behavior of the put function in regards to super columns. Before if the value was a map, then it was considered a super column. Now you still pass the values the same but you also need to pass ':type :super' as an argument (or use the with-schema macro). The main reasoning behind this is custom serializers. We implement a custom serializer that turns a clojure map into a custom byte array format. That wouldn't work with the previous implementation. The new implementaiton also leaves room to more easily add composite column support.
* Removed the defschema macro since it was simply creating a map. Now users will create a regular clojure map representing their schema and pass that to with-schemas. Also, the put function now respects things set using the with-schema macro.

Mostly this sets up the client as having the 'with-schema' approach being the preferred way to interact with cassandra, although you can do without it. I think this approach will allow for more unification of the different methods (super, counter, regular) and a better experience from the client. Also at some point some intelligent detection of default schema options can be done based on comparator, default_validation, sub_comparator, etc options.