summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@clearboxsystems.com.au>2013-09-30 01:26:39 +1000
committerCarlo Zancanaro <carlo@clearboxsystems.com.au>2013-09-30 01:26:39 +1000
commit9c6b9219eef5c197d920d094f762c8ae0a794de9 (patch)
tree207afb1e96eaf1b7ab726dd5a3b99623361ab6e8
parente77814f7d117f9f5315d65a48a854e0128111bfc (diff)
Fix an example in the README, and add some expected generated SQL
-rw-r--r--README.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/README.md b/README.md
index e0cf7e7..2a283f7 100644
--- a/README.md
+++ b/README.md
@@ -122,10 +122,14 @@ The primary operations available in `clojure-sql` are the following:
:::clojure
(s/join (-> (s/table :users)
- (s/project [:id :username :person,id]))
+ (s/project {:id :id, :username :username, :person :person.id}))
(-> (s/table :people)
(s/project [:id :name])
(s/rename (s/as-subobject :person))))
+ ;; => ["SELECT \"users2834\".\"id\" AS \"id\", \"users2834\".\"person\" AS \"person.id\",
+ \"table2836\".\"name\" AS \"person.name\", \"users2834\".\"username\" AS \"username\"
+ FROM (\"users\" AS \"users2834\" INNER JOIN \"people\" AS \"table2836\"
+ ON (\"users2834\".\"person\" = \"table2836\".\"id\"))"]
With joins the composability of `clojure-sql` becomes much more
useful: