From fe1561e35517fe683711b132f2dd7526e0858065 Mon Sep 17 00:00:00 2001 From: Justin Kramer Date: Fri, 13 Jul 2012 13:13:37 -0400 Subject: [PATCH] readme tweaks --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f7a5c67..e4c3e68 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ Everything is built on top of maps representing SQL queries: :where [:= :f.a "baz"]}) ``` -`format-sql` turns maps into `clojure.java.jdbc`-compatible, parameterized SQL: +`format` turns maps into `clojure.java.jdbc`-compatible, parameterized SQL: ```clj (sql/format sqlmap) => ["SELECT a, b, c FROM foo WHERE (f.a = ?)" ["baz"]] ``` -There are helper functions to build SQL maps. They compose together nicely. +There are helper functions to build SQL maps. They compose together nicely: ```clj (-> (select :a :b :c) @@ -37,7 +37,7 @@ There are helper functions to build SQL maps. They compose together nicely. (where [:= :f.a "baz"])) ``` -Order doesn't matter. +Order doesn't matter: ```clj (= (-> (select :*) (from :foo)) @@ -45,14 +45,14 @@ Order doesn't matter. => true ``` -When using the vanilla helper functions, new clauses will replace old clauses. +When using the vanilla helper functions, new clauses will replace old clauses: ```clj (-> sqlmap (select :*)) => {:from [:foo], :where [:= :f.a "baz"], :select (:*)} ``` -To add to clauses instead of replacing them, use `merge-select`, `merge-where`, etc. +To add to clauses instead of replacing them, use `merge-select`, `merge-where`, etc.: ```clj (sql/format @@ -106,7 +106,7 @@ Here's a big, complicated query. (Note that Honey SQL makes no attempt to verify => ["SELECT DISTINCT f.*, b.baz, c.quux, NOW(), @x := 10 FROM foo AS f, baz AS b LEFT JOIN clod AS c ON (f.a = c.d) JOIN draq ON (f.b = draq.x) WHERE (((f.a = ?) AND (b.baz != ?)) OR (f.e IN (1, 2, 3)) OR f.e BETWEEN 10 AND 20) ORDER BY b.baz DESC, c.quux LIMIT 50 OFFSET 10" ["bort" "gabba"]] -;; Fully readable +;; Printable and readable (= *2 (read-string (pr-str *2))) => true ```