Commit Graph

39 Commits

Author SHA1 Message Date
Jinzhu 41620f3d6c Fix assign relations to duplicated pointer fields 2016-01-15 11:04:49 +08:00
Jinzhu 79c4fae34d Refactor handleManyToManyPreload 2016-01-15 10:08:22 +08:00
Jinzhu bfd421f999 Add TestNestedManyToManyPreload3 2016-01-13 16:00:43 +08:00
Jinzhu aa55bd3fd2 Add more tests for customized foreign keys for many2many relations 2016-01-03 17:20:24 +08:00
Jinzhu f53af2a236 Don't preload if has any error 2016-01-03 14:21:21 +08:00
Richard Knop 39e6f58111 There was still an issue with preloading and pointers.
This was actually broken with the refactoring. I added a test to catch
the other place the error was occuring. See the new
TestManyToManyPreloadForNestedPointer test in preload_test.go.
2015-12-16 17:30:58 +08:00
Jinzhu c6a22c5096 Refact fix invalid zero value for Preload 2015-12-16 10:40:57 +08:00
Richard Knop e69ffaa9c4 Fixed a bug with invalid zero value in preload
When using pointers in model structs, there is an edge case.

When using preload to eagerly preload a many to many relationship and
the main row is not found by a primary key, use of reflect.Indirect in
preload.go results in a zero value and the subsequent call to
FieldByName panics the program.
2015-12-16 00:18:39 +08:00
Jinzhu 807ed63cfe Fix pollute model's fields with join table's values 2015-12-09 10:40:12 +08:00
Jinzhu 2f9abdcf02 Fix preload many2many problem when no search results, #688 2015-11-16 12:20:00 +08:00
Jinzhu eeb9ba2250 Fix query with Joins 2015-10-01 07:43:43 +08:00
Nikola Kovacs 7f1a4cf301 Fix panic: reflect.Value.Addr of unaddressable value 2015-09-24 13:34:51 +02:00
Jinzhu 9982134955 Fix preload many2many with multiple primary keys 2015-08-18 09:19:50 +08:00
Jinzhu 6a6c1bf762 Remove not necessary PreloadWithJoin 2015-08-18 08:05:44 +08:00
Jinzhu a24417824d More improvements for preload many2many 2015-08-18 07:43:08 +08:00
kimiby 07571d1adf increase performance m2m preload 2015-08-17 22:28:40 +03:00
Jinzhu f8e2f04562 Some Tweaks for Preload Many2Many, Add tests with inline conditions 2015-08-17 23:09:07 +08:00
kimiby 281c5d10f6 preload_m2m improve 2015-08-16 12:36:23 +03:00
kimiby f35dee5531 preload_m2m fix and test 2015-08-16 12:25:25 +03:00
kimiby 42c3f39163 m2m preload 2015-08-16 10:10:11 +03:00
Jinzhu f50956cfef Fix test TestSelectWithCreate 2015-07-30 22:36:04 +08:00
Jinzhu 4e8272cf9d Fix compile error for preload 2015-07-30 18:19:49 +08:00
Joakim Lundborg 14dde4b9f2 Correct error message 2015-06-11 16:14:36 +02:00
crystalin f05a6b3794 Support for preload of Struct Ptr
This fixes the issue when preloading .Preload("Project.Repositories").Find(&[]User{})
with 
type User struct {
  Project *Project
}

type Project struct {
  Repositories []Repository
}

type Repository struct {
...
}
2015-06-05 12:54:52 +02:00
Jinzhu 7693c093a9 Refactor Preload 2015-04-22 15:36:10 +08:00
bom_d_van 9e9367e815 refactor preload and its tests 2015-04-21 16:52:18 +08:00
bom_d_van 6d58dc9f4e support nested preloading 2015-04-21 16:52:18 +08:00
Jinzhu 0e2cd4475f Only load Fields when defined preload 2015-04-16 18:42:35 +08:00
Jinzhu 6e5d46bf37 Refactor Search API 2015-03-12 14:47:07 +08:00
Jinzhu 49454839bd Support Multi primary keys 2015-03-11 11:28:30 +08:00
Jinzhu b3d6025365 Fix preload error when result is empty 2015-03-02 10:52:18 +08:00
Jinzhu 5586d04999 Uniq foreign key for Preload 2015-02-24 15:50:02 +08:00
Jinzhu 0b32041135 Review and Refactor 2015-02-17 22:55:14 +08:00
Jinzhu 3a73206010 Refactor model struct 2015-02-16 16:35:26 +08:00
Jinzhu b3b87d9c45 Fix Preload belongs to relations has same records 2015-02-12 13:50:16 +08:00
Jinzhu 24e0de116a Add inline condition support for Preload 2015-02-11 19:08:42 +08:00
Jinzhu aac52fdcf8 Fix Preload with slice of pointer 2015-02-11 17:58:19 +08:00
Jinzhu f97e2c088e Make Preload works with has_one, has_many, belongs_to relations 2015-02-11 17:17:27 +08:00
Jinzhu dd635a17c2 Preload belongs_to, has_one, has_many relations 2015-02-11 13:43:53 +08:00