Jinzhu
3055bad1e8
scope.Fields() return slice of *Field
2016-03-07 14:25:41 +08:00
Jinzhu
92213273a5
Refactor create callback
2016-01-17 18:17:04 +08:00
Jinzhu
211ccf4ea6
Fix using pointer value as foreign key
2016-01-16 11:37:16 +08:00
Jinzhu
ec0aa10bf2
Fix set scanner to a Field
2016-01-04 21:49:04 +08:00
Jinzhu
6a5a2dbc55
Refactor GetModelStruct
2016-01-03 13:10:17 +08:00
Jinzhu
e65f94b287
Fix association Append for polymorphic
2015-12-26 15:20:40 +08:00
Jinzhu
341703ed5d
Scan value into ignored fields if there is no ambiguity
2015-12-11 11:45:22 +08:00
Luke Cowell
fc42a1bbf3
provide user with more descriptive error message
2015-12-04 14:56:21 -08:00
Jinzhu
37bf87aa29
Fix can't load preload fields correctly
2015-09-26 00:41:07 +08:00
deoxxa
e77fbed442
scanner.Scan() can fail, so the error should be forwarded
2015-03-16 11:22:31 +11:00
Jinzhu
a97a508ec7
Raise error if using unaddressable value
2015-02-23 09:40:39 +08:00
Jinzhu
0b32041135
Review and Refactor
2015-02-17 22:55:14 +08:00
Jinzhu
d6439f4147
Fix tests after refactor
2015-02-17 18:01:24 +08:00
Jinzhu
803343fbe5
Fix scope.getField
2015-02-17 14:30:37 +08:00
Jinzhu
de3f2a5c46
Refactor Fields
2015-02-16 17:47:07 +08:00
Jinzhu
1726cebc2e
update
2015-02-16 12:04:46 +08:00
Jinzhu
5d692a6bf2
Try to cache struct fields
2015-02-15 23:01:09 +08:00
Jinzhu
f97e2c088e
Make Preload works with has_one, has_many, belongs_to relations
2015-02-11 17:17:27 +08:00
Jinzhu
9757958106
Fix pointers for AutoMigrate
2015-02-09 21:14:48 +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
Paolo Galeone
064d91335b
Add default values support ( https://github.com/jinzhu/gorm/issues/251 )
2014-11-15 18:32:35 +01:00
Tristan Storch
f1212ecd58
Readability update
...
Small readability update. Includes also a switch from bool return values to
error return values in Scope.SetColumn and Field.Set.
2014-09-30 14:02:51 +02:00
Jinzhu
59846f0e9b
Fix tests for association
2014-09-02 20:10:18 +08:00
Jinzhu
953c347ba7
Refactor Scope
2014-09-02 19:03:01 +08:00
Jinzhu
6271cf0e55
Fix tests for postgres
2014-08-30 22:39:28 +08:00
Jinzhu
d806b7084f
Pass anonymous struct tests
2014-08-30 21:42:35 +08:00
Jinzhu
90106d82c5
Export Relationship
2014-07-31 14:38:16 +08:00
Jinzhu
6c4b635176
Replace BeforeAssociation, AfterAssociation with association type
2014-07-30 21:14:10 +08:00
Jinzhu
2356182ea7
Rename joinTable to relationship
2014-07-30 20:59:52 +08:00
Jinzhu
a7aaf151cf
Use JoinTable instead of ForeignKey
2014-07-30 11:32:18 +08:00
Jinzhu
f56e071375
Refact parse SQL tag, set default size to 255
2014-07-29 17:52:23 +08:00
Jinzhu
2d3bcf5297
Refact untils.go
2014-07-25 16:53:28 +08:00
Jinzhu
67b9e2a9ad
Fix typo
2014-07-25 15:49:23 +08:00
Chris Aumann
4772acb1c4
Add basic support for DEFAULT values
2014-07-21 23:37:40 +02:00
Jinzhu
241b6bc3b9
refact
2014-01-29 10:35:28 +08:00
Jinzhu
a2edf56c58
Remove unused codes
2014-01-28 16:06:22 +08:00
Jinzhu
3981baf65d
Make callback create pass all tests
2014-01-27 10:47:37 +08:00
Jinzhu
ee6a6827a8
implement callback shared
2014-01-27 08:26:59 +08:00
Jinzhu
8dd7b4ed91
make callback create works
2014-01-26 19:36:15 +08:00
Jinzhu
2409c26710
Ignore association with sql tag
2014-01-23 08:50:39 +08:00
Jinzhu
0208ce7901
Fix []byte type
2013-11-21 13:47:49 +08:00
Jinzhu
bf1db1534e
Use channel to make gorm faster
2013-11-17 09:50:34 +08:00
Jinzhu
9a1c0d956d
cache snake, upper values
2013-11-17 08:28:30 +08:00
Jinzhu
0ad707b410
Yay, all tests passed
2013-11-16 18:42:47 +08:00
Jinzhu
ca6b074dc6
Refact do
2013-11-16 13:28:22 +08:00
Jinzhu
045b3b6fbc
Fix errors in field.go, model.go
2013-11-16 12:22:18 +08:00
Jinzhu
2d34ecd6a9
Refact Code
2013-11-15 11:36:27 +08:00
Jinzhu
c354b0fb06
Refact field struct
2013-11-14 22:12:32 +08:00
Jinzhu
e4612bde9c
Separate Field Struct
2013-11-14 21:26:02 +08:00