2693 Commits

Author SHA1 Message Date
05167fd591 fix: use reflect.Append when preloading nested associations (#7014)
Co-authored-by: Emilien Kofman <emilien.kofman@miimosa.com>
2024-06-12 18:52:33 +08:00
78c6dfd712 Fix association replace non-addressable panic (#7012)
* Fix association replace non-addressable panic

* Fix tests

* Add has one panic test

---------

Co-authored-by: sgsv <->
2024-06-12 18:49:45 +08:00
3fe7fcf356 fix: unsupported data on nested joins with preloads (#6957)
* fix: `unsupported data` on nested joins with preloads

* Add test case for pointer join with nested prelaods

* Fix tests
2024-06-12 18:00:47 +08:00
9c4070ed19 fix: AfterQuery should clear FROM Clause's Joins rather than the Statement (#7027) 2024-06-12 17:51:44 +08:00
49d524aaea feat: chainable order support clause.OrderBy (#7054)
* feat: chainable order support clause.OrderBy

* indent
2024-06-12 17:47:34 +08:00
49d94c173c upgrade github action tests template 2024-06-12 17:24:34 +08:00
0f105ec163 fix: strings.Title -> cases.Title bcs strings.Title library is deprecated (#6999)
* add: add cases library

* fix: strings.Title -> cases.Title

* run goimports to solve the error
2024-06-12 11:46:59 +08:00
5e599a07ec fix: typo (#7003)
* fix: typo

* fix: covered
2024-05-08 12:07:58 +08:00
9d370bcb3e Fix handling of unknown column types (#6540) v1.25.10 2024-04-26 17:53:11 +08:00
78920199f0 Fix panic bug in migrator due to lack of nil check for stmt.Schema (#6932) 2024-04-26 15:15:49 +08:00
ac59252327 Add new error for "Violation Check Constraint" (#6992) 2024-04-26 10:53:17 +08:00
Cr
207f1ac68f fix: not clause with or condition (#6984) 2024-04-25 20:22:53 +08:00
Cr
85299bfca7 perf: merge nested preload query when using join (#6990)
* pref: merge nest preload query

* fix: preload test
2024-04-25 20:21:03 +08:00
5553ff3dcb downgrade mssql driver 2024-04-25 20:12:15 +08:00
bc49365de2 Faster utils.FileWithLineNum (#6981)
* faster FileWithLineNum

* tweak caller skip count
2024-04-22 14:43:02 +08:00
d0b4ceb726 Added comment describing Unscoped() method (#6969) 2024-04-17 11:38:55 +08:00
9a61ef2af8 fix: duplicated preload (#6948) 2024-04-15 11:20:20 +08:00
1e13fd7543 Fix duplicated columns in INSERT SQL for some fields with default value 2024-04-08 11:29:55 +08:00
1b48aa072d feat: prepare_stmt support ping (#6924)
* feat: prepare_stmt support ping

* feat: prepare_stmt tx support ping
2024-03-28 16:47:39 +08:00
26195e6d16 fix: remove callback from callbacks if Remove() called (#6916)
* fix: remove callback from callbacks if Remove() called

* reduce number of loops

* remove unnecessary blank line
v1.25.9
2024-03-26 11:33:36 +08:00
956f7ce843 fix: 'type XXXX int' will print wrong sql to terminal (#6917)
Co-authored-by: 王泽平 <zeping.wang@yo-star.com>
2024-03-21 16:00:02 +08:00
0d6c5345f3 Don't close prepared stmt for normal db error 2024-03-21 15:55:43 +08:00
57603882ea Only close bad conn prepared stmt 2024-03-20 19:47:20 +08:00
81536f823c Fix insert id into map results, fix #6812 2024-03-19 11:50:28 +08:00
1b0aa802df Fix AutoMigrate for bool fields with default value v1.25.8 2024-03-18 19:24:16 +08:00
e0c3be03fb Fix tests in local 2024-03-18 16:28:46 +08:00
303de6e7c8 chore: optimize regEnLetterAndMidline regular (#6908)
* chore: optimize regular

* fix
2024-03-18 15:33:54 +08:00
f7ebf049da fix(create): fix insert column order (#6855)
* fix(create): fix insert column order

* chore: add ConvertToCreateValues ut for Slice case

* fix: remvoe testify dependency

---------

Co-authored-by: lujinghao <lujinghao@bytedance.com>
2024-03-18 13:48:42 +08:00
ab89d54d87 chore: UnixNano convert to UnixMilli (#6907) 2024-03-18 13:44:55 +08:00
281f3e369a Fix constraint name regexp 2024-03-18 11:32:30 +08:00
7b1fb0bd73 fix(scan): array element is set to a zero value (#6890)
* fix(scan): array element is set to a zero value

* add test

* fix test

* optimization
2024-03-15 14:14:48 +08:00
e4e23d26d2 fix: nested preload with join panic when find (#6877) 2024-03-09 21:27:19 +08:00
c4c9aa45e3 fix(scan.go): reflect.MakeSlice passes in the reflect.Array type (#6880) 2024-03-09 17:39:01 +08:00
Cr
9efae659cb test: namer identifier lenght (#6872) 2024-03-09 17:31:28 +08:00
f17a75242e Signed-off-by: hishope <csqiye@126.com>
fix some typos in tests

Signed-off-by: hishope <csqiye@126.com>
2024-03-07 16:19:17 +08:00
3e2c4fc446 Fix regression in db.Not introduced in v1.25.6. (#6844)
* Fix regression in db.Not introduced in 940358e.

* Fix
2024-03-05 10:23:51 +08:00
f118e55db5 Add unittest test helper function ConvertSliceOfMapToValuesForCreate (#6854) 2024-03-05 10:22:57 +08:00
52404cddbb CHORE add unittest test function ConvertMapToValueForCreate (#6846)
* CHORE add unittest test function  ConvertMapToValueForCreate

* CHORE move the test cases located in the files convert_map_test.go and visit_map_test.go into the file helper_test.go.
2024-02-27 10:48:04 +08:00
d81ae6f701 Fixed: panic on nullable value with multiple foreign key usage (#6839)
See: https://github.com/go-gorm/playground/pull/537
2024-02-19 11:42:25 +08:00
8fb9a31775 refactor: part 2 of distinguish between Unique and UniqueIndex (#6822) v1.25.7 2024-02-06 19:48:40 +08:00
9514d5f9e6 let limit and offset use bind parameter (#6806)
* let limit and offset use bind parameter

* format

* format limt_test

* try again

* fix test case fro connpool

* adding driverName for postgres  ,if not to do so, the stmt vars will be added  a wrong  one called pgx.QueryExecModeSimpleProtocol  ,  causing the SQL with limit  problem  need 1 parameter ,but given two.

* delete trunk files

* restore the test_test.go

* restore test_test.go

* driver/postgres->v1.5.5

* change postgres version rollback to 1.5.4

---------

Co-authored-by: chenchuan <chenchuan@360.cn>
Co-authored-by: jason_chuan <jason_chuan@126.com>
2024-02-06 10:54:40 +08:00
46816ad31d refactor: distinguish between Unique and UniqueIndex (#6386)
* refactor: distinguish between UniqueIndex and Index

* add test

* add ParseIndex test

* modify unique to constraint

* modify unique to constraint

* fix MigrateColumnUnique

* fix test

* fix unit test

* update test mod

* add MigrateColumnUnique to Migrator interface

* fix format lint

* add comment

* go mod tidy

* revert: revert MigrateColumn

* resolve conflicts
2024-02-04 15:49:19 +08:00
418ee3fc19 fix: preload shouldn't overwrite the value of join (#6771)
* fix: preload shouldn't overwrite the value of join

* fix lint

* fix: join may automatically add nested query
2024-01-29 11:34:57 +08:00
e043924fe7 chore(deps): bump actions/cache from 3 to 4 (#6802)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-29 10:34:20 +08:00
0123dd4509 fix: ignore .gen.go suffix in logger to get the real caller when using gen #6697 (#6785) v1.25.6 2024-01-12 17:09:22 +08:00
940358e0dd Fix tests doesn't follow https://gorm.io/docs/method_chaining.html convention 2024-01-12 16:42:21 +08:00
87decced23 fix: ExplainSQL using consecutive pairs of escaper in SQL string represents an escaper (#6766)
Preventing it from being interpreted as the string terminator. This is a widely used escape mechanism in SQL standards and is applicable in most relational databases.
2023-12-28 19:53:36 +08:00
436cca753c fix: join and select mytable.* not working (#6761)
* fix: select mytable.* not working

* fix: select mytable.*: will not match `mytable."*"`.
feat: increase readability of code matching table name column name
2023-12-23 21:19:41 +08:00
a2cac75218 feature: bring custom type and id column name to polymorphism (#6716)
* feature: bring custom type and id column name to polymorphism

* relationship: better returns for hasPolymorphicRelation

* fix: tests
2023-12-15 16:36:08 +08:00
b9ebdb13c7 Making locking parameters more intuitive (#6719)
* Making locking parameters more intuitive

* remove dedicated type
2023-12-15 16:32:56 +08:00