616 Commits

Author SHA1 Message Date
Jinzhu
9af6d510b5 Fix query when map keys include table-qualified column names, close #7507 2025-07-22 14:21:04 +08:00
Jinzhu
c63374f5d1 Don't request LastInsertID from database if not necessary, close #7469 2025-07-21 17:55:20 +08:00
Riseif
985940f0d8
should check inner condition length (#7512) 2025-07-21 11:57:12 +08:00
moseszane168
991c2d4891
Add GaussDB Database Support (#7508)
* support gaussdb

* use github CI

* change function name

* use gorm.io/driver/gaussdb

---------

Co-authored-by: bing.ma <bing.ma@daocloud.io>
2025-07-21 10:46:58 +08:00
Eshan-Jogwar
1e8baf5459
fixes #7486 (#7492)
* fixes #7486

* Added A test case for subset changes of model

* completed the test file for check_subset_model_change_test.go
2025-06-25 11:11:08 +08:00
Salent Olivick
842ee527eb
fix decimal migrate error.(#7450) (#7450)
Signed-off-by: Chise1 <chise123@live.com>
2025-06-06 10:35:01 +08:00
Jinzhu
718eae4fdd fix tests for mysql 9.0 2025-06-05 19:34:13 +08:00
Jinzhu
49b01a3e93 Fix Generics Scan, close https://github.com/go-gorm/playground/pull/803 2025-05-29 14:23:57 +08:00
Jinzhu
c44405a25b
Implement Generics API (#7424)
* Implement Generics API

* Add more generics tests

* Add more tests and Take method

* use delayed‑ops pipeline for generics API

* fix generics tests for mysql

* Support SubQuery for Generics

* Add clause.JoinTable helper method

* Fix golangci-lint error

* Complete the design and implementation of generic version Join

* improve generics version Joins support

* allow configuring select/omit columns for joins via subqueries

* finish generic version Preload

* handle error of generics Joins/Preload

* fix tests

* Add LimitPerRecord for generic version Preload

* fix tests for mysql 5.7

* test for nested generic version Join/Preload

* Add WithResult support for generics API

* test reuse generics db conditions

* fix data race

* remove ExampleLRU test

* Add default transaction timeout support

* fix test
2025-05-25 15:40:40 +08:00
Jinzhu
e5b867e785 remove unnecessary session-level configuration for prepared statements 2025-05-07 14:56:49 +08:00
Zhaodong Xie
a827495be1
Preparestmt use LRU Map instead default map (#7435)
* 支持lru淘汰preparestmt cache

* 支持lru淘汰preparestmt cache

* 支持lru淘汰preparestmt cache

* 只使用lru

* 只使用lru

* 只使用lru

* 只使用lru

* 只使用lru

* 只使用lru

* 只使用lru

* 只使用lru

* 只使用lru

* change const export

* Add stmt_store

* refact prepare stmt store

* Rename lru store

* change const export

* ADD UT

* format code and add session level prepare stmt config

* code format according to golinter ci

* ADD UT

---------

Co-authored-by: xiezhaodong <xiezhaodong@bytedance.com>
Co-authored-by: Jinzhu <wosmvp@gmail.com>
2025-04-25 16:22:26 +08:00
a631807682
a9d27293de test: mssql ci 2025-03-11 15:56:46 +08:00
Jinzhu
6bfccf8afa Refactor all tests script 2024-11-21 17:03:31 +08:00
홍성욱
b0d70a26d1
[#6372] Fixed nullable constraint bug for columns during auto migration (#7269)
* [#6372] Fixed nullable constraint bug for columns during auto migration

* [#6372] fix comment

* [#6372] Add test code

* [#6372] Add test code

* [#6372] Fix failed test case

* [#6372] Fix failed test case

* [#6372] wip

* [#6372] wip

* [#6372] wip

* [#6372] wip
2024-11-14 17:40:18 +08:00
Omkar P
c6ac54812a
Use official SQL Server docker image for tests (#7205)
* Use official SQL Server docker image for tests

* Try with tag 2019-latest instead of latest

* Use platform ubuntu-20.04 for SQL Server

* Switch to 2019-CU18-ubuntu-20.04

* Check with 2022-latest image tag and ubuntu-latest platform

* Update health-cmd

* Try sqlcmd without -N -C

* Re-include -N -C, try with ubuntu-20.04

* Try ubuntu-20.04 without -N -C (last trial)

* Finalize working config

* Remove unused env variables
2024-09-30 11:21:19 +08:00
Jinzhu
68434b76eb fix test script with latest docker release 2024-09-18 20:03:35 +08:00
Kazuki Isogai
c2515ce260
feat: remove version top-level element and rename. (#7086) 2024-09-18 19:42:52 +08:00
Leo Sjöberg
7f75b12bb2
Generate unique savepoint names for nested transactions (#7174)
* Generate unique savepoint names

* Add a test for deeply nested wrapped transactions
2024-09-14 20:58:29 +08:00
ivila
0dbfda5d7e
fix memory leaks in PrepareStatementDB (#7142)
* fix memory leaks in PrepareStatementDB

* Fix CR:
1) Fix potential Segmentation Fault in Reset function
2) Setting db.Stmts to nil map when Close to avoid further using

* Add Test:
1) TestPreparedStmtConcurrentReset
2) TestPreparedStmtConcurrentClose

* Fix test, create new connection to keep away from other tests

---------

Co-authored-by: Zehui Chen <zehui@ssc-hn.com>
2024-08-22 19:02:05 +08:00
molon
11c4331058
feat: add MapColumns method (#6901)
* add MapColumns method

* fix MapColumns desc

* add TestMapColumns
2024-06-24 17:42:59 +08:00
Sérgio Prata Almeida
109f239fae
add DB level propagation for the Unscoped flag (#7007)
* adds PropagateUnscoped to db Config

* adds PropagateUnscoped test

* adds PropagateUnscoped to Session and sets it accordingly
2024-06-17 11:59:06 +08:00
Jinzhu
79bf7f92ed fix CI for sqlserver 2024-06-17 11:58:13 +08:00
Jinzhu
3d09f7947f only listen local port 2024-06-13 18:45:02 +08:00
Waleed Masoom
73a988ceb2
fix(scan): update Scan function to reset structs to zero values for each scan (#7061)
Co-authored-by: waleed.masoom <waleed.masoom@wheniwork.com>
2024-06-12 18:57:36 +08:00
Emilien
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
Sergei Sadov
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
Nico Schäfer
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
Jinzhu
49d94c173c upgrade github action tests template 2024-06-12 17:24:34 +08:00
hakusai22
5e599a07ec
fix: typo (#7003)
* fix: typo

* fix: covered
2024-05-08 12:07:58 +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
Jinzhu
5553ff3dcb downgrade mssql driver 2024-04-25 20:12:15 +08:00
yetone
9a61ef2af8
fix: duplicated preload (#6948) 2024-04-15 11:20:20 +08:00
Jinzhu
1e13fd7543 Fix duplicated columns in INSERT SQL for some fields with default value 2024-04-08 11:29:55 +08:00
snackmgmg
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
2024-03-26 11:33:36 +08:00
Jinzhu
0d6c5345f3 Don't close prepared stmt for normal db error 2024-03-21 15:55:43 +08:00
Jinzhu
81536f823c Fix insert id into map results, fix #6812 2024-03-19 11:50:28 +08:00
Jinzhu
1b0aa802df Fix AutoMigrate for bool fields with default value 2024-03-18 19:24:16 +08:00
Jinzhu
e0c3be03fb Fix tests in local 2024-03-18 16:28:46 +08:00
jessetang
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
black-06
e4e23d26d2
fix: nested preload with join panic when find (#6877) 2024-03-09 21:27:19 +08:00
Cr
9efae659cb
test: namer identifier lenght (#6872) 2024-03-09 17:31:28 +08:00
hishope
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
tsuba3
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
black-06
8fb9a31775
refactor: part 2 of distinguish between Unique and UniqueIndex (#6822) 2024-02-06 19:48:40 +08:00
jasonchuan
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
black-06
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
Jinzhu
940358e0dd Fix tests doesn't follow https://gorm.io/docs/method_chaining.html convention 2024-01-12 16:42:21 +08:00
Alexis Viscogliosi
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