func (q publisherI18nQuery) UpdateAll(cols M) error {
	queries.SetUpdate(q.Query, cols)
	_, err := q.Query.Exec()
	if err != nil {
		return errors.Wrap(err, "mdbmodels: unable to update all for publisher_i18n")
	}
	return nil
}
UpdateAll updates all rows with the specified column values.
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))
	}
}
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
}
func (o *PublisherI18n) RemoveUserG(related *User) error {
	return o.RemoveUser(boil.GetDB(), related)
}
func (o *PublisherI18n) RemoveUserP(exec boil.Executor, related *User) {
	if err := o.RemoveUser(exec, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) RemoveUserGP(related *User) {
	if err := o.RemoveUser(boil.GetDB(), related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) RemoveUser(exec boil.Executor, related *User) error {
	var err error
	o.UserID.Valid = false
	if err = o.Update(exec, "user_id"); err != nil {
		o.UserID.Valid = true
		return errors.Wrap(err, "failed to update local table")
	}
	o.R.User = nil
	if related == nil || related.R == nil {
		return nil
	}
	for i, ri := range related.R.PublisherI18ns {
		if o.UserID.Int64 != ri.UserID.Int64 {
			continue
		}
		ln := len(related.R.PublisherI18ns)
		if ln > 1 && i < ln-1 {
			related.R.PublisherI18ns[i] = related.R.PublisherI18ns[ln-1]
		}
		related.R.PublisherI18ns = related.R.PublisherI18ns[:ln-1]
		break
	}
	return nil
}
func PublisherI18nsG(mods ...qm.QueryMod) publisherI18nQuery {
	return PublisherI18ns(boil.GetDB(), mods...)
}
func PublisherI18ns(exec boil.Executor, mods ...qm.QueryMod) publisherI18nQuery {
	mods = append(mods, qm.From("\"publisher_i18n\""))
	return publisherI18nQuery{NewQuery(exec, mods...)}
}
func FindPublisherI18nG(publisherID int64, language string, selectCols ...string) (*PublisherI18n, error) {
	return FindPublisherI18n(boil.GetDB(), publisherID, language, selectCols...)
}
func FindPublisherI18nGP(publisherID int64, language string, selectCols ...string) *PublisherI18n {
	retobj, err := FindPublisherI18n(boil.GetDB(), publisherID, language, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindPublisherI18n(exec boil.Executor, publisherID int64, language string, selectCols ...string) (*PublisherI18n, error) {
	publisherI18nObj := &PublisherI18n{}
	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"publisher_i18n\" where \"publisher_id\"=$1 AND \"language\"=$2", sel,
	)
	q := queries.Raw(exec, query, publisherID, language)
	err := q.Bind(publisherI18nObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "mdbmodels: unable to select from publisher_i18n")
	}
	return publisherI18nObj, nil
}
func FindPublisherI18nP(exec boil.Executor, publisherID int64, language string, selectCols ...string) *PublisherI18n {
	retobj, err := FindPublisherI18n(exec, publisherID, language, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func (o *PublisherI18n) InsertG(whitelist ...string) error {
	return o.Insert(boil.GetDB(), whitelist...)
}
func (o *PublisherI18n) InsertGP(whitelist ...string) {
	if err := o.Insert(boil.GetDB(), whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) InsertP(exec boil.Executor, whitelist ...string) {
	if err := o.Insert(exec, whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) Insert(exec boil.Executor, whitelist ...string) error {
	if o == nil {
		return errors.New("mdbmodels: no publisher_i18n provided for insertion")
	}
	var err error
	nzDefaults := queries.NonZeroDefaultSet(publisherI18nColumnsWithDefault, o)
	key := makeCacheKey(whitelist, nzDefaults)
	publisherI18nInsertCacheMut.RLock()
	cache, cached := publisherI18nInsertCache[key]
	publisherI18nInsertCacheMut.RUnlock()
	if !cached {
		wl, returnColumns := strmangle.InsertColumnSet(
			publisherI18nColumns,
			publisherI18nColumnsWithDefault,
			publisherI18nColumnsWithoutDefault,
			nzDefaults,
			whitelist,
		)
		cache.valueMapping, err = queries.BindMapping(publisherI18nType, publisherI18nMapping, wl)
		if err != nil {
			return err
		}
		cache.retMapping, err = queries.BindMapping(publisherI18nType, publisherI18nMapping, returnColumns)
		if err != nil {
			return err
		}
		if len(wl) != 0 {
			cache.query = fmt.Sprintf("INSERT INTO \"publisher_i18n\" (\"%s\") %%sVALUES (%s)%%s", strings.Join(wl, "\",\""), strmangle.Placeholders(dialect.IndexPlaceholders, len(wl), 1, 1))
		} else {
			cache.query = "INSERT INTO \"publisher_i18n\" DEFAULT VALUES"
		}
		var queryOutput, queryReturning string
		if len(cache.retMapping) != 0 {
			queryReturning = fmt.Sprintf(" RETURNING \"%s\"", strings.Join(returnColumns, "\",\""))
		}
		if len(wl) != 0 {
			cache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)
		}
	}
	value := reflect.Indirect(reflect.ValueOf(o))
	vals := queries.ValuesFromMapping(value, cache.valueMapping)
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, cache.query)
		fmt.Fprintln(boil.DebugWriter, vals)
	}
	if len(cache.retMapping) != 0 {
		err = exec.QueryRow(cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)
	} else {
		_, err = exec.Exec(cache.query, vals...)
	}
	if err != nil {
		return errors.Wrap(err, "mdbmodels: unable to insert into publisher_i18n")
	}
	if !cached {
		publisherI18nInsertCacheMut.Lock()
		publisherI18nInsertCache[key] = cache
		publisherI18nInsertCacheMut.Unlock()
	}
	return nil
}
func (o *PublisherI18n) UpdateG(whitelist ...string) error {
	return o.Update(boil.GetDB(), whitelist...)
}
func (o *PublisherI18n) UpdateGP(whitelist ...string) {
	if err := o.Update(boil.GetDB(), whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) UpdateP(exec boil.Executor, whitelist ...string) {
	err := o.Update(exec, whitelist...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *PublisherI18n) Update(exec boil.Executor, whitelist ...string) error {
	var err error
	key := makeCacheKey(whitelist, nil)
	publisherI18nUpdateCacheMut.RLock()
	cache, cached := publisherI18nUpdateCache[key]
	publisherI18nUpdateCacheMut.RUnlock()
	if !cached {
		wl := strmangle.UpdateColumnSet(
			publisherI18nColumns,
			publisherI18nPrimaryKeyColumns,
			whitelist,
		)
		if len(wl) == 0 {
			return errors.New("mdbmodels: unable to update publisher_i18n, could not build whitelist")
		}
		cache.query = fmt.Sprintf("UPDATE \"publisher_i18n\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, wl),
			strmangle.WhereClause("\"", "\"", len(wl)+1, publisherI18nPrimaryKeyColumns),
		)
		cache.valueMapping, err = queries.BindMapping(publisherI18nType, publisherI18nMapping, append(wl, publisherI18nPrimaryKeyColumns...))
		if err != nil {
			return err
		}
	}
	values := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, cache.query)
		fmt.Fprintln(boil.DebugWriter, values)
	}
	_, err = exec.Exec(cache.query, values...)
	if err != nil {
		return errors.Wrap(err, "mdbmodels: unable to update publisher_i18n row")
	}
	if !cached {
		publisherI18nUpdateCacheMut.Lock()
		publisherI18nUpdateCache[key] = cache
		publisherI18nUpdateCacheMut.Unlock()
	}
	return nil
}
func (q publisherI18nQuery) UpdateAllP(cols M) {
	if err := q.UpdateAll(cols); err != nil {
		panic(boil.WrapErr(err))
	}
}