func FindTransactionAddress(exec boil.Executor, transactionID uint64, addressID uint64, selectCols ...string) (*TransactionAddress, error) {
	transactionAddressObj := &TransactionAddress{}
	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from `transaction_address` where `transaction_id`=? AND `address_id`=?", sel,
	)
	q := queries.Raw(query, transactionID, addressID)
	err := q.Bind(nil, exec, transactionAddressObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "model: unable to select from transaction_address")
	}
	return transactionAddressObj, nil
}
FindTransactionAddress retrieves a single record by ID with an executor.
If selectCols is empty Find will return all columns.
package model
import (
	"database/sql"
	"fmt"
	"reflect"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/pkg/errors"
	"github.com/volatiletech/sqlboiler/boil"
	"github.com/volatiletech/sqlboiler/queries"
	"github.com/volatiletech/sqlboiler/queries/qm"
	"github.com/volatiletech/sqlboiler/queries/qmhelper"
	"github.com/volatiletech/sqlboiler/strmangle"
)
type TransactionAddress struct {
	TransactionID uint64  `boil:"transaction_id" json:"transaction_id" toml:"transaction_id" yaml:"transaction_id"`
	AddressID     uint64  `boil:"address_id" json:"address_id" toml:"address_id" yaml:"address_id"`
	DebitAmount   float64 `boil:"debit_amount" json:"debit_amount" toml:"debit_amount" yaml:"debit_amount"`
	CreditAmount  float64 `boil:"credit_amount" json:"credit_amount" toml:"credit_amount" yaml:"credit_amount"`
	R *transactionAddressR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L transactionAddressL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var TransactionAddressColumns = struct {
	TransactionID string
	AddressID     string
	DebitAmount   string
	CreditAmount  string
}{
	TransactionID: "transaction_id",
	AddressID:     "address_id",
	DebitAmount:   "debit_amount",
	CreditAmount:  "credit_amount",
}
var TransactionAddressWhere = struct {
	TransactionID whereHelperuint64
	AddressID     whereHelperuint64
	DebitAmount   whereHelperfloat64
	CreditAmount  whereHelperfloat64
}{
	TransactionID: whereHelperuint64{field: "`transaction_address`.`transaction_id`"},
	AddressID:     whereHelperuint64{field: "`transaction_address`.`address_id`"},
	DebitAmount:   whereHelperfloat64{field: "`transaction_address`.`debit_amount`"},
	CreditAmount:  whereHelperfloat64{field: "`transaction_address`.`credit_amount`"},
}
var TransactionAddressRels = struct {
	Transaction string
	Address     string
}{
	Transaction: "Transaction",
	Address:     "Address",
}
type transactionAddressR struct {
	Transaction *Transaction
	Address     *Address
}
func (*transactionAddressR) NewStruct() *transactionAddressR {
	return &transactionAddressR{}
}
type transactionAddressL struct{}
var (
	transactionAddressAllColumns            = []string{"transaction_id", "address_id", "debit_amount", "credit_amount"}
	transactionAddressColumnsWithoutDefault = []string{"transaction_id", "address_id"}
	transactionAddressColumnsWithDefault    = []string{"debit_amount", "credit_amount"}
	transactionAddressPrimaryKeyColumns     = []string{"transaction_id", "address_id"}
)
type (
	TransactionAddressSlice []*TransactionAddress
	transactionAddressQuery struct {
		*queries.Query
	}
)
var (
	transactionAddressType                 = reflect.TypeOf(&TransactionAddress{})
	transactionAddressMapping              = queries.MakeStructMapping(transactionAddressType)
	transactionAddressPrimaryKeyMapping, _ = queries.BindMapping(transactionAddressType, transactionAddressMapping, transactionAddressPrimaryKeyColumns)
	transactionAddressInsertCacheMut       sync.RWMutex
	transactionAddressInsertCache          = make(map[string]insertCache)
	transactionAddressUpdateCacheMut       sync.RWMutex
	transactionAddressUpdateCache          = make(map[string]updateCache)
	transactionAddressUpsertCacheMut       sync.RWMutex
	transactionAddressUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = qmhelper.Where
)
func (q transactionAddressQuery) OneG() (*TransactionAddress, error) {
	return q.One(boil.GetDB())
}
func (q transactionAddressQuery) OneGP() *TransactionAddress {
	o, err := q.One(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q transactionAddressQuery) OneP(exec boil.Executor) *TransactionAddress {
	o, err := q.One(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q transactionAddressQuery) One(exec boil.Executor) (*TransactionAddress, error) {
	o := &TransactionAddress{}
	queries.SetLimit(q.Query, 1)
	err := q.Bind(nil, exec, o)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "model: failed to execute a one query for transaction_address")
	}
	return o, nil
}
func (q transactionAddressQuery) AllG() (TransactionAddressSlice, error) {
	return q.All(boil.GetDB())
}
func (q transactionAddressQuery) AllGP() TransactionAddressSlice {
	o, err := q.All(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q transactionAddressQuery) AllP(exec boil.Executor) TransactionAddressSlice {
	o, err := q.All(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q transactionAddressQuery) All(exec boil.Executor) (TransactionAddressSlice, error) {
	var o []*TransactionAddress
	err := q.Bind(nil, exec, &o)
	if err != nil {
		return nil, errors.Wrap(err, "model: failed to assign all query results to TransactionAddress slice")
	}
	return o, nil
}
func (q transactionAddressQuery) CountG() (int64, error) {
	return q.Count(boil.GetDB())
}
func (q transactionAddressQuery) CountGP() int64 {
	c, err := q.Count(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q transactionAddressQuery) CountP(exec boil.Executor) int64 {
	c, err := q.Count(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q transactionAddressQuery) Count(exec boil.Executor) (int64, error) {
	var count int64
	queries.SetSelect(q.Query, nil)
	queries.SetCount(q.Query)
	err := q.Query.QueryRow(exec).Scan(&count)
	if err != nil {
		return 0, errors.Wrap(err, "model: failed to count transaction_address rows")
	}
	return count, nil
}
func (q transactionAddressQuery) ExistsG() (bool, error) {
	return q.Exists(boil.GetDB())
}
func (q transactionAddressQuery) ExistsGP() bool {
	e, err := q.Exists(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q transactionAddressQuery) ExistsP(exec boil.Executor) bool {
	e, err := q.Exists(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q transactionAddressQuery) Exists(exec boil.Executor) (bool, error) {
	var count int64
	queries.SetSelect(q.Query, nil)
	queries.SetCount(q.Query)
	queries.SetLimit(q.Query, 1)
	err := q.Query.QueryRow(exec).Scan(&count)
	if err != nil {
		return false, errors.Wrap(err, "model: failed to check if transaction_address exists")
	}
	return count > 0, nil
}
func (o *TransactionAddress) Transaction(mods ...qm.QueryMod) transactionQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.TransactionID),
	}
	queryMods = append(queryMods, mods...)
	query := Transactions(queryMods...)
	queries.SetFrom(query.Query, "`transaction`")
	return query
}
func (o *TransactionAddress) Address(mods ...qm.QueryMod) addressQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.AddressID),
	}
	queryMods = append(queryMods, mods...)
	query := Addresses(queryMods...)
	queries.SetFrom(query.Query, "`address`")
	return query
}
func (transactionAddressL) LoadTransaction(e boil.Executor, singular bool, maybeTransactionAddress interface{}, mods queries.Applicator) error {
	var slice []*TransactionAddress
	var object *TransactionAddress
	if singular {
		object = maybeTransactionAddress.(*TransactionAddress)
	} else {
		slice = *maybeTransactionAddress.(*[]*TransactionAddress)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &transactionAddressR{}
		}
		args = append(args, object.TransactionID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &transactionAddressR{}
			}
			for _, a := range args {
				if a == obj.TransactionID {
					continue Outer
				}
			}
			args = append(args, obj.TransactionID)
		}
	}
	if len(args) == 0 {
		return nil
	}
	query := NewQuery(qm.From(`transaction`), qm.WhereIn(`id in ?`, args...))
	if mods != nil {
		mods.Apply(query)
	}
	results, err := query.Query(e)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Transaction")
	}
	var resultSlice []*Transaction
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Transaction")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results of eager load for transaction")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for transaction")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		foreign := resultSlice[0]
		object.R.Transaction = foreign
		if foreign.R == nil {
			foreign.R = &transactionR{}
		}
		foreign.R.TransactionAddresses = append(foreign.R.TransactionAddresses, object)
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.TransactionID == foreign.ID {
				local.R.Transaction = foreign
				if foreign.R == nil {
					foreign.R = &transactionR{}
				}
				foreign.R.TransactionAddresses = append(foreign.R.TransactionAddresses, local)
				break
			}
		}
	}
	return nil
}
func (transactionAddressL) LoadAddress(e boil.Executor, singular bool, maybeTransactionAddress interface{}, mods queries.Applicator) error {
	var slice []*TransactionAddress
	var object *TransactionAddress
	if singular {
		object = maybeTransactionAddress.(*TransactionAddress)
	} else {
		slice = *maybeTransactionAddress.(*[]*TransactionAddress)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &transactionAddressR{}
		}
		args = append(args, object.AddressID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &transactionAddressR{}
			}
			for _, a := range args {
				if a == obj.AddressID {
					continue Outer
				}
			}
			args = append(args, obj.AddressID)
		}
	}
	if len(args) == 0 {
		return nil
	}
	query := NewQuery(qm.From(`address`), qm.WhereIn(`id in ?`, args...))
	if mods != nil {
		mods.Apply(query)
	}
	results, err := query.Query(e)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Address")
	}
	var resultSlice []*Address
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Address")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results of eager load for address")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for address")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		foreign := resultSlice[0]
		object.R.Address = foreign
		if foreign.R == nil {
			foreign.R = &addressR{}
		}
		foreign.R.TransactionAddresses = append(foreign.R.TransactionAddresses, object)
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.AddressID == foreign.ID {
				local.R.Address = foreign
				if foreign.R == nil {
					foreign.R = &addressR{}
				}
				foreign.R.TransactionAddresses = append(foreign.R.TransactionAddresses, local)
				break
			}
		}
	}
	return nil
}
func (o *TransactionAddress) SetTransactionG(insert bool, related *Transaction) error {
	return o.SetTransaction(boil.GetDB(), insert, related)
}
func (o *TransactionAddress) SetTransactionP(exec boil.Executor, insert bool, related *Transaction) {
	if err := o.SetTransaction(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *TransactionAddress) SetTransactionGP(insert bool, related *Transaction) {
	if err := o.SetTransaction(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *TransactionAddress) SetTransaction(exec boil.Executor, insert bool, related *Transaction) error {
	var err error
	if insert {
		if err = related.Insert(exec, boil.Infer()); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}
	updateQuery := fmt.Sprintf(
		"UPDATE `transaction_address` SET %s WHERE %s",
		strmangle.SetParamNames("`", "`", 0, []string{"transaction_id"}),
		strmangle.WhereClause("`", "`", 0, transactionAddressPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.TransactionID, o.AddressID}
	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.TransactionID = related.ID
	if o.R == nil {
		o.R = &transactionAddressR{
			Transaction: related,
		}
	} else {
		o.R.Transaction = related
	}
	if related.R == nil {
		related.R = &transactionR{
			TransactionAddresses: TransactionAddressSlice{o},
		}
	} else {
		related.R.TransactionAddresses = append(related.R.TransactionAddresses, o)
	}
	return nil
}
func (o *TransactionAddress) SetAddressG(insert bool, related *Address) error {
	return o.SetAddress(boil.GetDB(), insert, related)
}
func (o *TransactionAddress) SetAddressP(exec boil.Executor, insert bool, related *Address) {
	if err := o.SetAddress(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *TransactionAddress) SetAddressGP(insert bool, related *Address) {
	if err := o.SetAddress(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *TransactionAddress) SetAddress(exec boil.Executor, insert bool, related *Address) error {
	var err error
	if insert {
		if err = related.Insert(exec, boil.Infer()); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}
	updateQuery := fmt.Sprintf(
		"UPDATE `transaction_address` SET %s WHERE %s",
		strmangle.SetParamNames("`", "`", 0, []string{"address_id"}),
		strmangle.WhereClause("`", "`", 0, transactionAddressPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.TransactionID, o.AddressID}
	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.AddressID = related.ID
	if o.R == nil {
		o.R = &transactionAddressR{
			Address: related,
		}
	} else {
		o.R.Address = related
	}
	if related.R == nil {
		related.R = &addressR{
			TransactionAddresses: TransactionAddressSlice{o},
		}
	} else {
		related.R.TransactionAddresses = append(related.R.TransactionAddresses, o)
	}
	return nil
}
func TransactionAddresses(mods ...qm.QueryMod) transactionAddressQuery {
	mods = append(mods, qm.From("`transaction_address`"))
	return transactionAddressQuery{NewQuery(mods...)}
}
func FindTransactionAddressG(transactionID uint64, addressID uint64, selectCols ...string) (*TransactionAddress, error) {
	return FindTransactionAddress(boil.GetDB(), transactionID, addressID, selectCols...)
}
func FindTransactionAddressP(exec boil.Executor, transactionID uint64, addressID uint64, selectCols ...string) *TransactionAddress {
	retobj, err := FindTransactionAddress(exec, transactionID, addressID, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindTransactionAddressGP(transactionID uint64, addressID uint64, selectCols ...string) *TransactionAddress {
	retobj, err := FindTransactionAddress(boil.GetDB(), transactionID, addressID, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}