Commit Graph

40 Commits

Author SHA1 Message Date
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
Jinzhu 82d55b1054 Add OnConflict DoUpdates test 2020-06-07 12:50:00 +08:00
Jinzhu 6937d713c3 Refactor clauses 2020-06-06 22:52:08 +08:00
Jinzhu 38d1cd2bf1 Replace For with Locking 2020-06-06 21:35:28 +08:00
Jinzhu 52b763aab3 Add convert map Assignments helper 2020-06-06 17:47:30 +08:00
Jinzhu eda2f023b0 Add Distinct support 2020-06-05 19:19:12 +08:00
Jinzhu 8bb05a5a69 Refactor tests files 2020-06-02 10:50:38 +08:00
Jinzhu e986371a42 Rename package name 2020-06-02 09:18:01 +08:00
Jinzhu 7b6b9c4d22 Add tests for Columns 2020-05-31 00:42:52 +08:00
Jinzhu c291c2f42c Add Scanner, Valuer tests 2020-05-30 21:05:27 +08:00
Jinzhu c422d75f4b Add Scopes tests 2020-05-30 19:43:29 +08:00
Jinzhu d05128be78 OnConflict support for mysql 2020-05-29 22:34:35 +08:00
Jinzhu ac8708b500 Add FirstOrInit support 2020-05-28 13:12:56 +08:00
Jinzhu cc064f26ee Add on conflict support 2020-05-25 23:11:42 +08:00
Jinzhu 68a7a8207a Test HasOne Association 2020-05-24 23:07:42 +08:00
Jinzhu cbc4a81140 Add Count tests 2020-05-24 11:35:19 +08:00
Jinzhu 50aa9be4f1 Add joins support 2020-04-15 09:45:43 +08:00
Jinzhu af080e6773 Fix primary key tag 2020-03-12 08:39:42 +08:00
Jinzhu 504f42760a Refactor clause Writer 2020-03-09 17:07:00 +08:00
Jinzhu 5fce17543a Add Joins 2020-03-08 19:12:33 +08:00
Jinzhu a158d1ada0 Add GroupBy test 2020-03-08 18:05:22 +08:00
Jinzhu cbd55dbcd5 Add Update test 2020-03-07 15:20:09 +08:00
Jinzhu 0c34123796 Add Limit, Offset 2020-03-04 23:56:42 +08:00
Jinzhu 9fcc546a69 Fix tests 2020-02-26 19:06:42 +08:00
Jinzhu e2a360b9fa Add Before/After callbacks 2020-02-23 21:22:35 +08:00
Jinzhu 6d58b62fd4 Add sqlite migration tests 2020-02-22 20:57:29 +08:00
Jinzhu 0be4817ff9 Finish CreateConstraint 2020-02-22 11:15:51 +08:00
Jinzhu 15ce5b3cdd Add create value converter 2020-02-20 10:12:10 +08:00
Jinzhu 98ad29f2c2 Add Selects, Omits for statement 2020-02-16 13:45:27 +08:00
Jinzhu c1afe19728 Add benchmark tests for clause 2020-02-14 00:09:44 +08:00
Jinzhu 1f38ec4410 Finish clauses tests 2020-02-08 23:23:45 +08:00
Jinzhu 0160bab7dc Add clause tests 2020-02-05 18:28:58 +08:00
Jinzhu 9d19be0826 Setup clauses tests 2020-02-04 09:51:19 +08:00
Jinzhu 46b1c85f88 Add more clauses 2020-02-04 08:56:15 +08:00
Jinzhu d52ee0aa44 Work on create callbacks 2020-02-03 10:40:03 +08:00
Jinzhu d833efe8b9 Work on clauses 2020-02-02 19:11:17 +08:00
Jinzhu eea78f3f30 Implement parse relationship architecture 2020-02-01 12:46:52 +08:00
Jinzhu 9d5b9834d9 Refactor builder 2020-01-30 19:47:00 +08:00
Jinzhu 85bfd175c6 Implement build conditions 2020-01-30 03:03:06 +08:00
Jinzhu b9cce2be6a Add clause, DB API, model definition 2020-01-29 19:22:44 +08:00