func (o *CollectionI18n) SetUserP(exec boil.Executor, insert bool, related *User) {
	if err := o.SetUser(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
SetUserP of the collection_i18n to the related item.
Sets o.R.User to related.
Adds o to related.R.CollectionI18ns.
Panics on error.
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 CollectionI18n struct {
	CollectionID     int64       `boil:"collection_id" json:"collection_id" toml:"collection_id" yaml:"collection_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 *collectionI18nR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L collectionI18nL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var CollectionI18nColumns = struct {
	CollectionID     string
	Language         string
	OriginalLanguage string
	Name             string
	Description      string
	UserID           string
	CreatedAt        string
}{
	CollectionID:     "collection_id",
	Language:         "language",
	OriginalLanguage: "original_language",
	Name:             "name",
	Description:      "description",
	UserID:           "user_id",
	CreatedAt:        "created_at",
}
type collectionI18nR struct {
	Collection *Collection
	User       *User
}
type collectionI18nL struct{}
var (
	collectionI18nColumns               = []string{"collection_id", "language", "original_language", "name", "description", "user_id", "created_at"}
	collectionI18nColumnsWithoutDefault = []string{"collection_id", "language", "original_language", "name", "description", "user_id"}
	collectionI18nColumnsWithDefault    = []string{"created_at"}
	collectionI18nPrimaryKeyColumns     = []string{"collection_id", "language"}
)
type (
	CollectionI18nSlice []*CollectionI18n
	collectionI18nQuery struct {
		*queries.Query
	}
)
var (
	collectionI18nType                 = reflect.TypeOf(&CollectionI18n{})
	collectionI18nMapping              = queries.MakeStructMapping(collectionI18nType)
	collectionI18nPrimaryKeyMapping, _ = queries.BindMapping(collectionI18nType, collectionI18nMapping, collectionI18nPrimaryKeyColumns)
	collectionI18nInsertCacheMut       sync.RWMutex
	collectionI18nInsertCache          = make(map[string]insertCache)
	collectionI18nUpdateCacheMut       sync.RWMutex
	collectionI18nUpdateCache          = make(map[string]updateCache)
	collectionI18nUpsertCacheMut       sync.RWMutex
	collectionI18nUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = bytes.MinRead
)
func (q collectionI18nQuery) OneP() *CollectionI18n {
	o, err := q.One()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q collectionI18nQuery) One() (*CollectionI18n, error) {
	o := &CollectionI18n{}
	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 collection_i18n")
	}
	return o, nil
}
func (q collectionI18nQuery) AllP() CollectionI18nSlice {
	o, err := q.All()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q collectionI18nQuery) All() (CollectionI18nSlice, error) {
	var o []*CollectionI18n
	err := q.Bind(&o)
	if err != nil {
		return nil, errors.Wrap(err, "mdbmodels: failed to assign all query results to CollectionI18n slice")
	}
	return o, nil
}
func (q collectionI18nQuery) CountP() int64 {
	c, err := q.Count()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q collectionI18nQuery) 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 collection_i18n rows")
	}
	return count, nil
}
func (q collectionI18nQuery) ExistsP() bool {
	e, err := q.Exists()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q collectionI18nQuery) 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 collection_i18n exists")
	}
	return count > 0, nil
}
func (o *CollectionI18n) CollectionG(mods ...qm.QueryMod) collectionQuery {
	return o.Collection(boil.GetDB(), mods...)
}
func (o *CollectionI18n) Collection(exec boil.Executor, mods ...qm.QueryMod) collectionQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.CollectionID),
	}
	queryMods = append(queryMods, mods...)
	query := Collections(exec, queryMods...)
	queries.SetFrom(query.Query, "\"collections\"")
	return query
}
func (o *CollectionI18n) UserG(mods ...qm.QueryMod) userQuery {
	return o.User(boil.GetDB(), mods...)
}
func (o *CollectionI18n) 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 (collectionI18nL) LoadCollection(e boil.Executor, singular bool, maybeCollectionI18n interface{}) error {
	var slice []*CollectionI18n
	var object *CollectionI18n
	count := 1
	if singular {
		object = maybeCollectionI18n.(*CollectionI18n)
	} else {
		slice = *maybeCollectionI18n.(*[]*CollectionI18n)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &collectionI18nR{}
		}
		args[0] = object.CollectionID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &collectionI18nR{}
			}
			args[i] = obj.CollectionID
		}
	}
	query := fmt.Sprintf(
		"select * from \"collections\" 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 Collection")
	}
	defer results.Close()
	var resultSlice []*Collection
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Collection")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		object.R.Collection = resultSlice[0]
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.CollectionID == foreign.ID {
				local.R.Collection = foreign
				break
			}
		}
	}
	return nil
}
func (collectionI18nL) LoadUser(e boil.Executor, singular bool, maybeCollectionI18n interface{}) error {
	var slice []*CollectionI18n
	var object *CollectionI18n
	count := 1
	if singular {
		object = maybeCollectionI18n.(*CollectionI18n)
	} else {
		slice = *maybeCollectionI18n.(*[]*CollectionI18n)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &collectionI18nR{}
		}
		args[0] = object.UserID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &collectionI18nR{}
			}
			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 *CollectionI18n) SetCollectionG(insert bool, related *Collection) error {
	return o.SetCollection(boil.GetDB(), insert, related)
}
func (o *CollectionI18n) SetCollectionP(exec boil.Executor, insert bool, related *Collection) {
	if err := o.SetCollection(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *CollectionI18n) SetCollectionGP(insert bool, related *Collection) {
	if err := o.SetCollection(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *CollectionI18n) SetCollection(exec boil.Executor, insert bool, related *Collection) 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 \"collection_i18n\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"collection_id"}),
		strmangle.WhereClause("\"", "\"", 2, collectionI18nPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.CollectionID, 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.CollectionID = related.ID
	if o.R == nil {
		o.R = &collectionI18nR{
			Collection: related,
		}
	} else {
		o.R.Collection = related
	}
	if related.R == nil {
		related.R = &collectionR{
			CollectionI18ns: CollectionI18nSlice{o},
		}
	} else {
		related.R.CollectionI18ns = append(related.R.CollectionI18ns, o)
	}
	return nil
}
func (o *CollectionI18n) SetUserG(insert bool, related *User) error {
	return o.SetUser(boil.GetDB(), insert, related)
}