Commit Graph

96 Commits

Author SHA1 Message Date
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
Jinzhu 9eec6ae066 Fix affected rows for Scan, change affected rows count for row/rows to '-', close #3532 2020-09-27 12:25:38 +08:00
Jinzhu 072f1de83a Add DryRunModeUnsupported Error for Row/Rows 2020-09-18 21:35:46 +08:00
Jinzhu 02fb382ec0 Support scan into int, string data types 2020-09-11 15:01:02 +08:00
Jinzhu 05794298bd Fix Save with specified table, close #3396 2020-09-06 12:22:08 +08:00
Jinzhu dbaa6b0ec3 Fix Scan struct with primary key, close #3357 2020-09-02 16:14:26 +08:00
Jinzhu b4166d9515 Fix V2 Save compatibility, close #3332 2020-08-30 10:21:11 +08:00
Jinzhu 59586dcd31 Fix unnecessary duplicated primary condition when using Save, close #3330 2020-08-29 23:02:19 +08:00
Jinzhu d50dbb0896 Fix check valid db name, close #3315 2020-08-27 19:15:40 +08:00
Jinzhu 528e5ba5c4 Cleanup Model after Count 2020-08-19 20:30:39 +08:00
deepoli 3411425d65
fix return value and delete unused default (#3280) 2020-08-18 19:03:09 +08:00
Jinzhu b5de8aeb42 Fix overrite SELECT clause 2020-08-18 18:58:53 +08:00
Jinzhu 2a716e04e6 Avoid panic for invalid transaction, close #3271 2020-08-17 12:16:42 +08:00
Jinzhu 2faff25dfb Fix FirstOr(Init/Create) when assigning with association 2020-08-13 18:38:39 +08:00
Jinzhu f83b00d20d Fix Count with Select when Model not specfied, close #3220 2020-08-03 10:30:25 +08:00
Qt f4cfa9411b
define err with the same code style (#3199) 2020-07-26 10:03:58 +08:00
Jinzhu 4456df7a5d Lint with golangci-lint 2020-07-16 11:27:12 +08:00
Jinzhu bba569af2b Add NamedArg support 2020-07-10 12:28:24 +08:00
Jinzhu d02b592c6c Better support Count in chain 2020-07-01 10:19:52 +08:00
Jinzhu ee1f46e3a1 Allow to use sql function in Group, Pluck 2020-06-30 23:06:48 +08:00
Jinzhu 7e1fa4a44d Fix Count after Session 2020-06-23 22:41:41 +08:00
Jinzhu 32bd6b3e8f Fix Count with Select 2020-06-23 08:51:01 +08:00
Jinzhu 7dc255acfe Add SavePoint/RollbackTo/NestedTransaction 2020-06-19 18:30:04 +08:00
Jinzhu 2c1b04a2cf Fix failed to create second record in same transaction, close #3060 2020-06-19 12:38:03 +08:00