Commit Graph

102 Commits

Author SHA1 Message Date
Emir Beganovic 96d52f25b0 Use RWMutex 2019-04-14 12:41:14 +04:00
Emir Beganovic 59594877da Fix unsafe concurrent SingularTable method call 2019-04-14 12:30:11 +04:00
Emir Beganović cecf452d44
Merge branch 'master' into bugfix/fix-many2many-table-name 2019-04-11 08:04:39 +02:00
Jony4 071b657418 fix TagSettings' map has "":"" value () 2019-04-05 08:00:48 +08:00
Wendell Sun 14e0507fd2 fix the table name of many2many 2019-03-14 12:35:57 +08:00
Brent Hughes 8316f94b72 Fix Panic in test scenerio ()
I have found that there are times when testing that if I did not create the database through Open() it will not have the parent set and cause a panic when it hits this code path.
2019-01-02 21:28:46 +08:00
David Zhang e2cfd6be3b LintFix: Make receiver name of structField consistent ()
* Make receiver name of structField consistent

* Change s to sf
2019-01-02 21:27:17 +08:00
Artemij Shepelev f6260a0085 Second part of the defaultTableName field race fix ()
* fix (https://github.com/jinzhu/gorm/issues/1407)

* changed map with mutex to sync.Map (https://github.com/jinzhu/gorm/issues/1407)

* removed newModelStructsMap func

* commit to rerun pipeline, comment changed

* fix race with defaultTableName field (again)
2018-09-22 19:59:11 +08:00
Eyal Posener 123d4f50ef lock TagSettings structure when modified ()
The map is modified in different places in the code which results in race conditions
on execution.
This commit locks the map with read-write lock when it is modified
2018-09-10 07:11:00 +08:00
Adem Özay 6f58f8a52c added naming strategy option for db, table and column names () 2018-09-10 05:52:20 +08:00
Artemij Shepelev 0e04d414d5 Race fix. Changes modelStructsMap implementation from map with mutex to sync.Map ()
* fix (https://github.com/jinzhu/gorm/issues/1407)

* changed map with mutex to sync.Map (https://github.com/jinzhu/gorm/issues/1407)

* removed newModelStructsMap func

* commit to rerun pipeline, comment changed
2018-08-19 07:09:21 +08:00
Jinzhu 44b9911f51 Refactor self referencing m2m support 2018-02-10 21:21:50 +08:00
Nathan Osman 8e7d807ebf Allow name of column to be customized to support self-referencing many2many fields. 2018-02-10 21:21:50 +08:00
Jinzhu d61b7db8fa Fix postgres tests 2017-08-11 18:03:32 +08:00
Jinzhu eae7f6be60 Fix source type is incorrect error for embedded many to many relationship 2017-06-14 17:33:21 +08:00
Jinzhu b870f86fba Fix set Scanner's data type 2017-02-06 08:43:49 +08:00
Jinzhu 6633f325b8 Fix table name in singular mode in some cases 2017-02-05 18:38:30 +08:00
Jinzhu 1aa2d4ca89 Fix primary key for embedded struct 2017-01-09 20:07:39 +08:00
Jinzhu afaadc3942 Refactor named value support for PolymorphicType 2016-10-06 20:33:48 +08:00
slockij 1413e55339 Add named value for PolymorphicType (to replace scope.TableName) 2016-09-28 22:44:43 +02:00
Jinzhu 446ce99a42 Support set prefix for embedded struct 2016-09-05 22:26:57 +08:00
Jinzhu f26fa242cc Support specify GORM tag setting inside scanner 2016-08-25 17:59:26 +08:00
Jinzhu 8f0f5df8c6 Don't set auto increment primary key's HasDefaultValue to true 2016-08-13 21:46:49 +08:00
Christophe de Vienne 608fd976c4 Fix auto_increment on postgres database. 2016-06-20 15:00:19 +02:00
Jinzhu 4786e830d6 Fix create join table 2016-05-09 22:32:33 +08:00
Jinzhu 465f8ea05b Fix ignore fields 2016-05-02 19:34:11 +08:00
Jinzhu 2e9d5e6f76 Test overwrite foreign keys 2016-03-07 23:51:04 +08:00
Jinzhu 2c089573cd Add tests for override belogns to foreign keys with tag 2016-03-07 23:35:31 +08:00
Jinzhu 88184a989e Update godoc 2016-03-07 21:09:05 +08:00
Jinzhu ec110657da Refactor based on golint 2016-03-07 17:49:55 +08:00
Jinzhu 552d9bf455 Refactor DataTypeOf for sqlite 2016-02-14 11:51:53 +08:00
Jinzhu 2dfd76d22b Refactor DataTypeOf 2016-01-29 15:08:53 +08:00
Jinzhu d92c5db9e7 Refactor dialect 2016-01-19 13:11:11 +08:00
Jinzhu 8d716be896 Fix some go vet/lint reports 2016-01-15 21:16:48 +08:00
Jinzhu 84942c60b8 Include tag settings when clone a StructField 2016-01-08 09:02:01 +08:00
Jinzhu d1892d3177 Support poiner of Scanner 2016-01-04 18:42:47 +08:00
Jinzhu 8aa7b475d4 Add more tests for one to many relations with customized foreign keys 2016-01-04 12:23:24 +08:00
Jinzhu d87a960248 Test many to many relation with customized column 2016-01-04 08:26:02 +08:00
Jinzhu d7237be63c Support poiner of time 2016-01-03 20:27:08 +08:00
Jinzhu aa55bd3fd2 Add more tests for customized foreign keys for many2many relations 2016-01-03 17:20:24 +08:00
Jinzhu 0f5055471a Keep refactoring get model struct 2016-01-03 15:56:32 +08:00
Jinzhu 8a0c77e5fc Fix all tests for GetModelStruct 2016-01-03 14:16:58 +08:00
Jinzhu 4bc06a21c1 Refactor GetModelStruct 2016-01-03 14:04:59 +08:00
Jinzhu 6a5a2dbc55 Refactor GetModelStruct 2016-01-03 13:10:17 +08:00
Jinzhu 4e45e6dc2d Use field.TagSettings 2016-01-03 10:00:18 +08:00
Jinzhu 19b85b1f17 Compatible with both gorm, sql tag 2016-01-03 09:52:27 +08:00
Jinzhu 5d2b9bfe34 Refactor GetModelStruct 2016-01-03 09:46:07 +08:00
Jinzhu 9455215e61 Add association tests for composite primary key 2015-12-31 11:17:10 +08:00
Peter Waller 5ba59aec5f Give (*ModelStruct).TableName() a pointer receiver
There was a data race caused by the copy of the ModelStruct. See .

Fixes .
2015-12-23 10:42:03 +00:00
Jinzhu 341703ed5d Scan value into ignored fields if there is no ambiguity 2015-12-11 11:45:22 +08:00