func (o *ContentUnitI18n) 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.ContentUnitI18ns {
		if o.UserID.Int64 != ri.UserID.Int64 {
			continue
		}
		ln := len(related.R.ContentUnitI18ns)
		if ln > 1 && i < ln-1 {
			related.R.ContentUnitI18ns[i] = related.R.ContentUnitI18ns[ln-1]
		}
		related.R.ContentUnitI18ns = related.R.ContentUnitI18ns[:ln-1]
		break
	}
	return nil
}
RemoveUser relationship.
Sets o.R.User to nil.
Removes o from all passed in related items' relationships struct (Optional).
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 ContentUnitI18n struct {
	ContentUnitID    int64       `boil:"content_unit_id" json:"content_unit_id" toml:"content_unit_id" yaml:"content_unit_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 *contentUnitI18nR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L contentUnitI18nL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var ContentUnitI18nColumns = struct {
	ContentUnitID    string
	Language         string
	OriginalLanguage string
	Name             string
	Description      string
	UserID           string
	CreatedAt        string
}{
	ContentUnitID:    "content_unit_id",
	Language:         "language",
	OriginalLanguage: "original_language",
	Name:             "name",
	Description:      "description",
	UserID:           "user_id",
	CreatedAt:        "created_at",
}
type contentUnitI18nR struct {
	ContentUnit *ContentUnit
	User        *User
}
type contentUnitI18nL struct{}
var (
	contentUnitI18nColumns               = []string{"content_unit_id", "language", "original_language", "name", "description", "user_id", "created_at"}
	contentUnitI18nColumnsWithoutDefault = []string{"content_unit_id", "language", "original_language", "name", "description", "user_id"}
	contentUnitI18nColumnsWithDefault    = []string{"created_at"}
	contentUnitI18nPrimaryKeyColumns     = []string{"content_unit_id", "language"}
)
type (
	ContentUnitI18nSlice []*ContentUnitI18n
	contentUnitI18nQuery struct {
		*queries.Query
	}
)
var (
	contentUnitI18nType                 = reflect.TypeOf(&ContentUnitI18n{})
	contentUnitI18nMapping              = queries.MakeStructMapping(contentUnitI18nType)
	contentUnitI18nPrimaryKeyMapping, _ = queries.BindMapping(contentUnitI18nType, contentUnitI18nMapping, contentUnitI18nPrimaryKeyColumns)
	contentUnitI18nInsertCacheMut       sync.RWMutex
	contentUnitI18nInsertCache          = make(map[string]insertCache)
	contentUnitI18nUpdateCacheMut       sync.RWMutex
	contentUnitI18nUpdateCache          = make(map[string]updateCache)
	contentUnitI18nUpsertCacheMut       sync.RWMutex
	contentUnitI18nUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = bytes.MinRead
)
func (q contentUnitI18nQuery) OneP() *ContentUnitI18n {
	o, err := q.One()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q contentUnitI18nQuery) One() (*ContentUnitI18n, error) {
	o := &ContentUnitI18n{}
	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 content_unit_i18n")
	}
	return o, nil
}
func (q contentUnitI18nQuery) AllP() ContentUnitI18nSlice {
	o, err := q.All()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q contentUnitI18nQuery) All() (ContentUnitI18nSlice, error) {
	var o []*ContentUnitI18n
	err := q.Bind(&o)
	if err != nil {
		return nil, errors.Wrap(err, "mdbmodels: failed to assign all query results to ContentUnitI18n slice")
	}
	return o, nil
}
func (q contentUnitI18nQuery) CountP() int64 {
	c, err := q.Count()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q contentUnitI18nQuery) 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 content_unit_i18n rows")
	}
	return count, nil
}
func (q contentUnitI18nQuery) ExistsP() bool {
	e, err := q.Exists()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q contentUnitI18nQuery) 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 content_unit_i18n exists")
	}
	return count > 0, nil
}
func (o *ContentUnitI18n) ContentUnitG(mods ...qm.QueryMod) contentUnitQuery {
	return o.ContentUnit(boil.GetDB(), mods...)
}
func (o *ContentUnitI18n) ContentUnit(exec boil.Executor, mods ...qm.QueryMod) contentUnitQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.ContentUnitID),
	}
	queryMods = append(queryMods, mods...)
	query := ContentUnits(exec, queryMods...)
	queries.SetFrom(query.Query, "\"content_units\"")
	return query
}
func (o *ContentUnitI18n) UserG(mods ...qm.QueryMod) userQuery {
	return o.User(boil.GetDB(), mods...)
}
func (o *ContentUnitI18n) 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 (contentUnitI18nL) LoadContentUnit(e boil.Executor, singular bool, maybeContentUnitI18n interface{}) error {
	var slice []*ContentUnitI18n
	var object *ContentUnitI18n
	count := 1
	if singular {
		object = maybeContentUnitI18n.(*ContentUnitI18n)
	} else {
		slice = *maybeContentUnitI18n.(*[]*ContentUnitI18n)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &contentUnitI18nR{}
		}
		args[0] = object.ContentUnitID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &contentUnitI18nR{}
			}
			args[i] = obj.ContentUnitID
		}
	}
	query := fmt.Sprintf(
		"select * from \"content_units\" 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 ContentUnit")
	}
	defer results.Close()
	var resultSlice []*ContentUnit
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice ContentUnit")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		object.R.ContentUnit = resultSlice[0]
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.ContentUnitID == foreign.ID {
				local.R.ContentUnit = foreign
				break
			}
		}
	}
	return nil
}
func (contentUnitI18nL) LoadUser(e boil.Executor, singular bool, maybeContentUnitI18n interface{}) error {
	var slice []*ContentUnitI18n
	var object *ContentUnitI18n
	count := 1
	if singular {
		object = maybeContentUnitI18n.(*ContentUnitI18n)
	} else {
		slice = *maybeContentUnitI18n.(*[]*ContentUnitI18n)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &contentUnitI18nR{}
		}
		args[0] = object.UserID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &contentUnitI18nR{}
			}
			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 *ContentUnitI18n) SetContentUnitG(insert bool, related *ContentUnit) error {
	return o.SetContentUnit(boil.GetDB(), insert, related)
}
func (o *ContentUnitI18n) SetContentUnitP(exec boil.Executor, insert bool, related *ContentUnit) {
	if err := o.SetContentUnit(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ContentUnitI18n) SetContentUnitGP(insert bool, related *ContentUnit) {
	if err := o.SetContentUnit(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ContentUnitI18n) SetContentUnit(exec boil.Executor, insert bool, related *ContentUnit) 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 \"content_unit_i18n\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"content_unit_id"}),
		strmangle.WhereClause("\"", "\"", 2, contentUnitI18nPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.ContentUnitID, 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.ContentUnitID = related.ID
	if o.R == nil {
		o.R = &contentUnitI18nR{
			ContentUnit: related,
		}
	} else {
		o.R.ContentUnit = related
	}
	if related.R == nil {
		related.R = &contentUnitR{
			ContentUnitI18ns: ContentUnitI18nSlice{o},
		}
	} else {
		related.R.ContentUnitI18ns = append(related.R.ContentUnitI18ns, o)
	}
	return nil
}
func (o *ContentUnitI18n) SetUserG(insert bool, related *User) error {
	return o.SetUser(boil.GetDB(), insert, related)
}
func (o *ContentUnitI18n) SetUserP(exec boil.Executor, insert bool, related *User) {
	if err := o.SetUser(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ContentUnitI18n) SetUserGP(insert bool, related *User) {
	if err := o.SetUser(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ContentUnitI18n) 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 \"content_unit_i18n\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"user_id"}),
		strmangle.WhereClause("\"", "\"", 2, contentUnitI18nPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.ContentUnitID, 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 = &contentUnitI18nR{
			User: related,
		}
	} else {
		o.R.User = related
	}
	if related.R == nil {
		related.R = &userR{
			ContentUnitI18ns: ContentUnitI18nSlice{o},
		}
	} else {
		related.R.ContentUnitI18ns = append(related.R.ContentUnitI18ns, o)
	}
	return nil
}
func (o *ContentUnitI18n) RemoveUserG(related *User) error {
	return o.RemoveUser(boil.GetDB(), related)
}
func (o *ContentUnitI18n) RemoveUserP(exec boil.Executor, related *User) {
	if err := o.RemoveUser(exec, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ContentUnitI18n) RemoveUserGP(related *User) {
	if err := o.RemoveUser(boil.GetDB(), related); err != nil {
		panic(boil.WrapErr(err))
	}
}