Compare commits

..

3 commits

Author SHA1 Message Date
Mark
6b4e052bed
Merge pull request #10 from lbryio/eagerloading_depth
Fix multi-depth eager loading of relationships. If a relationship is …
2020-09-02 15:59:52 -04:00
Mark Beamer Jr
3db4f30f56
Fix multi-depth eager loading of relationships. If a relationship is nil, do not add it to the collection for checking the next depth level. 2020-08-19 23:43:39 -04:00
Niko Storni
256a6d4225 update lbry.go library 2020-03-05 16:29:03 -05:00

View file

@ -5,9 +5,9 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/pkg/errors"
"github.com/lbryio/sqlboiler/boil" "github.com/lbryio/sqlboiler/boil"
"github.com/lbryio/sqlboiler/strmangle" "github.com/lbryio/sqlboiler/strmangle"
"github.com/pkg/errors"
) )
type loadRelationshipState struct { type loadRelationshipState struct {
@ -259,10 +259,14 @@ func collectLoaded(key string, loadingFrom reflect.Value) (reflect.Value, bindKi
for { for {
switch bkind { switch bkind {
case kindStruct: case kindStruct:
if !loadedObject.IsNil() {
collection = reflect.Append(collection, loadedObject) collection = reflect.Append(collection, loadedObject)
}
case kindPtrSliceStruct: case kindPtrSliceStruct:
if !loadedObject.IsNil() {
collection = reflect.AppendSlice(collection, loadedObject) collection = reflect.AppendSlice(collection, loadedObject)
} }
}
i++ i++
if i >= lnFrom { if i >= lnFrom {