Jinzhu
801a271d07
Fix Association Count
2016-01-12 12:31:05 +08:00
Jinzhu
d87a960248
Test many to many relation with customized column
2016-01-04 08:26:02 +08:00
Jinzhu
b59eaf526e
Set Error to Association when some error happend
2016-01-03 17:52:16 +08:00
Jinzhu
aa55bd3fd2
Add more tests for customized foreign keys for many2many relations
2016-01-03 17:20:24 +08:00
Jinzhu
9455215e61
Add association tests for composite primary key
2015-12-31 11:17:10 +08:00
Jinzhu
934e97b018
Don't need NOT IN conditions when there are no primary keys found
2015-12-30 15:34:56 +08:00
Jinzhu
c087e6dcc6
Remove unnecessary saving SQL when Append new association
2015-12-26 19:49:31 +08:00
Jinzhu
a563efdd27
Update association tests
2015-12-26 16:45:53 +08:00
Jinzhu
4c1f03fee3
Don't set foreign key to be null when delete with a wrong relation
2015-12-26 16:19:38 +08:00
Jinzhu
300b74f15f
Refactor association Delete
2015-12-26 16:06:53 +08:00
Jinzhu
e65f94b287
Fix association Append for polymorphic
2015-12-26 15:20:40 +08:00
Jinzhu
c88960b9b0
Add more tests for TestHasOne
2015-12-26 14:26:21 +08:00
Jinzhu
c23185af54
Refactor association Delete
2015-12-26 00:23:45 +08:00
Jinzhu
f6ea3afc8d
Refactor association Replace
2015-12-25 23:30:57 +08:00
Jinzhu
f13dcd8bc0
Refactor association Replace
2015-12-25 20:43:51 +08:00
Jinzhu
93b512be47
Refactor association Clear, Replace
2015-12-25 19:35:36 +08:00
Jinzhu
4719ee7b1f
Add Replace support for has many associations
2015-12-25 19:08:10 +08:00
Jinzhu
a00fb4db04
Add Delete support for has many associations
2015-12-25 18:42:26 +08:00
Jinzhu
affb64b04b
Add BelongsTo support for association Clear
2015-12-25 17:32:28 +08:00
Jinzhu
c85f00bcd2
Add BelongsTo support for association Delete
2015-12-25 17:09:37 +08:00
Jinzhu
d57867eb46
Make Replace support other associations
2015-12-25 15:49:41 +08:00
Jinzhu
0ce635cc67
Add Append support for other associations
2015-12-25 15:25:37 +08:00
Jinzhu
58596afda1
Replace many2many associations with empty
2015-09-30 21:30:58 +08:00
Jinzhu
a480621b76
Fix extra updates when Append associations for many2many
2015-09-30 12:10:22 +08:00
Rahul Ghose
1c227d4243
this fixes syntax error
...
relevant issue: https://github.com/jinzhu/gorm/issues/588
2015-07-31 16:52:46 +05:30
Jinzhu
f00b95d305
Passed all tests for multiple primary keys
2015-07-30 22:59:25 +08:00
Jinzhu
ebbeecd10f
Fix test TestManyToMany
2015-07-30 22:18:56 +08:00
Jinzhu
dc428d2364
Fix compile error for association
2015-07-30 17:26:10 +08:00
Jinzhu
d75612b86f
Update JoinTableHandler API
2015-06-19 11:32:11 +08:00
Jinzhu
7e8622f671
Don't need to delete join table records if no record added
2015-06-18 18:23:11 +08:00
Jinzhu
1eb1ed091f
Test ManyToMany relations with multi primary keys
2015-04-10 16:55:53 +08:00
Jinzhu
44b106c8e2
Fix tests
2015-03-19 18:23:54 +08:00
Jinzhu
c13e2f18f8
New JoinTableHandler
2015-03-18 11:47:11 +08:00
Jinzhu
49454839bd
Support Multi primary keys
2015-03-11 11:28:30 +08:00
Jinzhu
80576bbbbc
Add Table method for JoinTableHandler
2015-03-04 13:56:47 +08:00
Jinzhu
6d64e6837b
Add JoinTableHandler
2015-02-28 12:05:14 +08:00
Jinzhu
33e6b14632
Clear value from db after set table name
2015-02-26 16:08:26 +08:00
Jinzhu
eb480cc085
Modify struct when update association
2015-02-24 18:48:48 +08:00
Jinzhu
0d2c37e310
Refactor Model Struct
2015-02-18 12:50:37 +08:00
Jinzhu
5c478b46e1
Use Common Initialisms from golint
2015-02-18 10:36:32 +08:00
Jinzhu
672ba4ffc9
Rename ToSnake to ToDBColumnName
2015-02-18 09:26:35 +08:00
Jinzhu
0b32041135
Review and Refactor
2015-02-17 22:55:14 +08:00
Jinzhu
38cbff9c79
Refactor Associations
2015-02-17 20:19:47 +08:00
Jinzhu
00d1187c4c
Refactor Association
2015-02-17 19:17:21 +08:00
Jinzhu
2a8c7973cb
Use new relationship API
2015-02-17 18:57:50 +08:00
Jinzhu
f4e705b749
Fix compile error
2015-02-16 16:42:01 +08:00
Jinzhu
6864d5e5bd
Add polymorphic_test.go
2015-02-13 11:26:02 +08:00
Jinzhu
8aef600540
Fix association Replace delete wrong records
2015-02-09 21:54:16 +08:00
Jinzhu
b7554a2cb0
Fix delete many2many associations
2015-01-16 10:15:53 +08:00
jnfeinstein
8b451f0084
Add support for polymorphic relationships using the POLYMORPHIC setting.
...
This commit adds support for two settings:
FOREIGNTYPE - A field that is used to store the type of the owner.
POLYMORPHIC - A shortcut to set FOREIGNKEY and FOREIGNTYPE to the same
value suffixed by "Id" and "Type" respectively.
The type is stored as the table name, which I thought might be useful
for other queries.
The biggest gotcha of this commit is that I flipped the definition of
has_one and belongs_to. gorm is very flexible such that it didn't
really care if it was a has_one or belongs_to, and can pretty much
determine it at runtime. For the sake of the error, I had to define
one of them as belongs_to, and I chose the one with the fields as
the belongs_to, like ActiveRecord. The error could probably be
genericized to "gorm cannot determine type", but I think it's nicer
to tell people DONT DO PATTERN XYZ CAUSE IT WONT WORK. Functionally,
it doesn't matter.
2014-11-25 21:35:47 -08:00