func (suburbL) LoadStreets(ctx context.Context, e boil.ContextExecutor, singular bool, maybeSuburb interface{}, mods queries.Applicator) error {
	var slice []*Suburb
	var object *Suburb

	if singular {
		object = maybeSuburb.(*Suburb)
	} else {
		slice = *maybeSuburb.(*[]*Suburb)
	}

	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &suburbR{}
		}
		args = append(args, object.SuburbID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &suburbR{}
			}

			for _, a := range args {
				if a == obj.SuburbID {
					continue Outer
				}
			}

			args = append(args, obj.SuburbID)
		}
	}

	query := NewQuery(qm.From(`street`), qm.WhereIn(`suburb_id in ?`, args...))
	if mods != nil {
		mods.Apply(query)
	}

	results, err := query.QueryContext(ctx, e)
	if err != nil {
		return errors.Wrap(err, "failed to eager load street")
	}

	var resultSlice []*Street
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice street")
	}

	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results in eager load on street")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for street")
	}

	if len(streetAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(ctx, e); err != nil {
				return err
			}
		}
	}
	if singular {
		object.R.Streets = resultSlice
		for _, foreign := range resultSlice {
			if foreign.R == nil {
				foreign.R = &streetR{}
			}
			foreign.R.Suburb = object
		}
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.SuburbID == foreign.SuburbID {
				local.R.Streets = append(local.R.Streets, foreign)
				if foreign.R == nil {
					foreign.R = &streetR{}
				}
				foreign.R.Suburb = local
				break
			}
		}
	}

	return nil
}
// LoadStreets allows an eager lookup of values, cached into the
// loaded structs of the objects. This is for a 1-M or N-M relationship.
LoadStreets allows an eager lookup of values, cached into the
loaded structs of the objects. This is for a 1-M or N-M relationship.
// LoadStreets allows an eager lookup of values cached into the // loaded structs of the objects . This is for a 1 - M or N - M relationship .
func (suburbL) LoadStreets(ctx context.Context, e boil.ContextExecutor, singular bool, maybeSuburb interface{}, mods queries.Applicator) error {
	var slice []*Suburb
	var object *Suburb
	if singular {
		object = maybeSuburb.(*Suburb)
	} else {
		slice = *maybeSuburb.(*[]*Suburb)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &suburbR{}
		}
		args = append(args, object.SuburbID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &suburbR{}
			}
			for _, a := range args {
				if a == obj.SuburbID {
					continue Outer
				}
			}
			args = append(args, obj.SuburbID)
		}
	}
	query := NewQuery(qm.From(`street`), qm.WhereIn(`suburb_id in ?`, args...))
	if mods != nil {
		mods.Apply(query)
	}
	results, err := query.QueryContext(ctx, e)
	if err != nil {
		return errors.Wrap(err, "failed to eager load street")
	}
	var resultSlice []*Street
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice street")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results in eager load on street")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for street")
	}
	if len(streetAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(ctx, e); err != nil {
				return err
			}
		}
	}
	if singular {
		object.R.Streets = resultSlice
		for _, foreign := range resultSlice {
			if foreign.R == nil {
				foreign.R = &streetR{}
			}
			foreign.R.Suburb = object
		}
		return nil
	}
	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.SuburbID == foreign.SuburbID {
				local.R.Streets = append(local.R.Streets, foreign)
				if foreign.R == nil {
					foreign.R = &streetR{}
				}
				foreign.R.Suburb = local
				break
			}
		}
	}
	return nil
}
func ( suburbL ) LoadStreets ( ctx context . Context , e boil . ContextExecutor , singular bool , maybeSuburb interface { } , mods queries . Applicator ) error { var slice [ ] * Suburb var object * Suburb if singular { object = maybeSuburb . ( * Suburb ) } else { slice = * maybeSuburb . ( * [ ] * Suburb ) } args := make ( [ ] interface { } , 0 , 1 ) if singular { if object . R == nil { object . R = & suburbR { } } args = append ( args , object . SuburbID ) } else { Outer : for _ , obj := range slice { if obj . R == nil { obj . R = & suburbR { } } for _ , a := range args { if a == obj . SuburbID { continue Outer } } args = append ( args , obj . SuburbID ) } } query := NewQuery ( qm . From ( `street` ) , qm . WhereIn ( `suburb_id in ?` , args ... ) ) if mods != nil { mods . Apply ( query ) } results , err := query . QueryContext ( ctx , e ) if err != nil { return errors . Wrap ( err , " " ) } var resultSlice [ ] * Street if err = queries . Bind ( results , & resultSlice ) ; err != nil { return errors . Wrap ( err , " " ) } if err = results . Close ( ) ; err != nil { return errors . Wrap ( err , " " ) } if err = results . Err ( ) ; err != nil { return errors . Wrap ( err , " " ) } if len ( streetAfterSelectHooks ) != 0 { for _ , obj := range resultSlice { if err := obj . doAfterSelectHooks ( ctx , e ) ; err != nil { return err } } } if singular { object . R . Streets = resultSlice for _ , foreign := range resultSlice { if foreign . R == nil { foreign . R = & streetR { } } foreign . R . Suburb = object } return nil } for _ , foreign := range resultSlice { for _ , local := range slice { if local . SuburbID == foreign . SuburbID { local . R . Streets = append ( local . R . Streets , foreign ) if foreign . R == nil { foreign . R = & streetR { } } foreign . R . Suburb = local break } } } return nil }
LoadStreets allows an eager lookup of values, cached into the
loaded structs of the objects.
LoadStreets allows an eager lookup of values cached into the loaded structs of the objects .