func (pollsCountyL) LoadPoll(ctx context.Context, e boil.ContextExecutor, singular bool, maybePollsCounty interface{}, mods queries.Applicator) error {
	var slice []*PollsCounty
	var object *PollsCounty

	if singular {
		object = maybePollsCounty.(*PollsCounty)
	} else {
		slice = *maybePollsCounty.(*[]*PollsCounty)
	}

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

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

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

	query := NewQuery(qm.From(`polls`), qm.WhereIn(`poll_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 Poll")
	}

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

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

	if len(pollsCountyAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(ctx, e); err != nil {
				return err
			}
		}
	}

	if len(resultSlice) == 0 {
		return nil
	}

	if singular {
		foreign := resultSlice[0]
		object.R.Poll = foreign
		if foreign.R == nil {
			foreign.R = &pollR{}
		}
		foreign.R.PollsCounties = append(foreign.R.PollsCounties, object)
		return nil
	}

	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.PollID == foreign.PollID {
				local.R.Poll = foreign
				if foreign.R == nil {
					foreign.R = &pollR{}
				}
				foreign.R.PollsCounties = append(foreign.R.PollsCounties, local)
				break
			}
		}
	}

	return nil
}
// LoadPoll allows an eager lookup of values, cached into the
// loaded structs of the objects. This is for an N-1 relationship.
LoadPoll allows an eager lookup of values, cached into the
loaded structs of the objects. This is for an N-1 relationship.
// LoadPoll allows an eager lookup of values cached into the // loaded structs of the objects . This is for an N - 1 relationship .
func (pollsCountyL) LoadPoll(ctx context.Context, e boil.ContextExecutor, singular bool, maybePollsCounty interface{}, mods queries.Applicator) error {
	var slice []*PollsCounty
	var object *PollsCounty
	if singular {
		object = maybePollsCounty.(*PollsCounty)
	} else {
		slice = *maybePollsCounty.(*[]*PollsCounty)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &pollsCountyR{}
		}
		args = append(args, object.PollID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &pollsCountyR{}
			}
			for _, a := range args {
				if a == obj.PollID {
					continue Outer
				}
			}
			args = append(args, obj.PollID)
		}
	}
	query := NewQuery(qm.From(`polls`), qm.WhereIn(`poll_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 Poll")
	}
	var resultSlice []*Poll
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Poll")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results of eager load for polls")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for polls")
	}
	if len(pollsCountyAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(ctx, e); err != nil {
				return err
			}
		}
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		foreign := resultSlice[0]
		object.R.Poll = foreign
		if foreign.R == nil {
			foreign.R = &pollR{}
		}
		foreign.R.PollsCounties = append(foreign.R.PollsCounties, object)
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.PollID == foreign.PollID {
				local.R.Poll = foreign
				if foreign.R == nil {
					foreign.R = &pollR{}
				}
				foreign.R.PollsCounties = append(foreign.R.PollsCounties, local)
				break
			}
		}
	}
	return nil
}
func ( pollsCountyL ) LoadPoll ( ctx context . Context , e boil . ContextExecutor , singular bool , maybePollsCounty interface { } , mods queries . Applicator ) error { var slice [ ] * PollsCounty var object * PollsCounty if singular { object = maybePollsCounty . ( * PollsCounty ) } else { slice = * maybePollsCounty . ( * [ ] * PollsCounty ) } args := make ( [ ] interface { } , 0 , 1 ) if singular { if object . R == nil { object . R = & pollsCountyR { } } args = append ( args , object . PollID ) } else { Outer : for _ , obj := range slice { if obj . R == nil { obj . R = & pollsCountyR { } } for _ , a := range args { if a == obj . PollID { continue Outer } } args = append ( args , obj . PollID ) } } query := NewQuery ( qm . From ( `polls` ) , qm . WhereIn ( `poll_id in ?` , args ... ) ) if mods != nil { mods . Apply ( query ) } results , err := query . QueryContext ( ctx , e ) if err != nil { return errors . Wrap ( err , " " ) } var resultSlice [ ] * Poll 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 ( pollsCountyAfterSelectHooks ) != 0 { for _ , obj := range resultSlice { if err := obj . doAfterSelectHooks ( ctx , e ) ; err != nil { return err } } } if len ( resultSlice ) == 0 { return nil } if singular { foreign := resultSlice [ 0 ] object . R . Poll = foreign if foreign . R == nil { foreign . R = & pollR { } } foreign . R . PollsCounties = append ( foreign . R . PollsCounties , object ) return nil } for _ , local := range slice { for _ , foreign := range resultSlice { if local . PollID == foreign . PollID { local . R . Poll = foreign if foreign . R == nil { foreign . R = & pollR { } } foreign . R . PollsCounties = append ( foreign . R . PollsCounties , local ) break } } } return nil }
LoadPoll allows an eager lookup of values, cached into the
loaded structs of the objects.
LoadPoll allows an eager lookup of values cached into the loaded structs of the objects .