func (o *Output) AddAbnormalClaimsGP(insert bool, related ...*AbnormalClaim) {
	if err := o.AddAbnormalClaims(boil.GetDB(), insert, related...); err != nil {
		panic(boil.WrapErr(err))
	}
}
AddAbnormalClaimsGP adds the given related objects to the existing relationships
of the output, optionally inserting them as new records.
Appends related to o.R.AbnormalClaims.
Sets related.R.Output appropriately.
Uses the global database handle and panics on error.
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 Output struct {
	ID                 uint64       `boil:"id" json:"id" toml:"id" yaml:"id"`
	TransactionID      uint64       `boil:"transaction_id" json:"transaction_id" toml:"transaction_id" yaml:"transaction_id"`
	TransactionHash    string       `boil:"transaction_hash" json:"transaction_hash" toml:"transaction_hash" yaml:"transaction_hash"`
	Value              null.Float64 `boil:"value" json:"value,omitempty" toml:"value" yaml:"value,omitempty"`
	Vout               uint         `boil:"vout" json:"vout" toml:"vout" yaml:"vout"`
	Type               null.String  `boil:"type" json:"type,omitempty" toml:"type" yaml:"type,omitempty"`
	ScriptPubKeyAsm    null.String  `boil:"script_pub_key_asm" json:"script_pub_key_asm,omitempty" toml:"script_pub_key_asm" yaml:"script_pub_key_asm,omitempty"`
	ScriptPubKeyHex    null.String  `boil:"script_pub_key_hex" json:"script_pub_key_hex,omitempty" toml:"script_pub_key_hex" yaml:"script_pub_key_hex,omitempty"`
	RequiredSignatures null.Uint    `boil:"required_signatures" json:"required_signatures,omitempty" toml:"required_signatures" yaml:"required_signatures,omitempty"`
	AddressList        null.String  `boil:"address_list" json:"address_list,omitempty" toml:"address_list" yaml:"address_list,omitempty"`
	IsSpent            bool         `boil:"is_spent" json:"is_spent" toml:"is_spent" yaml:"is_spent"`
	SpentByInputID     null.Uint64  `boil:"spent_by_input_id" json:"spent_by_input_id,omitempty" toml:"spent_by_input_id" yaml:"spent_by_input_id,omitempty"`
	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"`
	ClaimID            null.String  `boil:"claim_id" json:"claim_id,omitempty" toml:"claim_id" yaml:"claim_id,omitempty"`
	R *outputR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L outputL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var OutputColumns = struct {
	ID                 string
	TransactionID      string
	TransactionHash    string
	Value              string
	Vout               string
	Type               string
	ScriptPubKeyAsm    string
	ScriptPubKeyHex    string
	RequiredSignatures string
	AddressList        string
	IsSpent            string
	SpentByInputID     string
	CreatedAt          string
	ModifiedAt         string
	ClaimID            string
}{
	ID:                 "id",
	TransactionID:      "transaction_id",
	TransactionHash:    "transaction_hash",
	Value:              "value",
	Vout:               "vout",
	Type:               "type",
	ScriptPubKeyAsm:    "script_pub_key_asm",
	ScriptPubKeyHex:    "script_pub_key_hex",
	RequiredSignatures: "required_signatures",
	AddressList:        "address_list",
	IsSpent:            "is_spent",
	SpentByInputID:     "spent_by_input_id",
	CreatedAt:          "created_at",
	ModifiedAt:         "modified_at",
	ClaimID:            "claim_id",
}
var OutputWhere = struct {
	ID                 whereHelperuint64
	TransactionID      whereHelperuint64
	TransactionHash    whereHelperstring
	Value              whereHelpernull_Float64
	Vout               whereHelperuint
	Type               whereHelpernull_String
	ScriptPubKeyAsm    whereHelpernull_String
	ScriptPubKeyHex    whereHelpernull_String
	RequiredSignatures whereHelpernull_Uint
	AddressList        whereHelpernull_String
	IsSpent            whereHelperbool
	SpentByInputID     whereHelpernull_Uint64
	CreatedAt          whereHelpertime_Time
	ModifiedAt         whereHelpertime_Time
	ClaimID            whereHelpernull_String
}{
	ID:                 whereHelperuint64{field: "`output`.`id`"},
	TransactionID:      whereHelperuint64{field: "`output`.`transaction_id`"},
	TransactionHash:    whereHelperstring{field: "`output`.`transaction_hash`"},
	Value:              whereHelpernull_Float64{field: "`output`.`value`"},
	Vout:               whereHelperuint{field: "`output`.`vout`"},
	Type:               whereHelpernull_String{field: "`output`.`type`"},
	ScriptPubKeyAsm:    whereHelpernull_String{field: "`output`.`script_pub_key_asm`"},
	ScriptPubKeyHex:    whereHelpernull_String{field: "`output`.`script_pub_key_hex`"},
	RequiredSignatures: whereHelpernull_Uint{field: "`output`.`required_signatures`"},
	AddressList:        whereHelpernull_String{field: "`output`.`address_list`"},
	IsSpent:            whereHelperbool{field: "`output`.`is_spent`"},
	SpentByInputID:     whereHelpernull_Uint64{field: "`output`.`spent_by_input_id`"},
	CreatedAt:          whereHelpertime_Time{field: "`output`.`created_at`"},
	ModifiedAt:         whereHelpertime_Time{field: "`output`.`modified_at`"},
	ClaimID:            whereHelpernull_String{field: "`output`.`claim_id`"},
}
var OutputRels = struct {
	Transaction    string
	AbnormalClaims string
}{
	Transaction:    "Transaction",
	AbnormalClaims: "AbnormalClaims",
}
type outputR struct {
	Transaction    *Transaction
	AbnormalClaims AbnormalClaimSlice
}
func (*outputR) NewStruct() *outputR {
	return &outputR{}
}
type outputL struct{}
var (
	outputAllColumns            = []string{"id", "transaction_id", "transaction_hash", "value", "vout", "type", "script_pub_key_asm", "script_pub_key_hex", "required_signatures", "address_list", "is_spent", "spent_by_input_id", "created_at", "modified_at", "claim_id"}
	outputColumnsWithoutDefault = []string{"transaction_id", "transaction_hash", "value", "vout", "type", "script_pub_key_asm", "script_pub_key_hex", "required_signatures", "address_list", "spent_by_input_id", "claim_id"}
	outputColumnsWithDefault    = []string{"id", "is_spent", "created_at", "modified_at"}
	outputPrimaryKeyColumns     = []string{"id"}
)
type (
	OutputSlice []*Output
	outputQuery struct {
		*queries.Query
	}
)
var (
	outputType                 = reflect.TypeOf(&Output{})
	outputMapping              = queries.MakeStructMapping(outputType)
	outputPrimaryKeyMapping, _ = queries.BindMapping(outputType, outputMapping, outputPrimaryKeyColumns)
	outputInsertCacheMut       sync.RWMutex
	outputInsertCache          = make(map[string]insertCache)
	outputUpdateCacheMut       sync.RWMutex
	outputUpdateCache          = make(map[string]updateCache)
	outputUpsertCacheMut       sync.RWMutex
	outputUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = qmhelper.Where
)
func (q outputQuery) OneG() (*Output, error) {
	return q.One(boil.GetDB())
}
func (q outputQuery) OneGP() *Output {
	o, err := q.One(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q outputQuery) OneP(exec boil.Executor) *Output {
	o, err := q.One(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q outputQuery) One(exec boil.Executor) (*Output, error) {
	o := &Output{}
	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 output")
	}
	return o, nil
}
func (q outputQuery) AllG() (OutputSlice, error) {
	return q.All(boil.GetDB())
}
func (q outputQuery) AllGP() OutputSlice {
	o, err := q.All(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q outputQuery) AllP(exec boil.Executor) OutputSlice {
	o, err := q.All(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q outputQuery) All(exec boil.Executor) (OutputSlice, error) {
	var o []*Output
	err := q.Bind(nil, exec, &o)
	if err != nil {
		return nil, errors.Wrap(err, "model: failed to assign all query results to Output slice")
	}
	return o, nil
}
func (q outputQuery) CountG() (int64, error) {
	return q.Count(boil.GetDB())
}
func (q outputQuery) CountGP() int64 {
	c, err := q.Count(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q outputQuery) CountP(exec boil.Executor) int64 {
	c, err := q.Count(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q outputQuery) 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 output rows")
	}
	return count, nil
}
func (q outputQuery) ExistsG() (bool, error) {
	return q.Exists(boil.GetDB())
}
func (q outputQuery) ExistsGP() bool {
	e, err := q.Exists(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q outputQuery) ExistsP(exec boil.Executor) bool {
	e, err := q.Exists(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q outputQuery) 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 output exists")
	}
	return count > 0, nil
}
func (o *Output) 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 *Output) AbnormalClaims(mods ...qm.QueryMod) abnormalClaimQuery {
	var queryMods []qm.QueryMod
	if len(mods) != 0 {
		queryMods = append(queryMods, mods...)
	}
	queryMods = append(queryMods,
		qm.Where("`abnormal_claim`.`output_id`=?", o.ID),
	)
	query := AbnormalClaims(queryMods...)
	queries.SetFrom(query.Query, "`abnormal_claim`")
	if len(queries.GetSelect(query.Query)) == 0 {
		queries.SetSelect(query.Query, []string{"`abnormal_claim`.*"})
	}
	return query
}
func (outputL) LoadTransaction(e boil.Executor, singular bool, maybeOutput interface{}, mods queries.Applicator) error {
	var slice []*Output
	var object *Output
	if singular {
		object = maybeOutput.(*Output)
	} else {
		slice = *maybeOutput.(*[]*Output)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &outputR{}
		}
		args = append(args, object.TransactionID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &outputR{}
			}
			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.Outputs = append(foreign.R.Outputs, 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.Outputs = append(foreign.R.Outputs, local)
				break
			}
		}
	}
	return nil
}
func (outputL) LoadAbnormalClaims(e boil.Executor, singular bool, maybeOutput interface{}, mods queries.Applicator) error {
	var slice []*Output
	var object *Output
	if singular {
		object = maybeOutput.(*Output)
	} else {
		slice = *maybeOutput.(*[]*Output)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &outputR{}
		}
		args = append(args, object.ID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &outputR{}
			}
			for _, a := range args {
				if a == obj.ID {
					continue Outer
				}
			}
			args = append(args, obj.ID)
		}
	}
	if len(args) == 0 {
		return nil
	}
	query := NewQuery(qm.From(`abnormal_claim`), qm.WhereIn(`output_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 abnormal_claim")
	}
	var resultSlice []*AbnormalClaim
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice abnormal_claim")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results in eager load on abnormal_claim")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for abnormal_claim")
	}
	if singular {
		object.R.AbnormalClaims = resultSlice
		for _, foreign := range resultSlice {
			if foreign.R == nil {
				foreign.R = &abnormalClaimR{}
			}
			foreign.R.Output = object
		}
		return nil
	}
	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.ID == foreign.OutputID {
				local.R.AbnormalClaims = append(local.R.AbnormalClaims, foreign)
				if foreign.R == nil {
					foreign.R = &abnormalClaimR{}
				}
				foreign.R.Output = local
				break
			}
		}
	}
	return nil
}
func (o *Output) SetTransactionG(insert bool, related *Transaction) error {
	return o.SetTransaction(boil.GetDB(), insert, related)
}
func (o *Output) SetTransactionP(exec boil.Executor, insert bool, related *Transaction) {
	if err := o.SetTransaction(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Output) SetTransactionGP(insert bool, related *Transaction) {
	if err := o.SetTransaction(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Output) 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 `output` SET %s WHERE %s",
		strmangle.SetParamNames("`", "`", 0, []string{"transaction_id"}),
		strmangle.WhereClause("`", "`", 0, outputPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, 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")
	}
	o.TransactionID = related.ID
	if o.R == nil {
		o.R = &outputR{
			Transaction: related,
		}
	} else {
		o.R.Transaction = related
	}
	if related.R == nil {
		related.R = &transactionR{
			Outputs: OutputSlice{o},
		}
	} else {
		related.R.Outputs = append(related.R.Outputs, o)
	}
	return nil
}
func (o *Output) AddAbnormalClaimsG(insert bool, related ...*AbnormalClaim) error {
	return o.AddAbnormalClaims(boil.GetDB(), insert, related...)
}
func (o *Output) AddAbnormalClaimsP(exec boil.Executor, insert bool, related ...*AbnormalClaim) {
	if err := o.AddAbnormalClaims(exec, insert, related...); err != nil {
		panic(boil.WrapErr(err))
	}
}