Skip to content

Commit

Permalink
fix #52
Browse files Browse the repository at this point in the history
Changed dec-by to use remove-tail (`counterfield = counterfield - x`
instead of `counterfield = x - counterfield`)
  • Loading branch information
JanDornbusch committed Sep 15, 2018
1 parent dd96676 commit 212fbd1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.0.2

* Changed dec-by to use remove-tail (`counterfield = counterfield - x` instead of `counterfield = x - counterfield`)

## 4.0.0-beta*

* Internals changes that should make query generation 2x 3x faster and
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject cc.qbits/hayt "4.0.1"
(defproject cc.qbits/hayt "4.0.2"
:description "CQL Query Generation"
:url "https://github.com/mpenet/hayt"
:license {:name "Eclipse Public License"
Expand Down
2 changes: 1 addition & 1 deletion src/clj/qbits/hayt/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ex: (select :foo (where [[contains :foo ...]]]))"

(def dec-by
"Decrement counter by x, usable in `values` and `set-columns`"
remove-head)
remove-tail)

(def prepend
"Prepend element to List"
Expand Down
13 changes: 12 additions & 1 deletion test/qbits/hayt/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,18 @@
"UPDATE foo SET baz = ['prepended'] + baz WHERE foo = 'bar';"
(update :foo
(set-columns {:baz [["prepended"] +]})
(where [[:foo "bar"]]))))
(where [[:foo "bar"]]))

"UPDATE foo SET baz = baz + 1 WHERE foo = 'bar';"
(update :foo
(set-columns {:baz (inc-by 1)})
(where [[:foo "bar"]]))

"UPDATE foo SET baz = baz - 1 WHERE foo = 'bar';"
(update :foo
(set-columns {:baz (dec-by 1)})
(where [[:foo "bar"]]))
))

(deftest test-delete

Expand Down

0 comments on commit 212fbd1

Please sign in to comment.