Commit Graph

214 Commits

Author SHA1 Message Date
Jinzhu de850edb4f Fix Change UpdatedAt to current time when doing OnConflict UpdateAll 2021-01-11 19:16:47 +08:00
Jinzhu 7ebb320f3e Allow customize join table's table in callback 2021-01-10 14:58:54 +08:00
Jinzhu d888c799d7 Change UpdatedAt to current time when doing OnConflict UpdateAll 2021-01-08 19:20:42 +08:00
Jinzhu 6d260a86bd Fix Set/Get settings when saving associations, close #3908 2021-01-05 21:12:31 +08:00
Jinzhu 60b769c2c8 OnConflict UpdateAll includes fields that specified default values via tag 2021-01-04 15:13:56 +08:00
Jinzhu 79864af9ff Allow customize auto increment increment 2020-12-30 11:16:40 +08:00
Jinzhu 77bf4aecc6 Create associations w/o nested transaction option 2020-12-18 13:25:52 +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 e1952924e2 Support named Joins, close #3833 2020-12-07 10:31:06 +08:00
Andrei Baibaratsky f2321ca164
Fixed creation of associated records with composite primary keys (go-gorm#3817) (#3818) 2020-12-03 15:00:26 +08:00
Jinzhu 6186a4daa7 allow SkipHooks when preload & save associations 2020-11-20 16:56:52 +08:00
Jinzhu dec8748512 Refactor QueryFields Option 2020-11-20 15:44:39 +08:00
Luis Guillermo Gómez 47ffd0bef4
Select all fields in SQL queries avoiding the SELECT * FROM (#3731)
* Select all fields in SQL queries avoiding the SELECT * FROM

* Select table name with fields in SQL queries

* Use QueryFields to execute the SQL query with all fields of the table
2020-11-20 15:38:25 +08:00
Jinzhu e3b4e0418f Inherit SkipHooks option when preloading associations, close #3772 2020-11-20 15:11:47 +08:00
Jinzhu a1a30c38de Allow to omit fields when upsert associations, close #3762 2020-11-18 19:06:49 +08:00
Jinzhu 54b80b18bc Allow to omit fields in associations, close #3752 2020-11-17 21:49:40 +08:00
Jinzhu 50df9da6a1 Allow to skip associations when creating join table for many2many, close #3605 2020-11-17 20:24:08 +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 f6e1786ca2 Add skip hooks support 2020-11-17 15:19:58 +08:00
Jinzhu f5c2126c29 Fix FindInBatches tests 2020-11-17 13:14:34 +08:00
Jinzhu 62be27d3ca Add OnConflict UpdateAll support 2020-11-16 20:22:08 +08:00
Jinzhu a9f54d53fb Don't preload when there are any error happened 2020-11-16 12:23:13 +08:00
Jinzhu 1e241aa645 Reduce GC alloc 2020-11-10 21:23:20 +08:00
Jinzhu fcf2ab6c0e Add deleted_at check when soft deleting, fix #3720 2020-11-05 11:20:08 +08:00
Jinzhu 560d303e71 Fix Scan with soft delete, close #3712 2020-11-04 11:03:22 +08:00
Jinzhu 4009ec5816 Fix call hook methods when updating with struct 2020-10-27 18:14:36 +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 c0de3c5051 Support FullSaveAssociations Mode, close #3487, #3506 2020-09-24 19:29:15 +08:00
Jinzhu a932175ccf Refactor cascade delete associations 2020-09-15 14:28:26 +08:00
Jinzhu 06d534d6ea Cascade delete associations, close #3473 2020-09-15 12:41:45 +08:00
Jinzhu 70a7bd52ca Support delete associations with Select when deleting 2020-09-10 21:46:18 +08:00
Jinzhu d8ddccf147 Don't marshal to null for associations after preloading, close #3395 2020-09-04 19:09:51 +08:00
Jinzhu 28121d4455 Fix panic when batch creating from slice contains invalid data, close #3385 2020-09-03 20:59:41 +08:00
Jinzhu 48b395b760 returns ErrEmptySlice when creating with zero length slice 2020-09-03 11:32:30 +08:00
Jinzhu fcb666cfa3 Fix associations using composite primary keys without ID field, close #3365 2020-09-03 10:58:48 +08:00
Jinzhu dbaa6b0ec3 Fix Scan struct with primary key, close #3357 2020-09-02 16:14:26 +08:00
Jinzhu 308d22b166 Clean up associations before Preload, close #3345 2020-09-01 13:48:37 +08:00
Jinzhu b4166d9515 Fix V2 Save compatibility, close #3332 2020-08-30 10:21:11 +08:00
Jinzhu dacbaa5f02 Fix update attrs order 2020-08-27 19:52:01 +08:00
Jinzhu 7a90496701 Test create from sql expr with map 2020-08-27 16:27:59 +08:00
Jinzhu ce8853e7a6 Add GormValuer interface support 2020-08-27 15:03:57 +08:00
Jinzhu 3195ae1207 Allow override alias table in preload conditions 2020-08-25 18:59:19 +08:00
Jinzhu 3dfa8a66f1 Fix panic when delet without pointer, close #3308 2020-08-25 17:27:28 +08:00
Jinzhu ebdb4edda8 Add AllowGlobalUpdate mode 2020-08-23 20:08:23 +08:00
Jinzhu 3a97639880 Fix unordered joins, close #3267 2020-08-23 10:45:10 +08:00
Jinzhu 50826742fd Add error gorm.ErrInvalidData 2020-08-18 18:00:36 +08:00
Jinzhu 9fcc337bd1 Fix create from map 2020-08-17 17:41:36 +08:00
Jinzhu ecc946be6e Test update from sub query 2020-08-13 16:05:06 +08:00
Jinzhu 045d5f8538 Fix count with join and no model, close #3255 2020-08-13 12:18:36 +08:00
Jinzhu 3df249c127 Use table expr when inserting table, close #3239 2020-08-06 17:12:31 +08:00
Jinzhu dc299b900f Use specified table when preloading data with Join 2020-07-31 14:47:47 +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 c3f52cee8b Don't scan last insert id 0 2020-07-23 23:56:13 +08:00
Jinzhu 6ed697dd02 TestFirstOrCreateWithPrimaryKey, close #3192 2020-07-23 23:41:56 +08:00
Jinzhu 87112ab1c7 Fix row callback name 2020-07-22 15:05:38 +08:00
Jinzhu 0546b59743 Fix save many2many associations with UUID primary key, close #3182 2020-07-22 11:28:00 +08:00
Jinzhu ef002fd7ac Add GORMDataType to Field, close #3171 2020-07-20 19:00:03 +08:00
Jinzhu a0477f94dd Allow Omit with Query, close #3165 2020-07-19 21:48:58 +08:00
Jinzhu b8692c7671 Allow temporarily disable default transaction 2020-07-16 18:05:55 +08:00
Jinzhu 4456df7a5d Lint with golangci-lint 2020-07-16 11:27:12 +08:00
Jinzhu 33c48611b6 Fix customize table with Delete, close #3129 2020-07-10 13:08:29 +08:00
Jinzhu a8655f7947 Fix auto select with smaller struct for slices 2020-07-09 12:15:35 +08:00
Jinzhu 2ae0653af2 Fix ambiguous column when using same column name in join table, close #3120 2020-07-09 09:03:48 +08:00
Jinzhu b5725940e9 Test Select with Update Struct 2020-07-06 11:20:43 +08:00
Jinzhu 89ea62077d DryRun for RowQuery, Exec, close #3106 2020-07-04 08:35:11 +08:00
Jinzhu 3f355dc050 Refactor 2020-07-02 10:14:30 +08:00
Jinzhu 63e48191a8 Test failed to save association should rollback, close #3100 2020-07-01 21:28:19 +08:00
Jinzhu 9075b33620 Query with smaller struct 2020-07-01 08:56:21 +08:00
Jinzhu 929c0c576c Test Hooks For Slice 2020-06-30 22:47:21 +08:00
Jinzhu f5566288de Add SetColumn, Changed method 2020-06-30 16:53:54 +08:00
Jinzhu 5883490aa7 Select, Omit, Preload supports clause.Associations 2020-06-20 17:21:01 +08:00
Jinzhu a1e35bdc94 Support merge batch data some having primary values 2020-06-20 16:52:15 +08:00
Jinzhu 4f19e2a7b3 Test ForeignKeyConstraints 2020-06-20 01:20:18 +08:00
Jinzhu 2c1b04a2cf Fix failed to create second record in same transaction, close #3060 2020-06-19 12:38:03 +08:00
Jinzhu 0d58d5a3a7 Upsert selected columns 2020-06-10 10:48:48 +08:00
Jinzhu f3424c6864 Support save slice of data 2020-06-10 00:02:14 +08:00
Jinzhu 05e6a65ee1 Fix typo 2020-06-09 12:00:43 +08:00
Jinzhu c4872cddfd Refactor callbacks 2020-06-09 10:17:24 +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 eda2f023b0 Add Distinct support 2020-06-05 19:19:12 +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 b71171dd92 Add more preload tests 2020-06-02 01:34:00 +08:00
Jinzhu e490e09db5 Add SetupJoinTable support 2020-06-01 23:58:22 +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 76b8e78dcb Add multi primary keys test 2020-06-01 08:13:16 +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
Jinzhu 5b1d3e4a77 Test Joins 2020-05-31 20:21:52 +08:00
Jinzhu 749ca37eb0 Add sql builder test 2020-05-31 19:23:32 +08:00
Jinzhu aa959ec383 Test NamedPolymorphic 2020-05-31 14:41:45 +08:00
Jinzhu 9d3e929790 Test Select, Omit with Create 2020-05-31 13:34:53 +08:00
Jinzhu 1546f8a4a1 Test CreateWithNoGORMPrimayKey 2020-05-31 12:52:49 +08:00