// SetUserPersonalInfo of the userPersonalInfoTitleAfterLastName to the related item.
// Sets o.R.UserPersonalInfo to related.
// Adds o to related.R.UserPersonalInfoTitleAfterLastNames.
SetUserPersonalInfo of the userPersonalInfoTitleAfterLastName to the related item.
Sets o.R.UserPersonalInfo to related.
Adds o to related.R.UserPersonalInfoTitleAfterLastNames.
// SetUserPersonalInfo of the userPersonalInfoTitleAfterLastName to the related item . // Sets o . R . UserPersonalInfo to related . // Adds o to related . R . UserPersonalInfoTitleAfterLastNames .
func (o *UserPersonalInfoTitleAfterLastName) SetUserPersonalInfo(ctx context.Context, exec boil.ContextExecutor, insert bool, related *UserPersonalInfo) 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 \"user_personal_info_title_after_last_name\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"user_personal_info_id"}),
		strmangle.WhereClause("\"", "\"", 2, userPersonalInfoTitleAfterLastNamePrimaryKeyColumns),
	)
	values := []interface{}{related.UserPersonalInfoID, o.UserPersonalInfoTitleAfterLastNameID}
	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.UserPersonalInfoID = related.UserPersonalInfoID
	if o.R == nil {
		o.R = &userPersonalInfoTitleAfterLastNameR{
			UserPersonalInfo: related,
		}
	} else {
		o.R.UserPersonalInfo = related
	}
	if related.R == nil {
		related.R = &userPersonalInfoR{
			UserPersonalInfoTitleAfterLastNames: UserPersonalInfoTitleAfterLastNameSlice{o},
		}
	} else {
		related.R.UserPersonalInfoTitleAfterLastNames = append(related.R.UserPersonalInfoTitleAfterLastNames, o)
	}
	return nil
}
func ( o * UserPersonalInfoTitleAfterLastName ) SetUserPersonalInfo ( ctx context . Context , exec boil . ContextExecutor , insert bool , related * UserPersonalInfo ) 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 , userPersonalInfoTitleAfterLastNamePrimaryKeyColumns ) , ) values := [ ] interface { } { related . UserPersonalInfoID , o . UserPersonalInfoTitleAfterLastNameID } 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 . UserPersonalInfoID = related . UserPersonalInfoID if o . R == nil { o . R = & userPersonalInfoTitleAfterLastNameR { UserPersonalInfo : related , } } else { o . R . UserPersonalInfo = related } if related . R == nil { related . R = & userPersonalInfoR { UserPersonalInfoTitleAfterLastNames : UserPersonalInfoTitleAfterLastNameSlice { o } , } } else { related . R . UserPersonalInfoTitleAfterLastNames = append ( related . R . UserPersonalInfoTitleAfterLastNames , o ) } return nil }
SetUserPersonalInfo of the userPersonalInfoTitleAfterLastName to the related item.
SetUserPersonalInfo of the userPersonalInfoTitleAfterLastName to the related item .