func (o *PublisherI18n) SetPublisherG(insert bool, related *Publisher) error {
	return o.SetPublisher(boil.GetDB(), insert, related)
}
SetPublisherG of the publisher_i18n to the related item.
Sets o.R.Publisher to related.
Adds o to related.R.PublisherI18ns.
Uses the global database handle.
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
}