func (operationL) LoadUser(e boil.Executor, singular bool, maybeOperation interface{}) error {
	var slice []*Operation
	var object *Operation
	count := 1
	if singular {
		object = maybeOperation.(*Operation)
	} else {
		slice = *maybeOperation.(*[]*Operation)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &operationR{}
		}
		args[0] = object.UserID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &operationR{}
			}
			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
}
LoadUser allows an eager lookup of values, cached into the
loaded structs of the objects.
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 Operation struct {
	ID         int64       `boil:"id" json:"id" toml:"id" yaml:"id"`
	UID        string      `boil:"uid" json:"uid" toml:"uid" yaml:"uid"`
	TypeID     int64       `boil:"type_id" json:"type_id" toml:"type_id" yaml:"type_id"`
	CreatedAt  time.Time   `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	Station    null.String `boil:"station" json:"station,omitempty" toml:"station" yaml:"station,omitempty"`
	UserID     null.Int64  `boil:"user_id" json:"user_id,omitempty" toml:"user_id" yaml:"user_id,omitempty"`
	Details    null.String `boil:"details" json:"details,omitempty" toml:"details" yaml:"details,omitempty"`
	Properties null.JSON   `boil:"properties" json:"properties,omitempty" toml:"properties" yaml:"properties,omitempty"`
	R *operationR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L operationL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var OperationColumns = struct {
	ID         string
	UID        string
	TypeID     string
	CreatedAt  string
	Station    string
	UserID     string
	Details    string
	Properties string
}{
	ID:         "id",
	UID:        "uid",
	TypeID:     "type_id",
	CreatedAt:  "created_at",
	Station:    "station",
	UserID:     "user_id",
	Details:    "details",
	Properties: "properties",
}
type operationR struct {
	Type  *OperationType
	User  *User
	Files FileSlice
}
type operationL struct{}
var (
	operationColumns               = []string{"id", "uid", "type_id", "created_at", "station", "user_id", "details", "properties"}
	operationColumnsWithoutDefault = []string{"uid", "type_id", "station", "user_id", "details", "properties"}
	operationColumnsWithDefault    = []string{"id", "created_at"}
	operationPrimaryKeyColumns     = []string{"id"}
)
type (
	OperationSlice []*Operation
	operationQuery struct {
		*queries.Query
	}
)
var (
	operationType                 = reflect.TypeOf(&Operation{})
	operationMapping              = queries.MakeStructMapping(operationType)
	operationPrimaryKeyMapping, _ = queries.BindMapping(operationType, operationMapping, operationPrimaryKeyColumns)
	operationInsertCacheMut       sync.RWMutex
	operationInsertCache          = make(map[string]insertCache)
	operationUpdateCacheMut       sync.RWMutex
	operationUpdateCache          = make(map[string]updateCache)
	operationUpsertCacheMut       sync.RWMutex
	operationUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = bytes.MinRead
)
func (q operationQuery) OneP() *Operation {
	o, err := q.One()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q operationQuery) One() (*Operation, error) {
	o := &Operation{}
	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 operations")
	}
	return o, nil
}
func (q operationQuery) AllP() OperationSlice {
	o, err := q.All()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q operationQuery) All() (OperationSlice, error) {
	var o []*Operation
	err := q.Bind(&o)
	if err != nil {
		return nil, errors.Wrap(err, "mdbmodels: failed to assign all query results to Operation slice")
	}
	return o, nil
}
func (q operationQuery) CountP() int64 {
	c, err := q.Count()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q operationQuery) 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 operations rows")
	}
	return count, nil
}
func (q operationQuery) ExistsP() bool {
	e, err := q.Exists()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q operationQuery) 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 operations exists")
	}
	return count > 0, nil
}
func (o *Operation) TypeG(mods ...qm.QueryMod) operationTypeQuery {
	return o.Type(boil.GetDB(), mods...)
}
func (o *Operation) Type(exec boil.Executor, mods ...qm.QueryMod) operationTypeQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.TypeID),
	}
	queryMods = append(queryMods, mods...)
	query := OperationTypes(exec, queryMods...)
	queries.SetFrom(query.Query, "\"operation_types\"")
	return query
}
func (o *Operation) UserG(mods ...qm.QueryMod) userQuery {
	return o.User(boil.GetDB(), mods...)
}
func (o *Operation) 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 (o *Operation) FilesG(mods ...qm.QueryMod) fileQuery {
	return o.Files(boil.GetDB(), mods...)
}
func (o *Operation) Files(exec boil.Executor, mods ...qm.QueryMod) fileQuery {
	var queryMods []qm.QueryMod
	if len(mods) != 0 {
		queryMods = append(queryMods, mods...)
	}
	queryMods = append(queryMods,
		qm.InnerJoin("\"files_operations\" on \"files\".\"id\" = \"files_operations\".\"file_id\""),
		qm.Where("\"files_operations\".\"operation_id\"=?", o.ID),
	)
	query := Files(exec, queryMods...)
	queries.SetFrom(query.Query, "\"files\"")
	if len(queries.GetSelect(query.Query)) == 0 {
		queries.SetSelect(query.Query, []string{"\"files\".*"})
	}
	return query
}
func (operationL) LoadType(e boil.Executor, singular bool, maybeOperation interface{}) error {
	var slice []*Operation
	var object *Operation
	count := 1
	if singular {
		object = maybeOperation.(*Operation)
	} else {
		slice = *maybeOperation.(*[]*Operation)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &operationR{}
		}
		args[0] = object.TypeID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &operationR{}
			}
			args[i] = obj.TypeID
		}
	}
	query := fmt.Sprintf(
		"select * from \"operation_types\" 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 OperationType")
	}
	defer results.Close()
	var resultSlice []*OperationType
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice OperationType")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		object.R.Type = resultSlice[0]
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.TypeID == foreign.ID {
				local.R.Type = foreign
				break
			}
		}
	}
	return nil
}