func (o *ApplicationStatus) UpsertGP(updateColumns, insertColumns boil.Columns) {
	if err := o.Upsert(boil.GetDB(), updateColumns, insertColumns); err != nil {
		panic(boil.WrapErr(err))
	}
}
UpsertGP attempts an insert, and does an update or ignore on conflict. Panics on error.
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 ApplicationStatus struct {
	ID          uint64 `boil:"id" json:"id" toml:"id" yaml:"id"`
	AppVersion  int    `boil:"app_version" json:"app_version" toml:"app_version" yaml:"app_version"`
	DataVersion int    `boil:"data_version" json:"data_version" toml:"data_version" yaml:"data_version"`
	APIVersion  int    `boil:"api_version" json:"api_version" toml:"api_version" yaml:"api_version"`
	R *applicationStatusR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L applicationStatusL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var ApplicationStatusColumns = struct {
	ID          string
	AppVersion  string
	DataVersion string
	APIVersion  string
}{
	ID:          "id",
	AppVersion:  "app_version",
	DataVersion: "data_version",
	APIVersion:  "api_version",
}
type whereHelperint struct{ field string }
func (w whereHelperint) EQ(x int) qm.QueryMod  { return qmhelper.Where(w.field, qmhelper.EQ, x) }
func (w whereHelperint) NEQ(x int) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.NEQ, x) }
func (w whereHelperint) LT(x int) qm.QueryMod  { return qmhelper.Where(w.field, qmhelper.LT, x) }
func (w whereHelperint) LTE(x int) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.LTE, x) }
func (w whereHelperint) GT(x int) qm.QueryMod  { return qmhelper.Where(w.field, qmhelper.GT, x) }
func (w whereHelperint) GTE(x int) qm.QueryMod { return qmhelper.Where(w.field, qmhelper.GTE, x) }
var ApplicationStatusWhere = struct {
	ID          whereHelperuint64
	AppVersion  whereHelperint
	DataVersion whereHelperint
	APIVersion  whereHelperint
}{
	ID:          whereHelperuint64{field: "`application_status`.`id`"},
	AppVersion:  whereHelperint{field: "`application_status`.`app_version`"},
	DataVersion: whereHelperint{field: "`application_status`.`data_version`"},
	APIVersion:  whereHelperint{field: "`application_status`.`api_version`"},
}
var ApplicationStatusRels = struct {
}{}
type applicationStatusR struct {
}
func (*applicationStatusR) NewStruct() *applicationStatusR {
	return &applicationStatusR{}
}
type applicationStatusL struct{}
var (
	applicationStatusAllColumns            = []string{"id", "app_version", "data_version", "api_version"}
	applicationStatusColumnsWithoutDefault = []string{"app_version", "data_version", "api_version"}
	applicationStatusColumnsWithDefault    = []string{"id"}
	applicationStatusPrimaryKeyColumns     = []string{"id"}
)
type (
	ApplicationStatusSlice []*ApplicationStatus
	applicationStatusQuery struct {
		*queries.Query
	}
)
var (
	applicationStatusType                 = reflect.TypeOf(&ApplicationStatus{})
	applicationStatusMapping              = queries.MakeStructMapping(applicationStatusType)
	applicationStatusPrimaryKeyMapping, _ = queries.BindMapping(applicationStatusType, applicationStatusMapping, applicationStatusPrimaryKeyColumns)
	applicationStatusInsertCacheMut       sync.RWMutex
	applicationStatusInsertCache          = make(map[string]insertCache)
	applicationStatusUpdateCacheMut       sync.RWMutex
	applicationStatusUpdateCache          = make(map[string]updateCache)
	applicationStatusUpsertCacheMut       sync.RWMutex
	applicationStatusUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = qmhelper.Where
)
func (q applicationStatusQuery) OneG() (*ApplicationStatus, error) {
	return q.One(boil.GetDB())
}
func (q applicationStatusQuery) OneGP() *ApplicationStatus {
	o, err := q.One(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q applicationStatusQuery) OneP(exec boil.Executor) *ApplicationStatus {
	o, err := q.One(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q applicationStatusQuery) One(exec boil.Executor) (*ApplicationStatus, error) {
	o := &ApplicationStatus{}
	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 application_status")
	}
	return o, nil
}
func (q applicationStatusQuery) AllG() (ApplicationStatusSlice, error) {
	return q.All(boil.GetDB())
}
func (q applicationStatusQuery) AllGP() ApplicationStatusSlice {
	o, err := q.All(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q applicationStatusQuery) AllP(exec boil.Executor) ApplicationStatusSlice {
	o, err := q.All(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q applicationStatusQuery) All(exec boil.Executor) (ApplicationStatusSlice, error) {
	var o []*ApplicationStatus
	err := q.Bind(nil, exec, &o)
	if err != nil {
		return nil, errors.Wrap(err, "model: failed to assign all query results to ApplicationStatus slice")
	}
	return o, nil
}
func (q applicationStatusQuery) CountG() (int64, error) {
	return q.Count(boil.GetDB())
}
func (q applicationStatusQuery) CountGP() int64 {
	c, err := q.Count(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q applicationStatusQuery) CountP(exec boil.Executor) int64 {
	c, err := q.Count(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q applicationStatusQuery) 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 application_status rows")
	}
	return count, nil
}
func (q applicationStatusQuery) ExistsG() (bool, error) {
	return q.Exists(boil.GetDB())
}
func (q applicationStatusQuery) ExistsGP() bool {
	e, err := q.Exists(boil.GetDB())
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q applicationStatusQuery) ExistsP(exec boil.Executor) bool {
	e, err := q.Exists(exec)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q applicationStatusQuery) 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 application_status exists")
	}
	return count > 0, nil
}
func ApplicationStatuses(mods ...qm.QueryMod) applicationStatusQuery {
	mods = append(mods, qm.From("`application_status`"))
	return applicationStatusQuery{NewQuery(mods...)}
}
func FindApplicationStatusG(iD uint64, selectCols ...string) (*ApplicationStatus, error) {
	return FindApplicationStatus(boil.GetDB(), iD, selectCols...)
}
func FindApplicationStatusP(exec boil.Executor, iD uint64, selectCols ...string) *ApplicationStatus {
	retobj, err := FindApplicationStatus(exec, iD, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindApplicationStatusGP(iD uint64, selectCols ...string) *ApplicationStatus {
	retobj, err := FindApplicationStatus(boil.GetDB(), iD, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindApplicationStatus(exec boil.Executor, iD uint64, selectCols ...string) (*ApplicationStatus, error) {
	applicationStatusObj := &ApplicationStatus{}
	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from `application_status` where `id`=?", sel,
	)
	q := queries.Raw(query, iD)
	err := q.Bind(nil, exec, applicationStatusObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "model: unable to select from application_status")
	}
	return applicationStatusObj, nil
}
func (o *ApplicationStatus) InsertG(columns boil.Columns) error {
	return o.Insert(boil.GetDB(), columns)
}
func (o *ApplicationStatus) InsertP(exec boil.Executor, columns boil.Columns) {
	if err := o.Insert(exec, columns); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ApplicationStatus) InsertGP(columns boil.Columns) {
	if err := o.Insert(boil.GetDB(), columns); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ApplicationStatus) Insert(exec boil.Executor, columns boil.Columns) error {
	if o == nil {
		return errors.New("model: no application_status provided for insertion")
	}
	var err error
	nzDefaults := queries.NonZeroDefaultSet(applicationStatusColumnsWithDefault, o)
	key := makeCacheKey(columns, nzDefaults)
	applicationStatusInsertCacheMut.RLock()
	cache, cached := applicationStatusInsertCache[key]
	applicationStatusInsertCacheMut.RUnlock()
	if !cached {
		wl, returnColumns := columns.InsertColumnSet(
			applicationStatusAllColumns,
			applicationStatusColumnsWithDefault,
			applicationStatusColumnsWithoutDefault,
			nzDefaults,
		)
		cache.valueMapping, err = queries.BindMapping(applicationStatusType, applicationStatusMapping, wl)
		if err != nil {
			return err
		}
		cache.retMapping, err = queries.BindMapping(applicationStatusType, applicationStatusMapping, returnColumns)
		if err != nil {
			return err
		}
		if len(wl) != 0 {
			cache.query = fmt.Sprintf("INSERT INTO `application_status` (`%s`) %%sVALUES (%s)%%s", strings.Join(wl, "`,`"), strmangle.Placeholders(dialect.UseIndexPlaceholders, len(wl), 1, 1))
		} else {
			cache.query = "INSERT INTO `application_status` () VALUES ()%s%s"
		}
		var queryOutput, queryReturning string
		if len(cache.retMapping) != 0 {
			cache.retQuery = fmt.Sprintf("SELECT `%s` FROM `application_status` WHERE %s", strings.Join(returnColumns, "`,`"), strmangle.WhereClause("`", "`", 0, applicationStatusPrimaryKeyColumns))
		}
		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 application_status")
	}
	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] == applicationStatusMapping["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 application_status")
	}
CacheNoHooks:
	if !cached {
		applicationStatusInsertCacheMut.Lock()
		applicationStatusInsertCache[key] = cache
		applicationStatusInsertCacheMut.Unlock()
	}
	return nil
}
func (o *ApplicationStatus) UpdateG(columns boil.Columns) error {
	return o.Update(boil.GetDB(), columns)
}
func (o *ApplicationStatus) UpdateP(exec boil.Executor, columns boil.Columns) {
	err := o.Update(exec, columns)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ApplicationStatus) UpdateGP(columns boil.Columns) {
	err := o.Update(boil.GetDB(), columns)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *ApplicationStatus) Update(exec boil.Executor, columns boil.Columns) error {
	var err error
	key := makeCacheKey(columns, nil)
	applicationStatusUpdateCacheMut.RLock()
	cache, cached := applicationStatusUpdateCache[key]
	applicationStatusUpdateCacheMut.RUnlock()
	if !cached {
		wl := columns.UpdateColumnSet(
			applicationStatusAllColumns,
			applicationStatusPrimaryKeyColumns,
		)
		if len(wl) == 0 {
			return errors.New("model: unable to update application_status, could not build whitelist")
		}
		cache.query = fmt.Sprintf("UPDATE `application_status` SET %s WHERE %s",
			strmangle.SetParamNames("`", "`", 0, wl),
			strmangle.WhereClause("`", "`", 0, applicationStatusPrimaryKeyColumns),
		)
		cache.valueMapping, err = queries.BindMapping(applicationStatusType, applicationStatusMapping, append(wl, applicationStatusPrimaryKeyColumns...))
		if err != nil {
			return err
		}
	}
	values := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, cache.query)
		fmt.Fprintln(boil.DebugWriter, values)
	}
	_, err = exec.Exec(cache.query, values...)
	if err != nil {
		return errors.Wrap(err, "model: unable to update application_status row")
	}
	if !cached {
		applicationStatusUpdateCacheMut.Lock()
		applicationStatusUpdateCache[key] = cache
		applicationStatusUpdateCacheMut.Unlock()
	}
	return nil
}
func (q applicationStatusQuery) UpdateAllP(exec boil.Executor, cols M) {
	err := q.UpdateAll(exec, cols)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
func (q applicationStatusQuery) UpdateAllG(cols M) error {
	return q.UpdateAll(boil.GetDB(), cols)
}
func (q applicationStatusQuery) UpdateAll(exec boil.Executor, cols M) error {
	queries.SetUpdate(q.Query, cols)
	_, err := q.Query.Exec(exec)
	if err != nil {
		return errors.Wrap(err, "model: unable to update all for application_status")
	}
	return nil
}
func (o ApplicationStatusSlice) UpdateAllG(cols M) error {
	return o.UpdateAll(boil.GetDB(), cols)
}
func (o ApplicationStatusSlice) UpdateAllGP(cols M) {
	err := o.UpdateAll(boil.GetDB(), cols)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o ApplicationStatusSlice) UpdateAllP(exec boil.Executor, cols M) {
	err := o.UpdateAll(exec, cols)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o ApplicationStatusSlice) UpdateAll(exec boil.Executor, cols M) error {
	ln := int64(len(o))
	if ln == 0 {
		return nil
	}
	if len(cols) == 0 {
		return errors.New("model: update all requires at least one column argument")
	}
	colNames := make([]string, len(cols))
	args := make([]interface{}, len(cols))
	i := 0
	for name, value := range cols {
		colNames[i] = name
		args[i] = value
		i++
	}
	for _, obj := range o {
		pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), applicationStatusPrimaryKeyMapping)
		args = append(args, pkeyArgs...)
	}
	sql := fmt.Sprintf("UPDATE `application_status` SET %s WHERE %s",
		strmangle.SetParamNames("`", "`", 0, colNames),
		strmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), 0, applicationStatusPrimaryKeyColumns, len(o)))
	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, sql)
		fmt.Fprintln(boil.DebugWriter, args...)
	}
	_, err := exec.Exec(sql, args...)
	if err != nil {
		return errors.Wrap(err, "model: unable to update all in applicationStatus slice")
	}
	return nil
}
func (o *ApplicationStatus) UpsertG(updateColumns, insertColumns boil.Columns) error {
	return o.Upsert(boil.GetDB(), updateColumns, insertColumns)
}