Commit Graph

2705 Commits

Author SHA1 Message Date
Jinzhu 79628be2c2 Fix wrong RowsAffected if not data found 2021-01-14 16:01:23 +08:00
Lisa Casner ce610a9560
title case schema name (#3940) 2021-01-13 13:05:05 +08:00
Jinzhu de850edb4f Fix Change UpdatedAt to current time when doing OnConflict UpdateAll 2021-01-11 19:16:47 +08:00
Jinzhu b864a5457a Allow foreign key following the default naming conventions, close #3928 2021-01-10 17:32:17 +08:00
Jinzhu fe553a7c1a Fix prepared statement in transaction mode can't be shared in normal operations, close #3927 2021-01-10 16:46:06 +08:00
Jinzhu 7302c8a136 Fix tests and logger 2021-01-10 15:27:53 +08:00
Jinzhu 7ebb320f3e Allow customize join table's table in callback 2021-01-10 14:58:54 +08:00
Qt f9131e309d
reduce DB's Use method complexity and make it easier to understand (#3930) 2021-01-10 10:15:48 +08:00
Jinzhu d888c799d7 Change UpdatedAt to current time when doing OnConflict UpdateAll 2021-01-08 19:20:42 +08:00
Jinzhu a5bfe2f39d Keep Error for new Session 2021-01-07 11:45:40 +08:00
Jinzhu bf0fd9bef6 Fix logger check LogLevel 2021-01-06 16:07:19 +08:00
Jinzhu 5e72cd9a2b Add ErrPrimaryKeyRequired if schema has no primary key defined 2021-01-06 14:42:42 +08:00
Jinzhu 435bf70865 Add OnConflict OnConstraint support, close #3882 2021-01-05 21:31:51 +08:00
Jinzhu 6d260a86bd Fix Set/Get settings when saving associations, close #3908 2021-01-05 21:12:31 +08:00
Jinzhu 53b3ebdd1d Add invalid data error when building conditions 2021-01-05 21:01:16 +08:00
Jinzhu 00a785cd68 Don't use invalid value to build conditions, close #3912 2021-01-05 18:01:51 +08:00
Jinzhu 60b769c2c8 OnConflict UpdateAll includes fields that specified default values via tag 2021-01-04 15:13:56 +08:00
Philip Sahli 9b8d3b3a0f
fix typo (#3911) 2021-01-04 11:30:05 +08:00
Jinzhu 1b8cb07cf2 Allow Where select fields when searching with struct 2020-12-30 18:13:52 +08:00
Jinzhu 79864af9ff Allow customize auto increment increment 2020-12-30 11:16:40 +08:00
Jinzhu 6c0ee2700a Allow to use Valuer with Eq expression, #3899 2020-12-30 10:42:13 +08:00
Jinzhu 065787c54e Compatible with with foreign key with ID suffix #3890 2020-12-28 18:20:55 +08:00
Jinzhu 8bf50a5592 Fix parse relations if only specfied References, close #3890 2020-12-28 17:58:12 +08:00
Jinzhu ade0bd6d60 Fix SELECT with sql expression in some cases, close #3889 2020-12-28 10:40:30 +08:00
Jinzhu ad8a5c0d1a Add QueryFields mode when query many2many relations 2020-12-25 16:35:25 +08:00
Jinzhu 59730417aa Fix auto migrate field with customized field type, close https://github.com/go-gorm/mysql/issues/20 2020-12-23 17:31:47 +08:00
Jinzhu 77bf4aecc6 Create associations w/o nested transaction option 2020-12-18 13:25:52 +08:00
Jinzhu 468152d45b Add DisableNestedTransaction support 2020-12-16 19:33:35 +08:00
Jinzhu 6848ae872f Fix gorm.Expr with SubQuery, fix #3857 2020-12-15 15:50:35 +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 14a0976dd4 populate the DeletedAt field when soft delete, fix #3855 2020-12-15 10:39:20 +08:00
Jinzhu 21c3f05aa2 Use transaction's conn when preparing statement 2020-12-14 18:31:18 +08:00
vellotis 51b5208599
Fix building of `clause.Eq` and `clause.Neq` expressions that fail to handle `(*T)(nil)` use cases correctly (#3848)
* Update tests to cover building `clause.Eq` and `clause.Neq` when value could be a nil pointer of a primitive

* Fix use cases for `clause.Eq` and `clause.Neq` when value is nil pointer of a primitive type
2020-12-11 14:07:23 +08:00
Jinzhu e1952924e2 Support named Joins, close #3833 2020-12-07 10:31:06 +08:00
Jinzhu 6a0fca2195 Return error for invalid relations definition, close #3830 2020-12-06 18:07:16 +08:00
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