Douglas Danger Manley 2879c7e762 Issue #3007: Fix search clone array corruption
Method-chaining in gorm is predicated on `search`'s `clone` method
returning a copy of the `search` instance such that no change that
is made to the copy affects the original.

However, the original implementation copied the slices of the various
slice properties (such as `whereConditions`), with the incorrect
understanding that `append` would create a new slice each time that
it was called.  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 (or any other slice
property) 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.

The solution is simply to create new slices in `clone`.
2020-05-07 16:54:33 -04:00
2018-02-10 13:55:11 +08:00
2019-05-02 22:49:30 +08:00
2018-11-03 21:55:52 +08:00
2019-12-05 23:13:54 +08:00
2019-11-27 11:21:05 +09:00
2018-02-10 11:07:07 +08:00
2020-01-26 23:28:32 +08:00
2020-01-26 23:28:32 +08:00
2015-01-05 08:59:18 +08:00
2016-03-08 22:00:15 +08:00
2016-01-15 21:16:48 +08:00
2019-04-14 12:30:11 +04:00
2019-11-27 11:21:05 +09:00
2019-05-05 16:23:52 +08:00
2017-03-22 23:50:42 +08:00

GORM

The fantastic ORM library for Golang, aims to be developer friendly.

go report card wercker status codecov Join the chat at https://gitter.im/jinzhu/gorm Open Collective Backer Open Collective Sponsor MIT license GoDoc

Overview

  • Full-Featured ORM (almost)
  • Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism)
  • Hooks (Before/After Create/Save/Update/Delete/Find)
  • Preloading (eager loading)
  • Transactions
  • Composite Primary Key
  • SQL Builder
  • Auto Migrations
  • Logger
  • Extendable, write Plugins based on GORM callbacks
  • Every feature comes with tests
  • Developer Friendly

Getting Started

Contributing

You can help to deliver a better GORM, check out things you can do

License

© Jinzhu, 2013~time.Now

Released under the MIT License

Description
The fantastic ORM library for Golang, aims to be developer friendly
Readme
Languages
Go 99.9%
Shell 0.1%