64 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
jessetang
ab89d54d87
chore: UnixNano convert to UnixMilli (#6907) 2024-03-18 13:44:55 +08:00
Jinzhu
c3d7d08b9a Clear SET clause after build SQL 2023-05-15 15:43:44 +08:00
Cr
b62192456f
fix: diff schema update assign value (#6096) 2023-03-10 17:04:54 +08:00
black-06
e66a059b82
fix: update panic if model is not ptr (#6037)
* fix: update panic if model is not ptr

* fix: update panic if model is not ptr

* fix: update panic if model is not ptr

* fix: raise an error if the value is not addressable

* fix: return
2023-02-18 09:20:29 +08:00
qqxhb
490625981a
fix: update omit (#5699) 2022-09-16 15:02:44 +08:00
Jinzhu
b13d1757fa Refactor Model with slice data 2022-07-07 15:39:29 +08:00
Jinzhu
fe01e1b9f4 Fix Model with slice data 2022-07-07 14:43:33 +08:00
Jinzhu
f92e6747cb Handle field set value error 2022-03-23 17:24:25 +08:00
Jinzhu
a7b3b5956f Fix hooks order, close https://github.com/go-gorm/gorm.io/pull/519 2022-03-22 22:42:36 +08:00
Jinzhu
6a18a15c93 Refactor check missing where condition 2022-02-25 10:48:23 +08:00
Jinzhu
b1201fce4e Fix update with customized time type, close #5101 2022-02-23 17:48:26 +08:00
Jinzhu
39d84cba5f Add serializer support (#5078)
* Update context

* Update GormFieldValuer

* Add Serializer

* Add Serializer Interface

* Refactor gorm field

* Refactor setter, valuer

* Add sync.Pool

* Fix test

* Add pool manager

* Fix pool manager

* Add poolInitializer

* Add Serializer Scan support

* Add Serializer Value method

* Add serializer test

* Finish Serializer

* Fix JSONSerializer for postgres

* Fix JSONSerializer for sqlserver

* Test serializer tag

* Add unixtime serializer

* Update go.mod
2022-02-19 17:02:53 +08:00
kinggo
b47cf57f5e
ci: add gofumpt check in reviewdog (#4973) 2022-01-06 15:02:53 +08:00
kinggo
e5bdd610c3
fix: save not use soft_delete (#4897)
* fix: Save not use soft_delete

* fix: save not use soft_delete

* fix: save not use soft_delete

* fix: save not use soft_delete

Co-authored-by: kinggo <>
2021-12-08 13:58:06 +08:00
Jinzhu
300a23fc31 Check rows.Close error, close #4891 2021-12-02 10:39:24 +08:00
heige
9d5f315b6d
feat: go code style adjust and optimize code for callbacks package (#4861)
* feat: go code style adjust and optimize code for callbacks package

* Update scan.go
2021-11-29 09:33:20 +08:00
riverchu
33bc56cbb5 feat(update): update when has SET clause 2021-11-09 19:55:47 +08:00
Jinzhu
e953880d19 Add returning tests 2021-10-28 09:17:33 +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
kinggo
b46e2afc4a
fix : update miss where's condition when primary key use "<-:create" tag (#4738)
* fix:update miss where condition

* fix:rename test case
2021-10-08 13:47:01 +08:00
Jinzhu
ba16b2368f
Refactor update record (#4679) 2021-09-07 20:04:54 +08:00
riverchu
eaa63d15e7 feat: copy dest fields to model struct 2021-09-06 20:13:20 +08:00
riverchu
1d9e563023 style: prepose error judgement 2021-09-06 20:13:20 +08:00
Jinzhu
6951be0284 Allow customize clauses 2021-04-28 17:19:30 +08:00
Jinzhu
0f00493c50 Continue to update tracking fields even not selected with Select, but skip them if omited with Omit, fix #3856 2020-12-15 11:18:29 +08:00
Jinzhu
9df9f7688b Change UpdatingColumn to SkipHooks 2020-11-17 17:49:43 +08:00
Jinzhu
dacbaa5f02 Fix update attrs order 2020-08-27 19:52:01 +08:00
Jinzhu
ce8853e7a6 Add GormValuer interface support 2020-08-27 15:03:57 +08:00
Jinzhu
ebdb4edda8 Add AllowGlobalUpdate mode 2020-08-23 20:08:23 +08:00
Jinzhu
50826742fd Add error gorm.ErrInvalidData 2020-08-18 18:00:36 +08:00
Jinzhu
ecc946be6e Test update from sub query 2020-08-13 16:05:06 +08:00
lninl
7bb883b665
Auto creating/updating time with unix (milli) second (#3213)
* Auto creating/updating time with unix (milli) second

* add test for 'Auto creating/updating time with unix (milli) second'
2020-07-30 17:39:57 +08:00
Jinzhu
69d8111893 Fix panic when using invalid data, close #3193 2020-07-24 08:32:50 +08:00
Jinzhu
ef002fd7ac Add GORMDataType to Field, close #3171 2020-07-20 19:00:03 +08:00
Jinzhu
b5725940e9 Test Select with Update Struct 2020-07-06 11:20:43 +08:00
Jinzhu
f5566288de Add SetColumn, Changed method 2020-06-30 16:53:54 +08:00
Jinzhu
4f19e2a7b3 Test ForeignKeyConstraints 2020-06-20 01:20:18 +08:00
Jinzhu
9f19378304 Grow SQL capacity to reduce allocation 2020-06-08 20:23:47 +08:00
Jinzhu
aaf0725771 Refactor for performance 2020-06-08 17:21:26 +08:00
Jinzhu
d11c424334 Fix typo 2020-06-07 15:26:43 +08:00
Jinzhu
1490a062db Refactor codebase and add benchmark test 2020-06-05 23:26:56 +08:00
Jinzhu
163200d05f Test Hooks 2020-06-05 20:24:15 +08:00
Jinzhu
d50879cc28 Add field permission test 2020-06-05 19:18:22 +08:00
Jinzhu
e986371a42 Rename package name 2020-06-02 09:18:01 +08:00
Jinzhu
4e147e1256 Test SubQuery 2020-06-01 21:26:23 +08:00
Jinzhu
1559fe24e5 Add more updates test 2020-06-01 19:41:33 +08:00
Jinzhu
befef0c9a9 Improve Hooks 2020-06-01 00:12:20 +08:00
Jinzhu
e26abb84b3 Test block global update/delete 2020-05-31 20:42:07 +08:00