func (voteL) LoadUserAccount(ctx context.Context, e boil.ContextExecutor, singular bool, maybeVote interface{}, mods queries.Applicator) error {
	var slice []*Vote
	var object *Vote

	if singular {
		object = maybeVote.(*Vote)
	} else {
		slice = *maybeVote.(*[]*Vote)
	}

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

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

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

	query := NewQuery(qm.From(`user_account`), qm.WhereIn(`user_account_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 UserAccount")
	}

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

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

	if len(voteAfterSelectHooks) != 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.UserAccount = foreign
		if foreign.R == nil {
			foreign.R = &userAccountR{}
		}
		foreign.R.Votes = append(foreign.R.Votes, object)
		return nil
	}

	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.UserAccountID == foreign.UserAccountID {
				local.R.UserAccount = foreign
				if foreign.R == nil {
					foreign.R = &userAccountR{}
				}
				foreign.R.Votes = append(foreign.R.Votes, local)
				break
			}
		}
	}

	return nil
}
// LoadUserAccount allows an eager lookup of values, cached into the
// loaded structs of the objects. This is for an N-1 relationship.
LoadUserAccount allows an eager lookup of values, cached into the
loaded structs of the objects. This is for an N-1 relationship.
// LoadUserAccount allows an eager lookup of values cached into the // loaded structs of the objects . This is for an N - 1 relationship .
func (voteL) LoadUserAccount(ctx context.Context, e boil.ContextExecutor, singular bool, maybeVote interface{}, mods queries.Applicator) error {
	var slice []*Vote
	var object *Vote
	if singular {
		object = maybeVote.(*Vote)
	} else {
		slice = *maybeVote.(*[]*Vote)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &voteR{}
		}
		args = append(args, object.UserAccountID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &voteR{}
			}
			for _, a := range args {
				if a == obj.UserAccountID {
					continue Outer
				}
			}
			args = append(args, obj.UserAccountID)
		}
	}
	query := NewQuery(qm.From(`user_account`), qm.WhereIn(`user_account_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 UserAccount")
	}
	var resultSlice []*UserAccount
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice UserAccount")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results of eager load for user_account")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for user_account")
	}
	if len(voteAfterSelectHooks) != 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.UserAccount = foreign
		if foreign.R == nil {
			foreign.R = &userAccountR{}
		}
		foreign.R.Votes = append(foreign.R.Votes, object)
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.UserAccountID == foreign.UserAccountID {
				local.R.UserAccount = foreign
				if foreign.R == nil {
					foreign.R = &userAccountR{}
				}
				foreign.R.Votes = append(foreign.R.Votes, local)
				break
			}
		}
	}
	return nil
}
func ( voteL ) LoadUserAccount ( ctx context . Context , e boil . ContextExecutor , singular bool , maybeVote interface { } , mods queries . Applicator ) error { var slice [ ] * Vote var object * Vote if singular { object = maybeVote . ( * Vote ) } else { slice = * maybeVote . ( * [ ] * Vote ) } args := make ( [ ] interface { } , 0 , 1 ) if singular { if object . R == nil { object . R = & voteR { } } args = append ( args , object . UserAccountID ) } else { Outer : for _ , obj := range slice { if obj . R == nil { obj . R = & voteR { } } for _ , a := range args { if a == obj . UserAccountID { continue Outer } } args = append ( args , obj . UserAccountID ) } } query := NewQuery ( qm . From ( `user_account` ) , qm . WhereIn ( `user_account_id in ?` , args ... ) ) if mods != nil { mods . Apply ( query ) } results , err := query . QueryContext ( ctx , e ) if err != nil { return errors . Wrap ( err , " " ) } var resultSlice [ ] * UserAccount 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 ( voteAfterSelectHooks ) != 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 . UserAccount = foreign if foreign . R == nil { foreign . R = & userAccountR { } } foreign . R . Votes = append ( foreign . R . Votes , object ) return nil } for _ , local := range slice { for _ , foreign := range resultSlice { if local . UserAccountID == foreign . UserAccountID { local . R . UserAccount = foreign if foreign . R == nil { foreign . R = & userAccountR { } } foreign . R . Votes = append ( foreign . R . Votes , local ) break } } } return nil }
LoadUserAccount allows an eager lookup of values, cached into the
loaded structs of the objects.
LoadUserAccount allows an eager lookup of values cached into the loaded structs of the objects .