func (o *PublisherI18n) SetUser(exec boil.Executor, insert bool, related *User) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}
	updateQuery := fmt.Sprintf(
		"UPDATE \"publisher_i18n\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"user_id"}),
		strmangle.WhereClause("\"", "\"", 2, publisherI18nPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.PublisherID, o.Language}
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}
	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}
	o.UserID.Int64 = related.ID
	o.UserID.Valid = true
	if o.R == nil {
		o.R = &publisherI18nR{
			User: related,
		}
	} else {
		o.R.User = related
	}
	if related.R == nil {
		related.R = &userR{
			PublisherI18ns: PublisherI18nSlice{o},
		}
	} else {
		related.R.PublisherI18ns = append(related.R.PublisherI18ns, o)
	}
	return nil
}
SetUser of the publisher_i18n to the related item.
Sets o.R.User to related.
Adds o to related.R.PublisherI18ns.
package mdbmodels
import (
	"bytes"
	"database/sql"
	"fmt"
	"reflect"
	"strings"
	"sync"
	"time"
	"github.com/Bnei-Baruch/sqlboiler/boil"
	"github.com/Bnei-Baruch/sqlboiler/queries"
	"github.com/Bnei-Baruch/sqlboiler/queries/qm"
	"github.com/Bnei-Baruch/sqlboiler/strmangle"
	"github.com/pkg/errors"
	"gopkg.in/volatiletech/null.v6"
)
type PublisherI18n struct {
	PublisherID      int64       `boil:"publisher_id" json:"publisher_id" toml:"publisher_id" yaml:"publisher_id"`
	Language         string      `boil:"language" json:"language" toml:"language" yaml:"language"`
	OriginalLanguage null.String `boil:"original_language" json:"original_language,omitempty" toml:"original_language" yaml:"original_language,omitempty"`
	Name             null.String `boil:"name" json:"name,omitempty" toml:"name" yaml:"name,omitempty"`
	Description      null.String `boil:"description" json:"description,omitempty" toml:"description" yaml:"description,omitempty"`
	UserID           null.Int64  `boil:"user_id" json:"user_id,omitempty" toml:"user_id" yaml:"user_id,omitempty"`
	CreatedAt        time.Time   `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	R *publisherI18nR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L publisherI18nL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var PublisherI18nColumns = struct {
	PublisherID      string
	Language         string
	OriginalLanguage string
	Name             string
	Description      string
	UserID           string
	CreatedAt        string
}{
	PublisherID:      "publisher_id",
	Language:         "language",
	OriginalLanguage: "original_language",
	Name:             "name",
	Description:      "description",
	UserID:           "user_id",
	CreatedAt:        "created_at",
}
type publisherI18nR struct {
	Publisher *Publisher
	User      *User
}
type publisherI18nL struct{}
var (
	publisherI18nColumns               = []string{"publisher_id", "language", "original_language", "name", "description", "user_id", "created_at"}
	publisherI18nColumnsWithoutDefault = []string{"publisher_id", "language", "original_language", "name", "description", "user_id"}
	publisherI18nColumnsWithDefault    = []string{"created_at"}
	publisherI18nPrimaryKeyColumns     = []string{"publisher_id", "language"}
)
type (
	PublisherI18nSlice []*PublisherI18n
	publisherI18nQuery struct {
		*queries.Query
	}
)
var (
	publisherI18nType                 = reflect.TypeOf(&PublisherI18n{})
	publisherI18nMapping              = queries.MakeStructMapping(publisherI18nType)
	publisherI18nPrimaryKeyMapping, _ = queries.BindMapping(publisherI18nType, publisherI18nMapping, publisherI18nPrimaryKeyColumns)
	publisherI18nInsertCacheMut       sync.RWMutex
	publisherI18nInsertCache          = make(map[string]insertCache)
	publisherI18nUpdateCacheMut       sync.RWMutex
	publisherI18nUpdateCache          = make(map[string]updateCache)
	publisherI18nUpsertCacheMut       sync.RWMutex
	publisherI18nUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = bytes.MinRead
)
func (q publisherI18nQuery) OneP() *PublisherI18n {
	o, err := q.One()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q publisherI18nQuery) One() (*PublisherI18n, error) {
	o := &PublisherI18n{}
	queries.SetLimit(q.Query, 1)
	err := q.Bind(o)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "mdbmodels: failed to execute a one query for publisher_i18n")
	}
	return o, nil
}
func (q publisherI18nQuery) AllP() PublisherI18nSlice {
	o, err := q.All()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q publisherI18nQuery) All() (PublisherI18nSlice, error) {
	var o []*PublisherI18n
	err := q.Bind(&o)
	if err != nil {
		return nil, errors.Wrap(err, "mdbmodels: failed to assign all query results to PublisherI18n slice")
	}
	return o, nil
}
func (q publisherI18nQuery) CountP() int64 {
	c, err := q.Count()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q publisherI18nQuery) Count() (int64, error) {
	var count int64
	queries.SetSelect(q.Query, nil)
	queries.SetCount(q.Query)
	err := q.Query.QueryRow().Scan(&count)
	if err != nil {
		return 0, errors.Wrap(err, "mdbmodels: failed to count publisher_i18n rows")
	}
	return count, nil
}
func (q publisherI18nQuery) ExistsP() bool {
	e, err := q.Exists()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q publisherI18nQuery) Exists() (bool, error) {
	var count int64
	queries.SetCount(q.Query)
	queries.SetLimit(q.Query, 1)
	err := q.Query.QueryRow().Scan(&count)
	if err != nil {
		return false, errors.Wrap(err, "mdbmodels: failed to check if publisher_i18n exists")
	}
	return count > 0, nil
}
func (o *PublisherI18n) PublisherG(mods ...qm.QueryMod) publisherQuery {
	return o.Publisher(boil.GetDB(), mods...)
}
func (o *PublisherI18n) Publisher(exec boil.Executor, mods ...qm.QueryMod) publisherQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.PublisherID),
	}
	queryMods = append(queryMods, mods...)
	query := Publishers(exec, queryMods...)
	queries.SetFrom(query.Query, "\"publishers\"")
	return query
}
func (o *PublisherI18n) UserG(mods ...qm.QueryMod) userQuery {
	return o.User(boil.GetDB(), mods...)
}
func (o *PublisherI18n) User(exec boil.Executor, mods ...qm.QueryMod) userQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.UserID),
	}
	queryMods = append(queryMods, mods...)
	query := Users(exec, queryMods...)
	queries.SetFrom(query.Query, "\"users\"")
	return query
}  
func (publisherI18nL) LoadPublisher(e boil.Executor, singular bool, maybePublisherI18n interface{}) error {
	var slice []*PublisherI18n
	var object *PublisherI18n
	count := 1
	if singular {
		object = maybePublisherI18n.(*PublisherI18n)
	} else {
		slice = *maybePublisherI18n.(*[]*PublisherI18n)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &publisherI18nR{}
		}
		args[0] = object.PublisherID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &publisherI18nR{}
			}
			args[i] = obj.PublisherID
		}
	}
	query := fmt.Sprintf(
		"select * from \"publishers\" where \"id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)
	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}
	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Publisher")
	}
	defer results.Close()
	var resultSlice []*Publisher
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Publisher")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		object.R.Publisher = resultSlice[0]
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.PublisherID == foreign.ID {
				local.R.Publisher = foreign
				break
			}
		}
	}
	return nil
}
func (publisherI18nL) LoadUser(e boil.Executor, singular bool, maybePublisherI18n interface{}) error {
	var slice []*PublisherI18n
	var object *PublisherI18n
	count := 1
	if singular {
		object = maybePublisherI18n.(*PublisherI18n)
	} else {
		slice = *maybePublisherI18n.(*[]*PublisherI18n)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &publisherI18nR{}
		}
		args[0] = object.UserID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &publisherI18nR{}
			}
			args[i] = obj.UserID
		}
	}
	query := fmt.Sprintf(
		"select * from \"users\" where \"id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)
	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}
	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load User")
	}
	defer results.Close()
	var resultSlice []*User
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice User")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		object.R.User = resultSlice[0]
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.UserID.Int64 == foreign.ID {
				local.R.User = foreign
				break
			}
		}
	}
	return nil
}
func (o *PublisherI18n) SetPublisherG(insert bool, related *Publisher) error {
	return o.SetPublisher(boil.GetDB(), insert, related)
}
func (o *PublisherI18n) SetPublisherP(exec boil.Executor, insert bool, related *Publisher) {
	if err := o.SetPublisher(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) SetPublisherGP(insert bool, related *Publisher) {
	if err := o.SetPublisher(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) SetPublisher(exec boil.Executor, insert bool, related *Publisher) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}
	updateQuery := fmt.Sprintf(
		"UPDATE \"publisher_i18n\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"publisher_id"}),
		strmangle.WhereClause("\"", "\"", 2, publisherI18nPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.PublisherID, o.Language}
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}
	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}
	o.PublisherID = related.ID
	if o.R == nil {
		o.R = &publisherI18nR{
			Publisher: related,
		}
	} else {
		o.R.Publisher = related
	}
	if related.R == nil {
		related.R = &publisherR{
			PublisherI18ns: PublisherI18nSlice{o},
		}
	} else {
		related.R.PublisherI18ns = append(related.R.PublisherI18ns, o)
	}
	return nil
}
func (o *PublisherI18n) SetUserG(insert bool, related *User) error {
	return o.SetUser(boil.GetDB(), insert, related)
}
func (o *PublisherI18n) SetUserP(exec boil.Executor, insert bool, related *User) {
	if err := o.SetUser(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) SetUserGP(insert bool, related *User) {
	if err := o.SetUser(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}