111 Commits

Author SHA1 Message Date
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
aviyam181199
8503287ca4
Fixed Empty Returning Clause Merge Bug (#7339) 2025-01-12 18:18:04 +08:00
Cr
207f1ac68f
fix: not clause with or condition (#6984) 2024-04-25 20:22:53 +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
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
Jinzhu
940358e0dd Fix tests doesn't follow https://gorm.io/docs/method_chaining.html convention 2024-01-12 16:42:21 +08:00
Maciej Laskowski
b9ebdb13c7
Making locking parameters more intuitive (#6719)
* Making locking parameters more intuitive

* remove dedicated type
2023-12-15 16:32:56 +08:00
hjwblog.com
9d8a5bb208
feat: reuse name (#6626) 2023-10-10 14:45:48 +08:00
weih
bae684b363
fix(clause): when the value of clause.Eq is an empty array, the SQL should be IN (NULL) (#6503) 2023-08-10 13:34:33 +08:00
hanwn
59ca46db3c
fix: limit(0).offset(0) return all data (#6191)
Co-authored-by: hanwang <hanwang.7721@bytedance.com>
2023-04-11 10:25:47 +08:00
Michael Anstis
532e9cf4cc
Issue 6054: Unscoped not working with PreLoad on Joins (#6058)
* Issue 6054: Unscoped not working with PreLoad on Joins

* Formatting

---------

Co-authored-by: Michael Anstis <manstis@redhat.com>
2023-02-18 09:06:43 +08:00
Jinzhu
4d6b70ec88 Allow modify statement from dest 2023-02-02 17:15:08 +08:00
jessetang
f82e9cfdbe
test(clause/joins): add join unit test (#5832) 2022-11-03 21:03:13 +08:00
robhafner
e8f48b5c15
fix: limit=0 results (#5735) (#5736) 2022-10-07 20:14:14 +08:00
Wen Sun
9564b82975
Fix OnConstraint builder (#5738) 2022-10-07 13:46:20 +08:00
Clark McCauley
540fb49bcb
Fixed #5355 - Named variables don't work when followed by Windows CRLF line endings (#5356)
* Fixed #5355.

* Fixed unit test to test both CRLF and CR line endings
2022-05-22 15:16:01 +08:00
Mikhail Faraponov
2990790fbc
Use WriteByte for single byte operations (#5167)
Co-authored-by: Mikhail Faraponov <mikefaraponov@Mikhails-MacBook-Pro.local>
2022-03-17 22:54:30 +08:00
sammyrnycreal
5edc78116f Fixed the use of "or" to be " OR ", to account for words that contain "or" or "and" (e.g., 'score', 'band') in a sql statement as the name of a field. 2022-02-20 08:22:21 +08:00
Jinzhu
cec0d32aec Support use clause.Expression as argument 2022-01-28 18:48:32 +08:00
kinggo
b47cf57f5e
ci: add gofumpt check in reviewdog (#4973) 2022-01-06 15:02:53 +08:00
kinggo
8dde09e0be
fix: generate sql incorrect when use soft_delete and only one OR (#4969)
* fix: generate sql incorrect when use soft_delete and only one OR
2021-12-30 11:47:14 +08:00
Emre Güllü
2c3fc2db28
Fix: Where clauses with named arguments may cause generation of unintended queries (#4937) 2021-12-21 19:50:00 +08:00
Jinzhu
45e804dd3f Fix call valuer interface when using nil value 2021-11-29 16:19:11 +08:00
Jinzhu
e1b4c066a8 Fix FullSaveAssociations, close #4874 2021-11-29 11:02:44 +08:00
Jinzhu
b8f33a42a4
Add unused argument (#4871)
* Append unused argument to gorm statement
2021-11-23 17:11:52 +08:00
Jinzhu
835d7bde59 Add returning support to delete 2021-10-28 07:56:55 +08:00
Jinzhu
af3fbdc2fc Improve returning support 2021-10-26 22:40:14 +08:00
River
851fea0221
fix: QuoteTo not fully support raw mode (#4735)
* fix: QuoteTo not fully support raw mode

* fix: table alias without AS

* test: clause.Column/Table quote test

* fix: revert table alias quote
2021-09-29 14:02:35 +08:00
Jim
5202529ea1
fix (clause/expression): Allow sql stmt terminator (#4693)
Allow the sql stmt terminator ";" at the end of a named parameter.

Example: select * from table_name where name == @name;
2021-09-20 21:40:48 +08:00
Sec Cake
093694fbf2
Fix extra 'AND' when len(values) == 0 ON IN.NegationBuild() (#4618) 2021-08-20 18:06:48 +08:00
River
25f561a742
feat: QuoteTo accept clause.Expr (#4621)
* feat: QuoteTo accept clause.Expr

* test: update Expr build test
2021-08-19 14:33:18 +08:00
River
ac97aec513
New Comma Expression (#4524)
* Add new comma expression

* Add comma expression unit test
2021-07-14 15:51:24 +08:00
Jinzhu
76cd73cb82 Fix wipes out MySQL global variables from the query, close #4515 2021-07-13 18:48:43 +08:00
Vitaliy Shein
dd8bf88eb9
add Target where clause for on conflict (#4442)
Co-authored-by: Vitaliy Shein <vitaliy.shein@thebricks.com>
2021-06-07 10:39:00 +08:00
Jinzhu
9abac96546 Fix Eq, Neq support slice of data 2021-05-31 17:21:27 +08:00
Jinzhu
14e96080d8 Eq, Neq support slice of data 2021-05-31 15:25:38 +08:00
Karolos Lykos
f0d0bbbc10
Added missing white space (#4330)
* Added missing white space

* Added missing white space

* Added missing white space
2021-04-29 07:15:37 +08:00
Jinzhu
33601dc72f Support Having w/o Group 2021-03-30 18:28:09 +08:00
Ratan Phayade
a3abb5fedf
support named params in Select API (#4142)
* adds support for named arguments in select

* changes clause identifies and adds test
2021-03-07 10:59:00 +08:00
Jinzhu
90476fea7a Fix Join with slice IN, close #4133 2021-03-04 18:40:47 +08:00
Jinzhu
a13b7a6acb Fix OnConflict where order for postgres, close #4073 2021-02-10 14:11:29 +08:00
Jinzhu
435bf70865 Add OnConflict OnConstraint support, close #3882 2021-01-05 21:31:51 +08:00
Philip Sahli
9b8d3b3a0f
fix typo (#3911) 2021-01-04 11:30:05 +08:00
Jinzhu
6c0ee2700a Allow to use Valuer with Eq expression, #3899 2020-12-30 10:42:13 +08:00
vellotis
51b5208599
Fix building of clause.Eq and clause.Neq expressions that fail to handle (*T)(nil) use cases correctly (#3848)
* Update tests to cover building `clause.Eq` and `clause.Neq` when value could be a nil pointer of a primitive

* Fix use cases for `clause.Eq` and `clause.Neq` when value is nil pointer of a primitive type
2020-12-11 14:07:23 +08:00
Jinzhu
694e42d6a1 Fix clause.IN with only one value of multiple rows 2020-11-17 19:11:24 +08:00
Jinzhu
62be27d3ca Add OnConflict UpdateAll support 2020-11-16 20:22:08 +08:00
LeoZhan
832abda7a4
refactor: simplify the writing instead of using struct literal (#3728) 2020-11-08 09:41:43 +08:00
Jinzhu
c915471169 Support Expression for OrderBy clause 2020-11-03 10:30:05 +08:00
Jinzhu
9b2181199d Fix soft delete with OrCondition, close #3627 2020-10-19 14:50:11 +08:00