func (o *EmailAddress) SetEmailDomain(ctx context.Context, exec boil.ContextExecutor, insert bool, related *EmailDomain) error {
	var err error
	if insert {
		if err = related.Insert(ctx, exec, boil.Infer()); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"email_address\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"email_domain_id"}),
		strmangle.WhereClause("\"", "\"", 2, emailAddressPrimaryKeyColumns),
	)
	values := []interface{}{related.EmailDomainID, o.EmailName, o.EmailDomainID}

	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 local table")
	}

	o.EmailDomainID = related.EmailDomainID
	if o.R == nil {
		o.R = &emailAddressR{
			EmailDomain: related,
		}
	} else {
		o.R.EmailDomain = related
	}

	if related.R == nil {
		related.R = &emailDomainR{
			EmailAddresses: EmailAddressSlice{o},
		}
	} else {
		related.R.EmailAddresses = append(related.R.EmailAddresses, o)
	}

	return nil
}
// SetEmailDomain of the emailAddress to the related item.
// Sets o.R.EmailDomain to related.
// Adds o to related.R.EmailAddresses.
SetEmailDomain of the emailAddress to the related item.
Sets o.R.EmailDomain to related.
Adds o to related.R.EmailAddresses.
// SetEmailDomain of the emailAddress to the related item . // Sets o . R . EmailDomain to related . // Adds o to related . R . EmailAddresses .
func (o *EmailAddress) SetEmailDomain(ctx context.Context, exec boil.ContextExecutor, insert bool, related *EmailDomain) error {
	var err error
	if insert {
		if err = related.Insert(ctx, exec, boil.Infer()); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}
	updateQuery := fmt.Sprintf(
		"UPDATE \"email_address\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"email_domain_id"}),
		strmangle.WhereClause("\"", "\"", 2, emailAddressPrimaryKeyColumns),
	)
	values := []interface{}{related.EmailDomainID, o.EmailName, o.EmailDomainID}
	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 local table")
	}
	o.EmailDomainID = related.EmailDomainID
	if o.R == nil {
		o.R = &emailAddressR{
			EmailDomain: related,
		}
	} else {
		o.R.EmailDomain = related
	}
	if related.R == nil {
		related.R = &emailDomainR{
			EmailAddresses: EmailAddressSlice{o},
		}
	} else {
		related.R.EmailAddresses = append(related.R.EmailAddresses, o)
	}
	return nil
}
func ( o * EmailAddress ) SetEmailDomain ( ctx context . Context , exec boil . ContextExecutor , insert bool , related * EmailDomain ) error { var err error if insert { if err = related . Insert ( ctx , exec , boil . Infer ( ) ) ; err != nil { return errors . Wrap ( err , " " ) } } updateQuery := fmt . Sprintf ( " \" \" " , strmangle . SetParamNames ( " \" " , " \" " , 1 , [ ] string { " " } ) , strmangle . WhereClause ( " \" " , " \" " , 2 , emailAddressPrimaryKeyColumns ) , ) values := [ ] interface { } { related . EmailDomainID , o . EmailName , o . EmailDomainID } 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 , " " ) } o . EmailDomainID = related . EmailDomainID if o . R == nil { o . R = & emailAddressR { EmailDomain : related , } } else { o . R . EmailDomain = related } if related . R == nil { related . R = & emailDomainR { EmailAddresses : EmailAddressSlice { o } , } } else { related . R . EmailAddresses = append ( related . R . EmailAddresses , o ) } return nil }
SetEmailDomain of the emailAddress to the related item.
SetEmailDomain of the emailAddress to the related item .