Hello Alexander, I did some work in this area some time ago, and the result was service-hub library <https://github.com/ITEdge/service-hub> - created to simplify basic CRUD services. It's designed to allow more then one type of data-store, currently it supports SQL databases (i use my own fork of korma here), simple in-memory data-stores and datomic. I built it around a set of "handler" protocols which define what basic and more advanced data-store implementations can do, you can see those here<https://github.com/ITEdge/service-hub/blob/master/core/src/itedge/service_hub/core/handlers.clj> . Furthermore, the library tries to also simplify validations, authorizations and wrapping those ready-to-be-exposed-to-outer-world services behind another set of "services" protocols, see here<https://github.com/ITEdge/service-hub/blob/master/core/src/itedge/service_hub/core/services.clj> . You can then simply use library web layer to automatically expose those instances over web via ring & compojure libraries. Regarding translating requests maps to data-structures for data-store implementations, see for example korma util namespace<https://github.com/ITEdge/service-hub/blob/master/persistence-korma/src/itedge/service_hub/persistence_korma/util.clj> or datomic util namespace<https://github.com/ITEdge/service-hub/blob/master/persistence-datomic/src/itedge/service_hub/persistence_datomic/util.clj> . There are also some examples of such CRUD based web-services in project service-hub-examples <https://github.com/ITEdge/service-hub-examples>.
I hope it will help you, or at least provides some clues Dňa pondelok, 13. januára 2014 3:25:40 UTC+1 Alexandr Kurilin napísal(-a): > > I'm investigating adding query options to my Ring app's GET requests for > the more boring CRUD routes. > > I'd like to allow the caller to specify a set of SQL-level query > customizations such as sorting, paging, counting, distinct ons, limits, > some basic constraints etc. across all of my resources, ideally in such a > way that I only have to write this once and it will magically "just work" > across the board. > > First of all, there's the hard question of elegantly designing the API > itself and how a caller will be able to specify query details. I have some > experience with how Parse.com does this with their JSON requests (they > pretty much allow you to specify the whole query in there), but I've heard > Stack Overflow's and Elastic Search's APIs mentioned as good examples as > well. Any other ones you'd recommend? > > Second, there's the whole business of translating those maps into > requests. As far as I can tell, Korma is the right fit here, but I might be > also missing out on another good SQL-generation library that I should know > of, something I might integrate directly with clojure.jdbc. This doesn't > sound like an unsolved problem. > > Folks, I could use words of wisdom on the subject. Have you done this kind > of work on your APIs before? What did you use for reference? Anything > clojure-specific I could leverage here to make it as elegant and concise as > possible? > > Cheers! > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.