func (o *ClaimTag) UpdateP(exec boil.Executor, columns boil.Columns) {
	err := o.Update(exec, columns)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
UpdateP uses an executor to update the ClaimTag, and panics on error.
See Update for more documentation.
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 ClaimTag struct {
	ID         uint64      `boil:"id" json:"id" toml:"id" yaml:"id"`
	TagID      null.Uint64 `boil:"tag_id" json:"tag_id,omitempty" toml:"tag_id" yaml:"tag_id,omitempty"`
	ClaimID    string      `boil:"claim_id" json:"claim_id" toml:"claim_id" yaml:"claim_id"`
	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 *claimTagR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L claimTagL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var ClaimTagColumns = struct {
	ID         string
	TagID      string
	ClaimID    string
	CreatedAt  string
	ModifiedAt string
}{
	ID:         "id",
	TagID:      "tag_id",
	ClaimID:    "claim_id",
	CreatedAt:  "created_at",
	ModifiedAt: "modified_at",
}
var ClaimTagWhere = struct {
	ID         whereHelperuint64
	TagID      whereHelpernull_Uint64
	ClaimID    whereHelperstring
	CreatedAt  whereHelpertime_Time
	ModifiedAt whereHelpertime_Time
}{
	ID:         whereHelperuint64{field: "`claim_tag`.`id`"},
	TagID:      whereHelpernull_Uint64{field: "`claim_tag`.`tag_id`"},
	ClaimID:    whereHelperstring{field: "`claim_tag`.`claim_id`"},
	CreatedAt:  whereHelpertime_Time{field: "`claim_tag`.`created_at`"},
	ModifiedAt: whereHelpertime_Time{field: "`claim_tag`.`modified_at`"},
}
var ClaimTagRels = struct {
	Claim string
	Tag   string
}{
	Claim: "Claim",
	Tag:   "Tag",
}
type claimTagR struct {
	Claim *Claim
	Tag   *Tag
}
func (*claimTagR) NewStruct() *claimTagR {
	return &claimTagR{}
}
type claimTagL struct{}
var (
	claimTagAllColumns            = []string{"id", "tag_id", "claim_id", "created_at", "modified_at"}
	claimTagColumnsWithoutDefault = []string{"tag_id", "claim_id"}
	claimTagColumnsWithDefault    = []string{"id", "created_at", "modified_at"}
	claimTagPrimaryKeyColumns     = []string{"id"}
)
type (
	ClaimTagSlice []*ClaimTag
	claimTagQuery struct {
		*queries.Query
	}
)
var (
	claimTagType                 = reflect.TypeOf(&ClaimTag{})
	claimTagMapping              = queries.MakeStructMapping(claimTagType)
	claimTagPrimaryKeyMapping, _ = queries.BindMapping(claimTagType, claimTagMapping, claimTagPrimaryKeyColumns)
	claimTagInsertCacheMut       sync.RWMutex
	claimTagInsertCache          = make(map[string]insertCache)
	claimTagUpdateCacheMut       sync.RWMutex
	claimTagUpdateCache          = make(map[string]updateCache)
	claimTagUpsertCacheMut       sync.RWMutex
	claimTagUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = qmhelper.Where
)
func (q claimTagQuery) OneG() (*ClaimTag, error) {
	return q.One(boil.GetDB())
}
func (q claimTagQuery) OneGP() *ClaimTag {
	o, err := q.One(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q claimTagQuery) OneP(exec boil.Executor) *ClaimTag {
	o, err := q.One(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q claimTagQuery) One(exec boil.Executor) (*ClaimTag, error) {
	o := &ClaimTag{}
	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 claim_tag")
	}
	return o, nil
}
func (q claimTagQuery) AllG() (ClaimTagSlice, error) {
	return q.All(boil.GetDB())
}
func (q claimTagQuery) AllGP() ClaimTagSlice {
	o, err := q.All(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q claimTagQuery) AllP(exec boil.Executor) ClaimTagSlice {
	o, err := q.All(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q claimTagQuery) All(exec boil.Executor) (ClaimTagSlice, error) {
	var o []*ClaimTag
	err := q.Bind(nil, exec, &o)
	if err != nil {
		return nil, errors.Wrap(err, "model: failed to assign all query results to ClaimTag slice")
	}
	return o, nil
}
func (q claimTagQuery) CountG() (int64, error) {
	return q.Count(boil.GetDB())
}
func (q claimTagQuery) CountGP() int64 {
	c, err := q.Count(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q claimTagQuery) CountP(exec boil.Executor) int64 {
	c, err := q.Count(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q claimTagQuery) 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 claim_tag rows")
	}
	return count, nil
}
func (q claimTagQuery) ExistsG() (bool, error) {
	return q.Exists(boil.GetDB())
}
func (q claimTagQuery) ExistsGP() bool {
	e, err := q.Exists(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q claimTagQuery) ExistsP(exec boil.Executor) bool {
	e, err := q.Exists(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q claimTagQuery) 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 claim_tag exists")
	}
	return count > 0, nil
}
func (o *ClaimTag) Claim(mods ...qm.QueryMod) claimQuery {
	queryMods := []qm.QueryMod{
		qm.Where("claim_id=?", o.ClaimID),
	}
	queryMods = append(queryMods, mods...)
	query := Claims(queryMods...)
	queries.SetFrom(query.Query, "`claim`")
	return query
}
func (o *ClaimTag) Tag(mods ...qm.QueryMod) tagQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.TagID),
	}
	queryMods = append(queryMods, mods...)
	query := Tags(queryMods...)
	queries.SetFrom(query.Query, "`tag`")
	return query
}
func (claimTagL) LoadClaim(e boil.Executor, singular bool, maybeClaimTag interface{}, mods queries.Applicator) error {
	var slice []*ClaimTag
	var object *ClaimTag
	if singular {
		object = maybeClaimTag.(*ClaimTag)
	} else {
		slice = *maybeClaimTag.(*[]*ClaimTag)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &claimTagR{}
		}
		args = append(args, object.ClaimID)
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &claimTagR{}
			}
			for _, a := range args {
				if a == obj.ClaimID {
					continue Outer
				}
			}
			args = append(args, obj.ClaimID)
		}
	}
	if len(args) == 0 {
		return nil
	}
	query := NewQuery(qm.From(`claim`), qm.WhereIn(`claim_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 Claim")
	}
	var resultSlice []*Claim
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Claim")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results of eager load for claim")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for claim")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		foreign := resultSlice[0]
		object.R.Claim = foreign
		if foreign.R == nil {
			foreign.R = &claimR{}
		}
		foreign.R.ClaimTags = append(foreign.R.ClaimTags, object)
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.ClaimID == foreign.ClaimID {
				local.R.Claim = foreign
				if foreign.R == nil {
					foreign.R = &claimR{}
				}
				foreign.R.ClaimTags = append(foreign.R.ClaimTags, local)
				break
			}
		}
	}
	return nil
}
func (claimTagL) LoadTag(e boil.Executor, singular bool, maybeClaimTag interface{}, mods queries.Applicator) error {
	var slice []*ClaimTag
	var object *ClaimTag
	if singular {
		object = maybeClaimTag.(*ClaimTag)
	} else {
		slice = *maybeClaimTag.(*[]*ClaimTag)
	}
	args := make([]interface{}, 0, 1)
	if singular {
		if object.R == nil {
			object.R = &claimTagR{}
		}
		if !queries.IsNil(object.TagID) {
			args = append(args, object.TagID)
		}
	} else {
	Outer:
		for _, obj := range slice {
			if obj.R == nil {
				obj.R = &claimTagR{}
			}
			for _, a := range args {
				if queries.Equal(a, obj.TagID) {
					continue Outer
				}
			}
			if !queries.IsNil(obj.TagID) {
				args = append(args, obj.TagID)
			}
		}
	}
	if len(args) == 0 {
		return nil
	}
	query := NewQuery(qm.From(`tag`), 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 Tag")
	}
	var resultSlice []*Tag
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Tag")
	}
	if err = results.Close(); err != nil {
		return errors.Wrap(err, "failed to close results of eager load for tag")
	}
	if err = results.Err(); err != nil {
		return errors.Wrap(err, "error occurred during iteration of eager loaded relations for tag")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		foreign := resultSlice[0]
		object.R.Tag = foreign
		if foreign.R == nil {
			foreign.R = &tagR{}
		}
		foreign.R.ClaimTags = append(foreign.R.ClaimTags, object)
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if queries.Equal(local.TagID, foreign.ID) {
				local.R.Tag = foreign
				if foreign.R == nil {
					foreign.R = &tagR{}
				}
				foreign.R.ClaimTags = append(foreign.R.ClaimTags, local)
				break
			}
		}
	}
	return nil
}
func (o *ClaimTag) SetClaimG(insert bool, related *Claim) error {
	return o.SetClaim(boil.GetDB(), insert, related)
}
func (o *ClaimTag) SetClaimP(exec boil.Executor, insert bool, related *Claim) {
	if err := o.SetClaim(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) SetClaimGP(insert bool, related *Claim) {
	if err := o.SetClaim(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) SetClaim(exec boil.Executor, insert bool, related *Claim) 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 `claim_tag` SET %s WHERE %s",
		strmangle.SetParamNames("`", "`", 0, []string{"claim_id"}),
		strmangle.WhereClause("`", "`", 0, claimTagPrimaryKeyColumns),
	)
	values := []interface{}{related.ClaimID, 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.ClaimID = related.ClaimID
	if o.R == nil {
		o.R = &claimTagR{
			Claim: related,
		}
	} else {
		o.R.Claim = related
	}
	if related.R == nil {
		related.R = &claimR{
			ClaimTags: ClaimTagSlice{o},
		}
	} else {
		related.R.ClaimTags = append(related.R.ClaimTags, o)
	}
	return nil
}
func (o *ClaimTag) SetTagG(insert bool, related *Tag) error {
	return o.SetTag(boil.GetDB(), insert, related)
}
func (o *ClaimTag) SetTagP(exec boil.Executor, insert bool, related *Tag) {
	if err := o.SetTag(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) SetTagGP(insert bool, related *Tag) {
	if err := o.SetTag(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) SetTag(exec boil.Executor, insert bool, related *Tag) 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 `claim_tag` SET %s WHERE %s",
		strmangle.SetParamNames("`", "`", 0, []string{"tag_id"}),
		strmangle.WhereClause("`", "`", 0, claimTagPrimaryKeyColumns),
	)
	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")
	}
	queries.Assign(&o.TagID, related.ID)
	if o.R == nil {
		o.R = &claimTagR{
			Tag: related,
		}
	} else {
		o.R.Tag = related
	}
	if related.R == nil {
		related.R = &tagR{
			ClaimTags: ClaimTagSlice{o},
		}
	} else {
		related.R.ClaimTags = append(related.R.ClaimTags, o)
	}
	return nil
}
func (o *ClaimTag) RemoveTagG(related *Tag) error {
	return o.RemoveTag(boil.GetDB(), related)
}
func (o *ClaimTag) RemoveTagP(exec boil.Executor, related *Tag) {
	if err := o.RemoveTag(exec, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) RemoveTagGP(related *Tag) {
	if err := o.RemoveTag(boil.GetDB(), related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) RemoveTag(exec boil.Executor, related *Tag) error {
	var err error
	queries.SetScanner(&o.TagID, nil)
	if err = o.Update(exec, boil.Whitelist("tag_id")); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}
	o.R.Tag = nil
	if related == nil || related.R == nil {
		return nil
	}
	for i, ri := range related.R.ClaimTags {
		if queries.Equal(o.TagID, ri.TagID) {
			continue
		}
		ln := len(related.R.ClaimTags)
		if ln > 1 && i < ln-1 {
			related.R.ClaimTags[i] = related.R.ClaimTags[ln-1]
		}
		related.R.ClaimTags = related.R.ClaimTags[:ln-1]
		break
	}
	return nil
}
func ClaimTags(mods ...qm.QueryMod) claimTagQuery {
	mods = append(mods, qm.From("`claim_tag`"))
	return claimTagQuery{NewQuery(mods...)}
}
func FindClaimTagG(iD uint64, selectCols ...string) (*ClaimTag, error) {
	return FindClaimTag(boil.GetDB(), iD, selectCols...)
}
func FindClaimTagP(exec boil.Executor, iD uint64, selectCols ...string) *ClaimTag {
	retobj, err := FindClaimTag(exec, iD, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindClaimTagGP(iD uint64, selectCols ...string) *ClaimTag {
	retobj, err := FindClaimTag(boil.GetDB(), iD, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindClaimTag(exec boil.Executor, iD uint64, selectCols ...string) (*ClaimTag, error) {
	claimTagObj := &ClaimTag{}
	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from `claim_tag` where `id`=?", sel,
	)
	q := queries.Raw(query, iD)
	err := q.Bind(nil, exec, claimTagObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "model: unable to select from claim_tag")
	}
	return claimTagObj, nil
}
func (o *ClaimTag) InsertG(columns boil.Columns) error {
	return o.Insert(boil.GetDB(), columns)
}
func (o *ClaimTag) InsertP(exec boil.Executor, columns boil.Columns) {
	if err := o.Insert(exec, columns); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) InsertGP(columns boil.Columns) {
	if err := o.Insert(boil.GetDB(), columns); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ClaimTag) Insert(exec boil.Executor, columns boil.Columns) error {
	if o == nil {
		return errors.New("model: no claim_tag provided for insertion")
	}
	var err error
	nzDefaults := queries.NonZeroDefaultSet(claimTagColumnsWithDefault, o)
	key := makeCacheKey(columns, nzDefaults)
	claimTagInsertCacheMut.RLock()
	cache, cached := claimTagInsertCache[key]
	claimTagInsertCacheMut.RUnlock()
	if !cached {
		wl, returnColumns := columns.InsertColumnSet(
			claimTagAllColumns,
			claimTagColumnsWithDefault,
			claimTagColumnsWithoutDefault,
			nzDefaults,
		)
		cache.valueMapping, err = queries.BindMapping(claimTagType, claimTagMapping, wl)
		if err != nil {
			return err
		}
		cache.retMapping, err = queries.BindMapping(claimTagType, claimTagMapping, returnColumns)
		if err != nil {
			return err
		}
		if len(wl) != 0 {
			cache.query = fmt.Sprintf("INSERT INTO `claim_tag` (`%s`) %%sVALUES (%s)%%s", strings.Join(wl, "`,`"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))
		} else {
			cache.query = "INSERT INTO `claim_tag` () VALUES ()%s%s"
		}
		var queryOutput, queryReturning string
		if len(cache.retMapping) != 0 {
			cache.retQuery = fmt.Sprintf("SELECT `%s` FROM `claim_tag` WHERE %s", strings.Join(returnColumns, "`,`"), strmangle.WhereClause("`", "`", 0, claimTagPrimaryKeyColumns))
		}
		cache.query = fmt.Sprintf(cache.query, queryOutput, queryReturning)
	}
	value := reflect.Indirect(reflect.ValueOf(o))
	vals := queries.ValuesFromMapping(value, cache.valueMapping)
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, cache.query)
		fmt.Fprintln(boil.DebugWriter, vals)
	}
	result, err := exec.Exec(cache.query, vals...)
	if err != nil {
		return errors.Wrap(err, "model: unable to insert into claim_tag")
	}
	var lastID int64
	var identifierCols []interface{}
	if len(cache.retMapping) == 0 {
		goto CacheNoHooks
	}
	lastID, err = result.LastInsertId()
	if err != nil {
		return ErrSyncFail
	}
	o.ID = uint64(lastID)
	if lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == claimTagMapping["ID"] {
		goto CacheNoHooks
	}
	identifierCols = []interface{}{
		o.ID,
	}
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, cache.retQuery)
		fmt.Fprintln(boil.DebugWriter, identifierCols...)
	}
	err = exec.QueryRow(cache.retQuery, identifierCols...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)
	if err != nil {
		return errors.Wrap(err, "model: unable to populate default values for claim_tag")
	}
CacheNoHooks:
	if !cached {
		claimTagInsertCacheMut.Lock()
		claimTagInsertCache[key] = cache
		claimTagInsertCacheMut.Unlock()
	}
	return nil
}
func (o *ClaimTag) UpdateG(columns boil.Columns) error {
	return o.Update(boil.GetDB(), columns)
}