Commit Graph

10 Commits

Author SHA1 Message Date
chyroc e1f46eb802
fix: ignore nil query (#6021) 2023-02-02 17:54:51 +08:00
Shunsuke Otani 3f92b9b0df
Refactor: redundant type from composite literal (#5604) 2022-08-15 10:47:26 +08:00
Jinzhu cae30e9a50 Fix select with association column 2022-07-13 18:02:11 +08:00
Jinzhu a7063848ef Fix select with uppercase column name 2022-07-13 17:44:14 +08:00
Jinzhu 08f6d06e47 Fix select with quoted column name 2022-07-13 17:21:19 +08:00
Jinzhu a70af2a4c0 Fix Select with digits in column name 2022-06-20 15:35:40 +08:00
Jinzhu 6312d86c54 Support specify select/omit columns with table 2021-10-08 17:51:27 +08:00
Douglas Danger Manley 13f96f7a15
Spelling fix for "condtion" -> "condition" (#3042)
This fixes a spelling error in the word "condition"; in particular,
the `BuildCondtion` function should be named `BuildCondition`.
2020-06-08 11:38:51 +08:00
Jinzhu 8f8d549ca3 Refactor merge where exprs 2020-06-08 09:13:34 +08:00
Douglas Danger Manley 72d0fa6196 Fix Statement Where clone array corruption in v2
Method-chaining in gorm is predicated on a `Clause`'s `MergeClause`
method ensuring that the two clauses are disconnected in terms of
pointers (at least in the Wherec case).

However, the original Where implementation used `append`, which
only returns a new instance if the backing array needs to be resized.
In some cases, this is true.  Practically, go doubles the size of the
slice once it gets full, so the following slice `append` calls would
result in a new slice:

* 0 -> 1
* 1 -> 2
* 2 -> 4
* 4 -> 8
* and so on.

So, when the number of "where" conditions was 0, 1, 2, or 4, method-chaining
would work as expected.  However, when it was 3, 5, 6, or 7, modifying the
copy would modify the original.

This also updates the "order by", "group by" and "set" clauses.
2020-06-07 16:54:01 -04:00