func (o *Continent) AddPollsContinents(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*PollsContinent) error {
	var err error
	for _, rel := range related {
		if insert {
			rel.ContinentID = o.ContinentID2
			if err = rel.Insert(ctx, exec, boil.Infer()); err != nil {
				return errors.Wrap(err, "failed to insert into foreign table")
			}
		} else {
			updateQuery := fmt.Sprintf(
				"UPDATE \"polls_continent\" SET %s WHERE %s",
				strmangle.SetParamNames("\"", "\"", 1, []string{"continent_id"}),
				strmangle.WhereClause("\"", "\"", 2, pollsContinentPrimaryKeyColumns),
			)
			values := []interface{}{o.ContinentID2, rel.PollContinentID}

			if boil.DebugMode {
				fmt.Fprintln(boil.DebugWriter, updateQuery)
				fmt.Fprintln(boil.DebugWriter, values)
			}

			if _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {
				return errors.Wrap(err, "failed to update foreign table")
			}

			rel.ContinentID = o.ContinentID2
		}
	}

	if o.R == nil {
		o.R = &continentR{
			PollsContinents: related,
		}
	} else {
		o.R.PollsContinents = append(o.R.PollsContinents, related...)
	}

	for _, rel := range related {
		if rel.R == nil {
			rel.R = &pollsContinentR{
				Continent: o,
			}
		} else {
			rel.R.Continent = o
		}
	}
	return nil
}
// AddPollsContinents adds the given related objects to the existing relationships
// of the continent, optionally inserting them as new records.
// Appends related to o.R.PollsContinents.
// Sets related.R.Continent appropriately.
AddPollsContinents adds the given related objects to the existing relationships
of the continent, optionally inserting them as new records.
Appends related to o.R.PollsContinents.
Sets related.R.Continent appropriately.
// AddPollsContinents adds the given related objects to the existing relationships // of the continent optionally inserting them as new records . // Appends related to o . R . PollsContinents . // Sets related . R . Continent appropriately .
func (o *Continent) AddPollsContinents(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*PollsContinent) error {
	var err error
	for _, rel := range related {
		if insert {
			rel.ContinentID = o.ContinentID2
			if err = rel.Insert(ctx, exec, boil.Infer()); err != nil {
				return errors.Wrap(err, "failed to insert into foreign table")
			}
		} else {
			updateQuery := fmt.Sprintf(
				"UPDATE \"polls_continent\" SET %s WHERE %s",
				strmangle.SetParamNames("\"", "\"", 1, []string{"continent_id"}),
				strmangle.WhereClause("\"", "\"", 2, pollsContinentPrimaryKeyColumns),
			)
			values := []interface{}{o.ContinentID2, rel.PollContinentID}
			if boil.DebugMode {
				fmt.Fprintln(boil.DebugWriter, updateQuery)
				fmt.Fprintln(boil.DebugWriter, values)
			}
			if _, err = exec.ExecContext(ctx, updateQuery, values...); err != nil {
				return errors.Wrap(err, "failed to update foreign table")
			}
			rel.ContinentID = o.ContinentID2
		}
	}
	if o.R == nil {
		o.R = &continentR{
			PollsContinents: related,
		}
	} else {
		o.R.PollsContinents = append(o.R.PollsContinents, related...)
	}
	for _, rel := range related {
		if rel.R == nil {
			rel.R = &pollsContinentR{
				Continent: o,
			}
		} else {
			rel.R.Continent = o
		}
	}
	return nil
}
func ( o * Continent ) AddPollsContinents ( ctx context . Context , exec boil . ContextExecutor , insert bool , related ... * PollsContinent ) error { var err error for _ , rel := range related { if insert { rel . ContinentID = o . ContinentID2 if err = rel . Insert ( ctx , exec , boil . Infer ( ) ) ; err != nil { return errors . Wrap ( err , " " ) } } else { updateQuery := fmt . Sprintf ( " \" \" " , strmangle . SetParamNames ( " \" " , " \" " , 1 , [ ] string { " " } ) , strmangle . WhereClause ( " \" " , " \" " , 2 , pollsContinentPrimaryKeyColumns ) , ) values := [ ] interface { } { o . ContinentID2 , rel . PollContinentID } if boil . DebugMode { fmt . Fprintln ( boil . DebugWriter , updateQuery ) fmt . Fprintln ( boil . DebugWriter , values ) } if _ , err = exec . ExecContext ( ctx , updateQuery , values ... ) ; err != nil { return errors . Wrap ( err , " " ) } rel . ContinentID = o . ContinentID2 } } if o . R == nil { o . R = & continentR { PollsContinents : related , } } else { o . R . PollsContinents = append ( o . R . PollsContinents , related ... ) } for _ , rel := range related { if rel . R == nil { rel . R = & pollsContinentR { Continent : o , } } else { rel . R . Continent = o } } return nil }
AddPollsContinents adds the given related objects to the existing relationships
of the continent, optionally inserting them as new records.
AddPollsContinents adds the given related objects to the existing relationships of the continent optionally inserting them as new records .