Merge pull request #10 from lbryio/eagerloading_depth

Fix multi-depth eager loading of relationships. If a relationship is …
This commit is contained in:
Mark 2020-09-02 15:59:52 -04:00 committed by GitHub
commit 6b4e052bed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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