func (o *Support) InsertP(exec boil.Executor, columns boil.Columns) {
	if err := o.Insert(exec, columns); err != nil {
		panic(boil.WrapErr(err))
	}
}
InsertP a single record using an executor, and panics on error. See Insert
for whitelist behavior description.
package model
import (
	"database/sql"
	"fmt"
	"reflect"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/pkg/errors"
	"github.com/volatiletech/null"
	"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 Support struct {
	ID                uint64      `boil:"id" json:"id" toml:"id" yaml:"id"`
	SupportedClaimID  string      `boil:"supported_claim_id" json:"supported_claim_id" toml:"supported_claim_id" yaml:"supported_claim_id"`
	SupportAmount     float64     `boil:"support_amount" json:"support_amount" toml:"support_amount" yaml:"support_amount"`
	BidState          string      `boil:"bid_state" json:"bid_state" toml:"bid_state" yaml:"bid_state"`
	TransactionHashID null.String `boil:"transaction_hash_id" json:"transaction_hash_id,omitempty" toml:"transaction_hash_id" yaml:"transaction_hash_id,omitempty"`
	Vout              uint        `boil:"vout" json:"vout" toml:"vout" yaml:"vout"`
	CreatedAt         time.Time   `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	ModifiedAt        time.Time   `boil:"modified_at" json:"modified_at" toml:"modified_at" yaml:"modified_at"`
	R *supportR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L supportL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var SupportColumns = struct {
	ID                string
	SupportedClaimID  string
	SupportAmount     string
	BidState          string
	TransactionHashID string
	Vout              string
	CreatedAt         string
	ModifiedAt        string
}{
	ID:                "id",
	SupportedClaimID:  "supported_claim_id",
	SupportAmount:     "support_amount",
	BidState:          "bid_state",
	TransactionHashID: "transaction_hash_id",
	Vout:              "vout",
	CreatedAt:         "created_at",
	ModifiedAt:        "modified_at",
}
var SupportWhere = struct {
	ID                whereHelperuint64
	SupportedClaimID  whereHelperstring
	SupportAmount     whereHelperfloat64
	BidState          whereHelperstring
	TransactionHashID whereHelpernull_String
	Vout              whereHelperuint
	CreatedAt         whereHelpertime_Time
	ModifiedAt        whereHelpertime_Time
}{
	ID:                whereHelperuint64{field: "`support`.`id`"},
	SupportedClaimID:  whereHelperstring{field: "`support`.`supported_claim_id`"},
	SupportAmount:     whereHelperfloat64{field: "`support`.`support_amount`"},
	BidState:          whereHelperstring{field: "`support`.`bid_state`"},
	TransactionHashID: whereHelpernull_String{field: "`support`.`transaction_hash_id`"},
	Vout:              whereHelperuint{field: "`support`.`vout`"},
	CreatedAt:         whereHelpertime_Time{field: "`support`.`created_at`"},
	ModifiedAt:        whereHelpertime_Time{field: "`support`.`modified_at`"},
}
var SupportRels = struct {
	TransactionHash string
}{
	TransactionHash: "TransactionHash",
}
type supportR struct {
	TransactionHash *Transaction
}
func (*supportR) NewStruct() *supportR {
	return &supportR{}
}
type supportL struct{}
var (
	supportAllColumns            = []string{"id", "supported_claim_id", "support_amount", "bid_state", "transaction_hash_id", "vout", "created_at", "modified_at"}
	supportColumnsWithoutDefault = []string{"supported_claim_id", "transaction_hash_id", "vout"}
	supportColumnsWithDefault    = []string{"id", "support_amount", "bid_state", "created_at", "modified_at"}
	supportPrimaryKeyColumns     = []string{"id"}
)
type (
	SupportSlice []*Support
	supportQuery struct {
		*queries.Query
	}
)
var (
	supportType                 = reflect.TypeOf(&Support{})
	supportMapping              = queries.MakeStructMapping(supportType)
	supportPrimaryKeyMapping, _ = queries.BindMapping(supportType, supportMapping, supportPrimaryKeyColumns)
	supportInsertCacheMut       sync.RWMutex
	supportInsertCache          = make(map[string]insertCache)
	supportUpdateCacheMut       sync.RWMutex
	supportUpdateCache          = make(map[string]updateCache)
	supportUpsertCacheMut       sync.RWMutex
	supportUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = qmhelper.Where
)
func (q supportQuery) OneG() (*Support, error) {
	return q.One(boil.GetDB())
}
func (q supportQuery) OneGP() *Support {
	o, err := q.One(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q supportQuery) OneP(exec boil.Executor) *Support {
	o, err := q.One(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q supportQuery) One(exec boil.Executor) (*Support, error) {
	o := &Support{}
	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 support")
	}
	return o, nil
}
func (q supportQuery) AllG() (SupportSlice, error) {
	return q.All(boil.GetDB())
}
func (q supportQuery) AllGP() SupportSlice {
	o, err := q.All(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q supportQuery) AllP(exec boil.Executor) SupportSlice {
	o, err := q.All(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q supportQuery) All(exec boil.Executor) (SupportSlice, error) {
	var o []*Support
	err := q.Bind(nil, exec, &o)
	if err != nil {
		return nil, errors.Wrap(err, "model: failed to assign all query results to Support slice")
	}
	return o, nil
}
func (q supportQuery) CountG() (int64, error) {
	return q.Count(boil.GetDB())
}
func (q supportQuery) CountGP() int64 {
	c, err := q.Count(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q supportQuery) CountP(exec boil.Executor) int64 {
	c, err := q.Count(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q supportQuery) 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 support rows")
	}
	return count, nil
}
func (q supportQuery) ExistsG() (bool, error) {
	return q.Exists(boil.GetDB())
}
func (q supportQuery) ExistsGP() bool {
	e, err := q.Exists(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q supportQuery) ExistsP(exec boil.Executor) bool {
	e, err := q.Exists(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q supportQuery) 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 support exists")
	}
	return count > 0, nil
}
func (o *Support) TransactionHash(mods ...qm.QueryMod) transactionQuery {
	queryMods := []qm.QueryMod{
		qm.Where("hash=?", o.TransactionHashID),
	}
	queryMods = append(queryMods, mods...)
	query := Transactions(queryMods...)
	queries.SetFrom(query.Query, "`transaction`")
	return query
}
func (supportL) LoadTransactionHash(e boil.Executor, singular bool, maybeSupport interface{}, mods queries.Applicator) error {
	var slice []*Support
	var object *Support
	if singular {
		object = maybeSupport.(*Support)
	} else {
		slice = *maybeSupport.(*[]*Support)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &supportR{}
		}
		if !queries.IsNil(object.TransactionHashID) {
			args = append(args, object.TransactionHashID)
		}
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &supportR{}
			}
			for _, a := range args {
				if queries.Equal(a, obj.TransactionHashID) {
					continue Outer
				}
			}
			if !queries.IsNil(obj.TransactionHashID) {
				args = append(args, obj.TransactionHashID)
			}
		}
	}
	if len(args) == 0 {
		return nil
	}
	query := NewQuery(qm.From(`transaction`), qm.WhereIn(`hash 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.TransactionHash = foreign
		if foreign.R == nil {
			foreign.R = &transactionR{}
		}
		foreign.R.TransactionHashSupports = append(foreign.R.TransactionHashSupports, object)
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if queries.Equal(local.TransactionHashID, foreign.Hash) {
				local.R.TransactionHash = foreign
				if foreign.R == nil {
					foreign.R = &transactionR{}
				}
				foreign.R.TransactionHashSupports = append(foreign.R.TransactionHashSupports, local)
				break
			}
		}
	}
	return nil
}
func (o *Support) SetTransactionHashG(insert bool, related *Transaction) error {
	return o.SetTransactionHash(boil.GetDB(), insert, related)
}
func (o *Support) SetTransactionHashP(exec boil.Executor, insert bool, related *Transaction) {
	if err := o.SetTransactionHash(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Support) SetTransactionHashGP(insert bool, related *Transaction) {
	if err := o.SetTransactionHash(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Support) SetTransactionHash(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 `support` SET %s WHERE %s",
		strmangle.SetParamNames("`", "`", 0, []string{"transaction_hash_id"}),
		strmangle.WhereClause("`", "`", 0, supportPrimaryKeyColumns),
	)
	values := []interface{}{related.Hash, o.ID}
	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")
	}
	queries.Assign(&o.TransactionHashID, related.Hash)
	if o.R == nil {
		o.R = &supportR{
			TransactionHash: related,
		}
	} else {
		o.R.TransactionHash = related
	}
	if related.R == nil {
		related.R = &transactionR{
			TransactionHashSupports: SupportSlice{o},
		}
	} else {
		related.R.TransactionHashSupports = append(related.R.TransactionHashSupports, o)
	}
	return nil
}
func (o *Support) RemoveTransactionHashG(related *Transaction) error {
	return o.RemoveTransactionHash(boil.GetDB(), related)
}
func (o *Support) RemoveTransactionHashP(exec boil.Executor, related *Transaction) {
	if err := o.RemoveTransactionHash(exec, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Support) RemoveTransactionHashGP(related *Transaction) {
	if err := o.RemoveTransactionHash(boil.GetDB(), related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Support) RemoveTransactionHash(exec boil.Executor, related *Transaction) error {
	var err error
	queries.SetScanner(&o.TransactionHashID, nil)
	if err = o.Update(exec, boil.Whitelist("transaction_hash_id")); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}
	o.R.TransactionHash = nil
	if related == nil || related.R == nil {
		return nil
	}
	for i, ri := range related.R.TransactionHashSupports {
		if queries.Equal(o.TransactionHashID, ri.TransactionHashID) {
			continue
		}
		ln := len(related.R.TransactionHashSupports)
		if ln > 1 && i < ln-1 {
			related.R.TransactionHashSupports[i] = related.R.TransactionHashSupports[ln-1]
		}
		related.R.TransactionHashSupports = related.R.TransactionHashSupports[:ln-1]
		break
	}
	return nil
}
func Supports(mods ...qm.QueryMod) supportQuery {
	mods = append(mods, qm.From("`support`"))
	return supportQuery{NewQuery(mods...)}
}
func FindSupportG(iD uint64, selectCols ...string) (*Support, error) {
	return FindSupport(boil.GetDB(), iD, selectCols...)
}
func FindSupportP(exec boil.Executor, iD uint64, selectCols ...string) *Support {
	retobj, err := FindSupport(exec, iD, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindSupportGP(iD uint64, selectCols ...string) *Support {
	retobj, err := FindSupport(boil.GetDB(), iD, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindSupport(exec boil.Executor, iD uint64, selectCols ...string) (*Support, error) {
	supportObj := &Support{}
	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from `support` where `id`=?", sel,
	)
	q := queries.Raw(query, iD)
	err := q.Bind(nil, exec, supportObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "model: unable to select from support")
	}
	return supportObj, nil
}
func (o *Support) InsertG(columns boil.Columns) error {
	return o.Insert(boil.GetDB(), columns)
}