mirror of https://github.com/go-gorm/gorm.git
72d0fa6196
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. |
||
---|---|---|
.. | ||
benchmarks_test.go | ||
clause.go | ||
clause_test.go | ||
delete.go | ||
delete_test.go | ||
expression.go | ||
expression_test.go | ||
from.go | ||
from_test.go | ||
group_by.go | ||
group_by_test.go | ||
insert.go | ||
insert_test.go | ||
joins.go | ||
limit.go | ||
limit_test.go | ||
locking.go | ||
locking_test.go | ||
on_conflict.go | ||
order_by.go | ||
order_by_test.go | ||
returning.go | ||
returning_test.go | ||
select.go | ||
select_test.go | ||
set.go | ||
set_test.go | ||
update.go | ||
update_test.go | ||
values.go | ||
values_test.go | ||
where.go | ||
where_test.go | ||
with.go |