forked from mirror/gorm
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. |
||
---|---|---|
.github | ||
callbacks | ||
clause | ||
logger | ||
migrator | ||
schema | ||
tests | ||
utils | ||
.gitignore | ||
License | ||
README.md | ||
association.go | ||
callbacks.go | ||
chainable_api.go | ||
errors.go | ||
finisher_api.go | ||
go.mod | ||
go.sum | ||
gorm.go | ||
interfaces.go | ||
migrator.go | ||
model.go | ||
prepare_stmt.go | ||
scan.go | ||
soft_delete.go | ||
statement.go | ||
statement_test.go | ||
wercker.yml |
README.md
GORM
The fantastic ORM library for Golang, aims to be developer friendly.
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
- GORM Guides https://gorm.io
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