gorm/clause
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
..
benchmarks_test.go Refactor tests files 2020-06-02 10:50:38 +08:00
clause.go Refactor clauses 2020-06-06 22:52:08 +08:00
clause_test.go Refactor tests files 2020-06-02 10:50:38 +08:00
delete.go Refactor clause Writer 2020-03-09 17:07:00 +08:00
delete_test.go Rename package name 2020-06-02 09:18:01 +08:00
expression.go Add Scanner, Valuer tests 2020-05-30 21:05:27 +08:00
expression_test.go Refactor tests files 2020-06-02 10:50:38 +08:00
from.go Fix primary key tag 2020-03-12 08:39:42 +08:00
from_test.go Rename package name 2020-06-02 09:18:01 +08:00
group_by.go Fix Statement Where clone array corruption in v2 2020-06-07 16:54:01 -04:00
group_by_test.go Rename package name 2020-06-02 09:18:01 +08:00
insert.go Refactor clause Writer 2020-03-09 17:07:00 +08:00
insert_test.go Rename package name 2020-06-02 09:18:01 +08:00
joins.go Add joins support 2020-04-15 09:45:43 +08:00
limit.go Refactor clause Writer 2020-03-09 17:07:00 +08:00
limit_test.go Rename package name 2020-06-02 09:18:01 +08:00
locking.go Replace For with Locking 2020-06-06 21:35:28 +08:00
locking_test.go Refactor clauses 2020-06-06 22:52:08 +08:00
on_conflict.go Add OnConflict DoUpdates test 2020-06-07 12:50:00 +08:00
order_by.go Fix Statement Where clone array corruption in v2 2020-06-07 16:54:01 -04:00
order_by_test.go Rename package name 2020-06-02 09:18:01 +08:00
returning.go Finish clauses tests 2020-02-08 23:23:45 +08:00
returning_test.go Rename package name 2020-06-02 09:18:01 +08:00
select.go Add Distinct support 2020-06-05 19:19:12 +08:00
select_test.go Rename package name 2020-06-02 09:18:01 +08:00
set.go Fix Statement Where clone array corruption in v2 2020-06-07 16:54:01 -04:00
set_test.go Add convert map Assignments helper 2020-06-06 17:47:30 +08:00
update.go Refactor clause Writer 2020-03-09 17:07:00 +08:00
update_test.go Rename package name 2020-06-02 09:18:01 +08:00
values.go Add Count tests 2020-05-24 11:35:19 +08:00
values_test.go Rename package name 2020-06-02 09:18:01 +08:00
where.go Fix Statement Where clone array corruption in v2 2020-06-07 16:54:01 -04:00
where_test.go Refactor clauses 2020-06-06 22:52:08 +08:00
with.go Work on clauses 2020-02-02 19:11:17 +08:00