Bump readme version (and gen'd code)
This commit is contained in:
parent
9f20ade0fe
commit
63a079ca8d
2 changed files with 91 additions and 97 deletions
2
deps.edn
2
deps.edn
|
|
@ -16,7 +16,7 @@
|
||||||
"-d" "test"]}
|
"-d" "test"]}
|
||||||
:cljs-runner {:extra-deps {olical/cljs-test-runner {:mvn/version "3.7.0"}}
|
:cljs-runner {:extra-deps {olical/cljs-test-runner {:mvn/version "3.7.0"}}
|
||||||
:main-opts ["-m" "cljs-test-runner.main"]}
|
:main-opts ["-m" "cljs-test-runner.main"]}
|
||||||
:readme {:extra-deps {seancorfield/readme {:mvn/version "1.0.13"}}
|
:readme {:extra-deps {seancorfield/readme {:mvn/version "1.0.16"}}
|
||||||
:main-opts ["-m" "seancorfield.readme"]}
|
:main-opts ["-m" "seancorfield.readme"]}
|
||||||
:eastwood {:extra-deps {jonase/eastwood {:mvn/version "RELEASE"}}
|
:eastwood {:extra-deps {jonase/eastwood {:mvn/version "RELEASE"}}
|
||||||
:main-opts ["-m" "eastwood.lint" "{:source-paths,[\"src\"]}"]}
|
:main-opts ["-m" "eastwood.lint" "{:source-paths,[\"src\"]}"]}
|
||||||
|
|
|
||||||
186
src/readme.clj
186
src/readme.clj
|
|
@ -52,11 +52,23 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-55
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(seancorfield.readme/defreadme readme-67
|
||||||
(def q-sqlmap {:select [:foo/a :foo/b :foo/c]
|
(def q-sqlmap {:select [:foo/a :foo/b :foo/c]
|
||||||
:from [:foo]
|
:from [:foo]
|
||||||
:where [:= :foo/a "baz"]})
|
:where [:= :foo/a "baz"]})
|
||||||
(sql/format q-sqlmap :namespace-as-table? true)
|
(sql/format q-sqlmap)
|
||||||
=> ["SELECT foo.a, foo.b, foo.c FROM foo WHERE foo.a = ?" "baz"]
|
=> ["SELECT foo.a, foo.b, foo.c FROM foo WHERE foo.a = ?" "baz"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -66,35 +78,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(seancorfield.readme/defreadme readme-81
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-75
|
|
||||||
(sql/build :select :*
|
|
||||||
:from :foo
|
|
||||||
:where [:= :f.a "baz"])
|
|
||||||
=> {:where [:= :f.a "baz"], :from [:foo], :select [:*]}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-84
|
|
||||||
(sql/build sqlmap :offset 10 :limit 10)
|
|
||||||
=> {:limit 10
|
|
||||||
:offset 10
|
|
||||||
:select [:a :b :c]
|
|
||||||
:where [:= :f.a "baz"]
|
|
||||||
:from [:foo]}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-97
|
|
||||||
(-> (select :a :b :c)
|
(-> (select :a :b :c)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:= :f.a "baz"]))
|
(where [:= :f.a "baz"]))
|
||||||
|
|
@ -102,7 +86,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-105
|
(seancorfield.readme/defreadme readme-89
|
||||||
(= (-> (select :*) (from :foo))
|
(= (-> (select :*) (from :foo))
|
||||||
(-> (from :foo) (select :*)))
|
(-> (from :foo) (select :*)))
|
||||||
=> true
|
=> true
|
||||||
|
|
@ -110,40 +94,41 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-113
|
(seancorfield.readme/defreadme readme-97
|
||||||
(-> sqlmap (select :*))
|
(-> sqlmap (select :d))
|
||||||
=> '{:from [:foo], :where [:= :f.a "baz"], :select (:*)}
|
=> '{:from [:foo], :where [:= :f.a "baz"], :select [:a :b :c :d]}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-120
|
(seancorfield.readme/defreadme readme-104
|
||||||
(-> sqlmap
|
(-> sqlmap
|
||||||
(merge-select :d :e)
|
(dissoc :select)
|
||||||
(merge-where [:> :b 10])
|
(select :*)
|
||||||
|
(where [:> :b 10])
|
||||||
sql/format)
|
sql/format)
|
||||||
=> ["SELECT a, b, c, d, e FROM foo WHERE (f.a = ? AND b > ?)" "baz" 10]
|
=> ["SELECT * FROM foo WHERE (f.a = ?) AND (b > ?)" "baz" 10]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-130
|
(seancorfield.readme/defreadme readme-115
|
||||||
(-> (select :*)
|
(-> (select :*)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:= :a 1] [:< :b 100])
|
(where [:= :a 1] [:< :b 100])
|
||||||
sql/format)
|
sql/format)
|
||||||
=> ["SELECT * FROM foo WHERE (a = ? AND b < ?)" 1 100]
|
=> ["SELECT * FROM foo WHERE (a = ?) AND (b < ?)" 1 100]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-141
|
(seancorfield.readme/defreadme readme-126
|
||||||
(-> (select :a [:b :bar] :c [:d :x])
|
(-> (select :a [:b :bar] :c [:d :x])
|
||||||
(from [:foo :quux])
|
(from [:foo :quux])
|
||||||
(where [:= :quux.a 1] [:< :bar 100])
|
(where [:= :quux.a 1] [:< :bar 100])
|
||||||
sql/format)
|
sql/format)
|
||||||
=> ["SELECT a, b AS bar, c, d AS x FROM foo quux WHERE (quux.a = ? AND bar < ?)" 1 100]
|
=> ["SELECT a, b AS bar, c, d AS x FROM foo quux WHERE (quux.a = ?) AND (bar < ?)" 1 100]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -155,7 +140,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-158
|
(seancorfield.readme/defreadme readme-143
|
||||||
(-> (insert-into :properties)
|
(-> (insert-into :properties)
|
||||||
(columns :name :surname :age)
|
(columns :name :surname :age)
|
||||||
(values
|
(values
|
||||||
|
|
@ -173,7 +158,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-176
|
(seancorfield.readme/defreadme readme-161
|
||||||
(-> (insert-into :properties)
|
(-> (insert-into :properties)
|
||||||
(values [{:name "John" :surname "Smith" :age 34}
|
(values [{:name "John" :surname "Smith" :age 34}
|
||||||
{:name "Andrew" :surname "Cooper" :age 12}
|
{:name "Andrew" :surname "Cooper" :age 12}
|
||||||
|
|
@ -191,7 +176,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-194
|
(seancorfield.readme/defreadme readme-179
|
||||||
(let [user-id 12345
|
(let [user-id 12345
|
||||||
role-name "user"]
|
role-name "user"]
|
||||||
(-> (insert-into :user_profile_to_role)
|
(-> (insert-into :user_profile_to_role)
|
||||||
|
|
@ -208,7 +193,7 @@
|
||||||
"user"]
|
"user"]
|
||||||
)
|
)
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-211
|
(seancorfield.readme/defreadme readme-196
|
||||||
(-> (select :*)
|
(-> (select :*)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:in :foo.a (-> (select :a) (from :bar))])
|
(where [:in :foo.a (-> (select :a) (from :bar))])
|
||||||
|
|
@ -220,7 +205,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-223
|
(seancorfield.readme/defreadme readme-208
|
||||||
(-> (insert-into :comp_table)
|
(-> (insert-into :comp_table)
|
||||||
(columns :name :comp_column)
|
(columns :name :comp_column)
|
||||||
(values
|
(values
|
||||||
|
|
@ -238,7 +223,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-241
|
(seancorfield.readme/defreadme readme-226
|
||||||
(-> (helpers/update :films)
|
(-> (helpers/update :films)
|
||||||
(sset {:kind "dramatic"
|
(sset {:kind "dramatic"
|
||||||
:watched (sql/call :+ :watched 1)})
|
:watched (sql/call :+ :watched 1)})
|
||||||
|
|
@ -263,8 +248,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(seancorfield.readme/defreadme readme-251
|
||||||
(seancorfield.readme/defreadme readme-267
|
|
||||||
(-> (delete-from :films)
|
(-> (delete-from :films)
|
||||||
(where [:<> :kind "musical"])
|
(where [:<> :kind "musical"])
|
||||||
sql/format)
|
sql/format)
|
||||||
|
|
@ -273,7 +257,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-276
|
(seancorfield.readme/defreadme readme-260
|
||||||
(-> (delete [:films :directors])
|
(-> (delete [:films :directors])
|
||||||
(from :films)
|
(from :films)
|
||||||
(join :directors [:= :films.director_id :directors.id])
|
(join :directors [:= :films.director_id :directors.id])
|
||||||
|
|
@ -289,7 +273,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-292
|
(seancorfield.readme/defreadme readme-276
|
||||||
(-> (truncate :films)
|
(-> (truncate :films)
|
||||||
sql/format)
|
sql/format)
|
||||||
=> ["TRUNCATE films"]
|
=> ["TRUNCATE films"]
|
||||||
|
|
@ -299,7 +283,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-302
|
(seancorfield.readme/defreadme readme-286
|
||||||
(sql/format {:union [(-> (select :*) (from :foo))
|
(sql/format {:union [(-> (select :*) (from :foo))
|
||||||
(-> (select :*) (from :bar))]})
|
(-> (select :*) (from :bar))]})
|
||||||
=> ["SELECT * FROM foo UNION SELECT * FROM bar"]
|
=> ["SELECT * FROM foo UNION SELECT * FROM bar"]
|
||||||
|
|
@ -309,11 +293,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-312
|
(seancorfield.readme/defreadme readme-296
|
||||||
(-> (select :%count.*) (from :foo) sql/format)
|
(-> (select :%count.*) (from :foo) sql/format)
|
||||||
=> ["SELECT count(*) FROM foo"]
|
=> ["SELECT count(*) FROM foo"]
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-316
|
(seancorfield.readme/defreadme readme-300
|
||||||
(-> (select :%max.id) (from :foo) sql/format)
|
(-> (select :%max.id) (from :foo) sql/format)
|
||||||
=> ["SELECT max(id) FROM foo"]
|
=> ["SELECT max(id) FROM foo"]
|
||||||
)
|
)
|
||||||
|
|
@ -322,7 +306,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-325
|
|
||||||
|
|
||||||
|
(seancorfield.readme/defreadme readme-311
|
||||||
(-> (select :id)
|
(-> (select :id)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:= :a :?baz])
|
(where [:= :a :?baz])
|
||||||
|
|
@ -335,21 +321,21 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-338
|
(seancorfield.readme/defreadme readme-324
|
||||||
(def call-qualify-map
|
(def call-qualify-map
|
||||||
(-> (select (sql/call :foo :bar) (sql/qualify :foo :a) (sql/raw "@var := foo.bar"))
|
(-> (select [[:foo :bar]] [[:raw "@var := foo.bar"]])
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:= :a (sql/param :baz)] [:= :b (sql/inline 42)])))
|
(where [:= :a (???/param :baz)] [:= :b [:inline 42]])))
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-344
|
(seancorfield.readme/defreadme readme-330
|
||||||
call-qualify-map
|
call-qualify-map
|
||||||
=> '{:where [:and [:= :a #sql/param :baz] [:= :b #sql/inline 42]]
|
=> '{:where [:and [:= :a ???/param :baz] [:= :b [:inline 42]]]
|
||||||
:from (:foo)
|
:from (:foo)
|
||||||
:select (#sql/call [:foo :bar] :foo.a #sql/raw "@var := foo.bar")}
|
:select [[[:foo :bar]] [[:raw "@var := foo.bar"]]]}
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-350
|
(seancorfield.readme/defreadme readme-336
|
||||||
(sql/format call-qualify-map :params {:baz "BAZ"})
|
(sql/format call-qualify-map :??? {:baz "BAZ"})
|
||||||
=> ["SELECT foo(bar), foo.a, @var := foo.bar FROM foo WHERE (a = ? AND b = 42)" "BAZ"]
|
=> ["SELECT foo(bar), @var := foo.bar FROM foo WHERE (a = ?) AND (b = 42)" "BAZ"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -357,11 +343,11 @@ call-qualify-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-360
|
(seancorfield.readme/defreadme readme-346
|
||||||
(-> (insert-into :sample)
|
(-> (insert-into :sample)
|
||||||
(values [{:location (sql/call :ST_SetSRID
|
(values [{:location [:ST_SetSRID
|
||||||
(sql/call :ST_MakePoint 0.291 32.621)
|
[:ST_MakePoint 0.291 32.621]
|
||||||
(sql/call :cast 4326 :integer))}])
|
[:cast 4325 :integer]]}])
|
||||||
(sql/format))
|
(sql/format))
|
||||||
=> [#sql/regularize
|
=> [#sql/regularize
|
||||||
"INSERT INTO sample (location)
|
"INSERT INTO sample (location)
|
||||||
|
|
@ -380,7 +366,9 @@ call-qualify-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-383
|
|
||||||
|
|
||||||
|
(seancorfield.readme/defreadme readme-371
|
||||||
(-> (select :*)
|
(-> (select :*)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:< :expired_at (sql/raw ["now() - '" 5 " seconds'"])])
|
(where [:< :expired_at (sql/raw ["now() - '" 5 " seconds'"])])
|
||||||
|
|
@ -388,7 +376,7 @@ call-qualify-map
|
||||||
=> ["SELECT * FROM foo WHERE expired_at < now() - '? seconds'" 5]
|
=> ["SELECT * FROM foo WHERE expired_at < now() - '? seconds'" 5]
|
||||||
)
|
)
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-391
|
(seancorfield.readme/defreadme readme-379
|
||||||
(-> (select :*)
|
(-> (select :*)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:< :expired_at (sql/raw ["now() - '" #sql/param :t " seconds'"])])
|
(where [:< :expired_at (sql/raw ["now() - '" #sql/param :t " seconds'"])])
|
||||||
|
|
@ -400,11 +388,16 @@ call-qualify-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-403
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(seancorfield.readme/defreadme readme-396
|
||||||
(-> (select :foo.a)
|
(-> (select :foo.a)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:= :foo.a "baz"])
|
(where [:= :foo.a "baz"])
|
||||||
(sql/format :quoting :mysql))
|
(sql/format {:dialect :mysql}))
|
||||||
=> ["SELECT `foo`.`a` FROM `foo` WHERE `foo`.`a` = ?" "baz"]
|
=> ["SELECT `foo`.`a` FROM `foo` WHERE `foo`.`a` = ?" "baz"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -414,7 +407,9 @@ call-qualify-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-417
|
|
||||||
|
|
||||||
|
(seancorfield.readme/defreadme readme-412
|
||||||
(-> (select :foo.a)
|
(-> (select :foo.a)
|
||||||
(from :foo)
|
(from :foo)
|
||||||
(where [:= :foo.a "baz"])
|
(where [:= :foo.a "baz"])
|
||||||
|
|
@ -426,7 +421,7 @@ call-qualify-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-429
|
(seancorfield.readme/defreadme readme-424
|
||||||
(sql/format
|
(sql/format
|
||||||
{:select [:f.foo-id :f.foo-name]
|
{:select [:f.foo-id :f.foo-name]
|
||||||
:from [[:foo-bar :f]]
|
:from [[:foo-bar :f]]
|
||||||
|
|
@ -440,19 +435,19 @@ call-qualify-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-443
|
(seancorfield.readme/defreadme readme-438
|
||||||
(def big-complicated-map
|
(def big-complicated-map
|
||||||
(-> (select :f.* :b.baz :c.quux [:b.bla "bla-bla"]
|
(-> (select :f.* :b.baz :c.quux [:b.bla "bla-bla"]
|
||||||
(sql/call :now) (sql/raw "@x := 10"))
|
[[:now]] [[:raw "@x := 10"]])
|
||||||
(modifiers :distinct)
|
(modifiers :distinct) ; this is not implemented yet
|
||||||
(from [:foo :f] [:baz :b])
|
(from [:foo :f] [:baz :b])
|
||||||
(join :draq [:= :f.b :draq.x])
|
(join :draq [:= :f.b :draq.x])
|
||||||
(left-join [:clod :c] [:= :f.a :c.d])
|
(left-join [:clod :c] [:= :f.a :c.d])
|
||||||
(right-join :bock [:= :bock.z :c.e])
|
(right-join :bock [:= :bock.z :c.e])
|
||||||
(where [:or
|
(where [:or
|
||||||
[:and [:= :f.a "bort"] [:not= :b.baz (sql/param :param1)]]
|
[:and [:= :f.a "bort"] [:not= :b.baz (???/param :param1)]]
|
||||||
[:< 1 2 3]
|
[:< 1 2 3]
|
||||||
[:in :f.e [1 (sql/param :param2) 3]]
|
[:in :f.e [1 (???/param :param2) 3]]
|
||||||
[:between :f.e 10 20]])
|
[:between :f.e 10 20]])
|
||||||
(group :f.a :c.e)
|
(group :f.a :c.e)
|
||||||
(having [:< 0 :f.e])
|
(having [:< 0 :f.e])
|
||||||
|
|
@ -460,19 +455,19 @@ call-qualify-map
|
||||||
(limit 50)
|
(limit 50)
|
||||||
(offset 10)))
|
(offset 10)))
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-463
|
(seancorfield.readme/defreadme readme-458
|
||||||
big-complicated-map
|
big-complicated-map
|
||||||
=> {:select [:f.* :b.baz :c.quux [:b.bla "bla-bla"]
|
=> {:select [:f.* :b.baz :c.quux [:b.bla "bla-bla"]
|
||||||
(sql/call :now) (sql/raw "@x := 10")]
|
[[:now]] [[:raw "@x := 10"]]]
|
||||||
:modifiers [:distinct]
|
:modifiers [:distinct]
|
||||||
:from [[:foo :f] [:baz :b]]
|
:from [[:foo :f] [:baz :b]]
|
||||||
:join [:draq [:= :f.b :draq.x]]
|
:join [:draq [:= :f.b :draq.x]]
|
||||||
:left-join [[:clod :c] [:= :f.a :c.d]]
|
:left-join [[:clod :c] [:= :f.a :c.d]]
|
||||||
:right-join [:bock [:= :bock.z :c.e]]
|
:right-join [:bock [:= :bock.z :c.e]]
|
||||||
:where [:or
|
:where [:or
|
||||||
[:and [:= :f.a "bort"] [:not= :b.baz (sql/param :param1)]]
|
[:and [:= :f.a "bort"] [:not= :b.baz (???/param :param1)]]
|
||||||
[:< 1 2 3]
|
[:< 1 2 3]
|
||||||
[:in :f.e [1 (sql/param :param2) 3]]
|
[:in :f.e [1 (????/param :param2) 3]]
|
||||||
[:between :f.e 10 20]]
|
[:between :f.e 10 20]]
|
||||||
:group-by [:f.a :c.e]
|
:group-by [:f.a :c.e]
|
||||||
:having [:< 0 :f.e]
|
:having [:< 0 :f.e]
|
||||||
|
|
@ -480,7 +475,7 @@ big-complicated-map
|
||||||
:limit 50
|
:limit 50
|
||||||
:offset 10}
|
:offset 10}
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-483
|
(seancorfield.readme/defreadme readme-478
|
||||||
(sql/format big-complicated-map {:param1 "gabba" :param2 2})
|
(sql/format big-complicated-map {:param1 "gabba" :param2 2})
|
||||||
=> [#sql/regularize
|
=> [#sql/regularize
|
||||||
"SELECT DISTINCT f.*, b.baz, c.quux, b.bla AS bla_bla, now(), @x := 10
|
"SELECT DISTINCT f.*, b.baz, c.quux, b.bla AS bla_bla, now(), @x := 10
|
||||||
|
|
@ -499,7 +494,7 @@ big-complicated-map
|
||||||
OFFSET ? "
|
OFFSET ? "
|
||||||
"bort" "gabba" 1 2 2 3 1 2 3 10 20 0 50 10]
|
"bort" "gabba" 1 2 2 3 1 2 3 10 20 0 50 10]
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-502
|
(seancorfield.readme/defreadme readme-497
|
||||||
;; Printable and readable
|
;; Printable and readable
|
||||||
(= big-complicated-map (read-string (pr-str big-complicated-map)))
|
(= big-complicated-map (read-string (pr-str big-complicated-map)))
|
||||||
=> true
|
=> true
|
||||||
|
|
@ -509,10 +504,9 @@ big-complicated-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-512
|
|
||||||
(require '[honeysql.format :as fmt])
|
|
||||||
)
|
(seancorfield.readme/defreadme readme-509
|
||||||
(seancorfield.readme/defreadme readme-515
|
|
||||||
(defmethod fmt/fn-handler "betwixt" [_ field lower upper]
|
(defmethod fmt/fn-handler "betwixt" [_ field lower upper]
|
||||||
(str (fmt/to-sql field) " BETWIXT "
|
(str (fmt/to-sql field) " BETWIXT "
|
||||||
(fmt/to-sql lower) " AND " (fmt/to-sql upper)))
|
(fmt/to-sql lower) " AND " (fmt/to-sql upper)))
|
||||||
|
|
@ -523,23 +517,23 @@ big-complicated-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-526
|
(seancorfield.readme/defreadme readme-520
|
||||||
;; Takes a MapEntry of the operator & clause data, plus the entire SQL map
|
;; Takes a MapEntry of the operator & clause data, plus the entire SQL map
|
||||||
(defmethod fmt/format-clause :foobar [[op v] sqlmap]
|
(defmethod fmt/format-clause :foobar [[op v] sqlmap]
|
||||||
(str "FOOBAR " (fmt/to-sql v)))
|
(str "FOOBAR " (fmt/to-sql v)))
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-531
|
(seancorfield.readme/defreadme readme-525
|
||||||
(sql/format {:select [:a :b] :foobar :baz})
|
(sql/format {:select [:a :b] :foobar :baz})
|
||||||
=> ["SELECT a, b FOOBAR baz"]
|
=> ["SELECT a, b FOOBAR baz"]
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-535
|
(seancorfield.readme/defreadme readme-529
|
||||||
(require '[honeysql.helpers :refer [defhelper]])
|
(require '[honeysql.helpers :refer [defhelper]])
|
||||||
|
|
||||||
;; Defines a helper function, and allows 'build' to recognize your clause
|
;; Defines a helper function, and allows 'build' to recognize your clause
|
||||||
(defhelper foobar [m args]
|
(defhelper foobar [m args]
|
||||||
(assoc m :foobar (first args)))
|
(assoc m :foobar (first args)))
|
||||||
)
|
)
|
||||||
(seancorfield.readme/defreadme readme-542
|
(seancorfield.readme/defreadme readme-536
|
||||||
(-> (select :a :b) (foobar :baz) sql/format)
|
(-> (select :a :b) (foobar :baz) sql/format)
|
||||||
=> ["SELECT a, b FOOBAR baz"]
|
=> ["SELECT a, b FOOBAR baz"]
|
||||||
|
|
||||||
|
|
@ -547,7 +541,7 @@ big-complicated-map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(seancorfield.readme/defreadme readme-550
|
(seancorfield.readme/defreadme readme-544
|
||||||
(fmt/register-clause! :foobar 110)
|
(fmt/register-clause! :foobar 110)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue