ZhangShenao
f7b52bb649
unify db receiver name ( #5215 )
...
Co-authored-by: Shenao Zhang <shenao.zhang@shopee.com>
2022-04-01 08:35:16 +08:00
Jinzhu
6befa0c947
Refactor preload error check
2022-03-17 11:22:25 +08:00
Jinzhu
4e523499d1
Refactor Tx interface
2022-03-01 16:59:50 +08:00
lianghuan
996b96e812
Add TxConnPoolBeginner and Tx interface
2022-03-01 16:59:50 +08:00
Gilad Weiss
f3547e00cc
Inherit clone flag (NewDB) on transaction creation ( #5012 )
...
* Inherit clone flag (NewDB) on transaction creation
I find it very reassuring to know that after a finisher API, I get a clean db object for my next queries.
If you look at the example in https://gorm.io/docs i’d see many queries running one after the other.. but in reality they wouldn’t work as the they are portrayed and that’s because in default mode NewDB is false and will make all the clauses stay even after a finisher API.
My solution is just to have the value of the clone flag in the “parent” db object, be injected to its children transactions.
* Fix typo
2022-02-20 08:33:12 +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
Saurabh Thakre
581a879bf1
Added comments to existing methods
...
Added two comments to describe FirstOrInit and FirstOrCreate methods.
2022-01-31 17:26:28 +05:30
Ning
8c3673286d
preoload not allowd before count ( #5023 )
...
Co-authored-by: ningfei <accelerator314@outlook.com>
2022-01-30 18:17:06 +08:00
Jinzhu
eae73624ad
Fix return failed to begin transaction error when failed to start a transaction
2022-01-07 10:04:35 +08:00
kinggo
0df42e9afc
feat: add `Connection` to execute multiple commands in a single connection; ( #4982 )
2022-01-07 09:49:56 +08:00
Jinzhu
300a23fc31
Check rows.Close error, close #4891
2021-12-02 10:39:24 +08:00
kinggo
d8a710cba2
fix: count() when use group by and only find one record ( #4885 )
...
Co-authored-by: 李龙 <lilong.21@bytedance.com>
2021-11-29 20:14:23 +08:00
Jinzhu
270e38c518
Fix duplicated error when Scan, close #4525
2021-11-29 14:23:10 +08:00
Jinzhu
b23c3b290e
Don't query with primary key when using Save
2021-11-08 18:49:59 +08:00
kinggo
c170af11e9
fix connections leak ( #4826 )
...
* fix connections leak
* fix connections leak
* fix connections leak
* fix connections leak
Co-authored-by: 李龙 <lilong.21@bytedance.com>
2021-11-03 13:39:52 +08:00
Jinzhu
af3fbdc2fc
Improve returning support
2021-10-26 22:40:14 +08:00
kinggo
6864a24150
fix:remove the tableName judgment in pluck ( #4731 )
2021-09-27 22:11:29 +08:00
Jinzhu
12bbde89e6
Fix Scan with interface
2021-09-17 14:04:19 +08:00
Jinzhu
61b018cb94
Fix count with selected *
2021-09-16 11:17:54 +08:00
River
1bb0d8732d
feat: count accpet `db`.`table` ( #4626 )
...
* feat: count accpet `db`.`table`
* fix: logic fix
2021-08-20 17:37:21 +08:00
Jinzhu
83530ec659
Fix delete order by clause when counting, close #4478
2021-07-13 21:17:43 +08:00
wuwenchi
8bd8d38fe9
Fix Pluck's usage #4473
2021-06-26 21:23:16 +08:00
Jinzhu
8e67a08774
Fix Scopes with Row, close #4465
2021-06-18 15:38:20 +08:00
Tony
a0bddccfe1
Use count(*) instead of count(1) include NULL and non-NULL rows(SQL-92). ( #4453 )
2021-06-11 21:51:18 +08:00
heige
50e85e14d4
Code optimize ( #4415 )
...
* optimize gormSourceDir replace
* fmt.Errorf adjust and Optimize for-break
* strings trim
* feat: avoid using the same name field and if..else optimization adjustment
* optimization callbacks/create.go Create func if...else logic
* fix: callbacks/create.go Create func
* fix FileWithLineNum func and add gormSourceDir unit test
* remove debug print and utils_filenum_test.go
2021-06-10 10:21:28 +08:00
liamrfell
00b252559f
Fix: FirstOrCreate slice out of bounds error when using 'Assigns' ( #4436 )
...
Co-authored-by: Liam Fell <liam@lot.to>
2021-06-07 10:39:24 +08:00
Jinzhu
92c3ba9dcc
Fix create new db sessions in scopes
2021-05-17 15:36:07 +08:00
Genta Kamitani
26dd4c980a
Fix: FindInBatches ignores errors ( #4203 )
2021-03-22 14:11:07 +08:00
heige
221d0a0ec1
optimize value of reflection length ( #4152 )
2021-03-08 10:20:04 +08:00
Jinzhu
189547f615
Fix new session with Begin, close #4120
2021-02-26 16:43:43 +08:00
Jinzhu
9790103e68
Fix Where with empty struct, close #3966
2021-01-19 16:37:49 +08:00
Jinzhu
3d87575e7e
make Count compatible with Select with Count func, close #3962
2021-01-18 19:43:04 +08:00
Jinzhu
4a15540504
SkipDefaultTransaction skip CreateInBatches transaction
2021-01-18 11:43:42 +08:00
Jinzhu
79628be2c2
Fix wrong RowsAffected if not data found
2021-01-14 16:01:23 +08:00
Jinzhu
d888c799d7
Change UpdatedAt to current time when doing OnConflict UpdateAll
2021-01-08 19:20:42 +08:00
Jinzhu
5e72cd9a2b
Add ErrPrimaryKeyRequired if schema has no primary key defined
2021-01-06 14:42:42 +08:00
Jinzhu
468152d45b
Add DisableNestedTransaction support
2020-12-16 19:33:35 +08:00
Jinzhu
1ef1f0bfe4
Fix Count with complicated Select, close #3826
2020-12-06 14:30:42 +08:00
Jinzhu
51568ba4ab
Delete select clause after Count, close #3814
2020-12-02 17:27:07 +08:00
Jinzhu
0c12a4c360
Add CreateBatchSize option
2020-12-02 14:59:50 +08:00
Jinzhu
e7f45d5b01
Add error check for Transaction
2020-11-19 10:45:17 +08:00
Jinzhu
9df9f7688b
Change UpdatingColumn to SkipHooks
2020-11-17 17:49:43 +08:00
Jinzhu
26504f5cae
Use NewDB to replace WithConditions for Session
2020-11-17 16:28:37 +08:00
Jinzhu
320f33061c
Fix FindInBatches to modify the query conditions, close #3734
2020-11-17 11:19:04 +08:00
Jinzhu
a8db54afd6
Add CreateInBatches supports
2020-11-16 21:42:30 +08:00
Jinzhu
62be27d3ca
Add OnConflict UpdateAll support
2020-11-16 20:22:08 +08:00
Jinzhu
c1bb8e4551
Should not display the record not found error when using FirstOrXXX, close #3748
2020-11-16 11:20:13 +08:00
Jinzhu
db2630cb3a
Fix data race problem when using Scan, close #3662
2020-10-22 17:32:39 +08:00
Jinzhu
231aba53c5
Fix count with order by
2020-10-22 11:28:43 +08:00
Jinzhu
9b2181199d
Fix soft delete with OrCondition, close #3627
2020-10-19 14:50:11 +08:00