Commit Graph

2320 Commits

Author SHA1 Message Date
Jinzhu 1ef1f0bfe4 Fix Count with complicated Select, close #3826 2020-12-06 14:30:42 +08:00
Jinzhu f655041908 Allow overwrite ignored field's permission, close #3829 2020-12-06 11:07:05 +08:00
Andy Bursavich 61d3a4d6ea
Fix schema initialization paths (#3825)
* Fix schema initialization paths

The initialized channel was only closed if the schema's cacheStore did not contain the embeddedCacheKey and there were no errors parsing relations.  If the key existed or an error occurred, it would not be closed. This could leave other goroutines waiting for synchronization that will never occur.

Additionally, the other code paths that wait for initialization to complete did not return the possible error.

* Unnest common schema initialization

This makes the common code path less deeply nested and the flow control easier to follow.
2020-12-04 11:28:38 +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 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
SmallTianTian 41e52f343a
fix: scan more base type and sql.NullXXX (#3813) 2020-12-02 14:00:16 +08:00
Dakatan acedbb8310
Fix Scan int32, uint32 (#3801) 2020-11-30 10:09:08 +08:00
Jinzhu 0f77500917 Waiting for schema to be initialized, close #3790 2020-11-27 17:05:45 +08:00
Jinzhu 6950007d6a Fix failed to parse relations when using goroutinue, close #3790
commit ee0ec43e8dfa85c1c1a562c2d0d47776cf8abd92
Author: Jinzhu <wosmvp@gmail.com>
Date:   Fri Nov 27 14:31:57 2020 +0800

    Fix failed to parse relations when using goroutinue, close #3790

commit 590e73ff95
Author: rokeyzhao <rokeyzhao@tencent.com>
Date:   Thu Nov 26 20:27:55 2020 +0800

    test: no cache preload in goroutine
2020-11-27 14:32:20 +08:00
Jinzhu 557b874ee3 Fix check field's precision 2020-11-25 14:55:53 +08:00
Jinzhu 66e8a72bf1 Support NameReplace for NamingStrategy, close #3779 2020-11-23 11:24:07 +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
Deviller d66af581b4
Fix Association.Replace() error returning (#3766)
* Fix Association.Replace() error returning

* Fallback to gorm.Model at TestAssociationNotNullClear()
2020-11-19 19:24:34 +08:00
Jinzhu e7f45d5b01 Add error check for Transaction 2020-11-19 10:45:17 +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 694e42d6a1 Fix clause.IN with only one value of multiple rows 2020-11-17 19:11:24 +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 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
alresvor a4c0c6b400
cache converted name (#3736)
BenchmarkToName-8     	  2322307	       521 ns/op	      88 B/op	       5 allocs/op
↓
BenchmarkToName-8     	19997366	        55.0 ns/op	       0 B/op	       0 allocs/op
2020-11-16 15:16:15 +08:00
Jinzhu a9f54d53fb Don't preload when there are any error happened 2020-11-16 12:23:13 +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 1e241aa645 Reduce GC alloc 2020-11-10 21:23:20 +08:00
LeoZhan 832abda7a4
refactor: simplify the writing instead of using struct literal (#3728) 2020-11-08 09:41:43 +08:00
Jinzhu 85e9f66d26 Fix create index for other database/schema, close #3698 2020-11-05 11:43:21 +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 c915471169 Support Expression for OrderBy clause 2020-11-03 10:30:05 +08:00
Amit Basuri 57b033e2dd
Marshalling zero valued Deleted at to nullhttps://github.com/go-gorm/gorm/issues/3693 (#3695) 2020-11-02 10:03:39 +08:00
Jinzhu 3ebdcbdb18 Marshal invalid DeletedAt as null, fix #3693 2020-10-30 19:08:20 +08:00
Jinzhu a8141b6cc9 Fix DeletedAt marshal and unmarshal, close #3693 2020-10-30 18:15:07 +08:00
Jinzhu 4009ec5816 Fix call hook methods when updating with struct 2020-10-27 18:14:36 +08:00
Jinzhu d011ebe7af Fix clone statement for Unscoped, UpdatingColumn, close #3681 2020-10-26 10:17:25 +08:00
Jinzhu cb591a7129 Fix panic when using FirstOrCreate with soft delete, close #3671 2020-10-23 18:40:05 +08:00
Jinzhu dd92f8bdc0 Allow create table for other database/schema #3640 2020-10-23 11:01:45 +08:00
Jinzhu db2630cb3a Fix data race problem when using Scan, close #3662 2020-10-22 17:32:39 +08:00
Jinzhu 0aef8acc11 Add smart auto migrate tests 2020-10-22 16:36:27 +08:00
qifengzhang007 6d90d09cb8
Recorder追踪函数trace在finish_api文件358行scan函数所在的371行被调用时,BeginAt 没有赋值,默认值0001-0:0:0导致追踪日志显示的sql耗时无限大. (#3657)
Co-authored-by: 张奇峰 <10515935zwj>
2020-10-22 14:09:09 +08:00
Jinzhu 231aba53c5 Fix count with order by 2020-10-22 11:28:43 +08:00
Jinzhu 5fee5b1b24 Add option tag support for index 2020-10-21 20:18:21 +08:00