func (o *Pet) InsertP(exec boil.Executor, whitelist ...string) {
	if err := o.Insert(exec, whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}
InsertP a single record using an executor, and panics on error. See Insert
for whitelist behavior description.
package models
import (
	"bytes"
	"database/sql"
	"fmt"
	"reflect"
	"strings"
	"sync"
	"time"
	"github.com/pkg/errors"
	"github.com/vattle/sqlboiler/boil"
	"github.com/vattle/sqlboiler/queries"
	"github.com/vattle/sqlboiler/queries/qm"
	"github.com/vattle/sqlboiler/strmangle"
	"gopkg.in/nullbio/null.v6"
)
type Pet struct {
	ID       int         `boil:"id" json:"id" toml:"id" yaml:"id"`
	Name     null.String `boil:"name" json:"name,omitempty" toml:"name" yaml:"name,omitempty"`
	Kind     null.String `boil:"kind" json:"kind,omitempty" toml:"kind" yaml:"kind,omitempty"`
	PersonID null.Int    `boil:"person_id" json:"person_id,omitempty" toml:"person_id" yaml:"person_id,omitempty"`
	R *petR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L petL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
type petR struct {
	Person *Person
}
type petL struct{}
var (
	petColumns               = []string{"id", "name", "kind", "person_id"}
	petColumnsWithoutDefault = []string{"name", "kind", "person_id"}
	petColumnsWithDefault    = []string{"id"}
	petPrimaryKeyColumns     = []string{"id"}
)
type (
	PetSlice []*Pet
	petQuery struct {
		*queries.Query
	}
)
var (
	petType                 = reflect.TypeOf(&Pet{})
	petMapping              = queries.MakeStructMapping(petType)
	petPrimaryKeyMapping, _ = queries.BindMapping(petType, petMapping, petPrimaryKeyColumns)
	petInsertCacheMut       sync.RWMutex
	petInsertCache          = make(map[string]insertCache)
	petUpdateCacheMut       sync.RWMutex
	petUpdateCache          = make(map[string]updateCache)
	petUpsertCacheMut       sync.RWMutex
	petUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = bytes.MinRead
)
func (q petQuery) OneP() *Pet {
	o, err := q.One()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q petQuery) One() (*Pet, error) {
	o := &Pet{}
	queries.SetLimit(q.Query, 1)
	err := q.Bind(o)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "models: failed to execute a one query for pets")
	}
	return o, nil
}
func (q petQuery) AllP() PetSlice {
	o, err := q.All()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q petQuery) All() (PetSlice, error) {
	var o []*Pet
	err := q.Bind(&o)
	if err != nil {
		return nil, errors.Wrap(err, "models: failed to assign all query results to Pet slice")
	}
	return o, nil
}
func (q petQuery) CountP() int64 {
	c, err := q.Count()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q petQuery) Count() (int64, error) {
	var count int64
	queries.SetSelect(q.Query, nil)
	queries.SetCount(q.Query)
	err := q.Query.QueryRow().Scan(&count)
	if err != nil {
		return 0, errors.Wrap(err, "models: failed to count pets rows")
	}
	return count, nil
}
func (q petQuery) ExistsP() bool {
	e, err := q.Exists()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q petQuery) Exists() (bool, error) {
	var count int64
	queries.SetCount(q.Query)
	queries.SetLimit(q.Query, 1)
	err := q.Query.QueryRow().Scan(&count)
	if err != nil {
		return false, errors.Wrap(err, "models: failed to check if pets exists")
	}
	return count > 0, nil
}
func (o *Pet) PersonG(mods ...qm.QueryMod) personQuery {
	return o.Person(boil.GetDB(), mods...)
}
func (o *Pet) Person(exec boil.Executor, mods ...qm.QueryMod) personQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.PersonID),
	}
	queryMods = append(queryMods, mods...)
	query := People(exec, queryMods...)
	queries.SetFrom(query.Query, "\"people\"")
	return query
}  
func (petL) LoadPerson(e boil.Executor, singular bool, maybePet interface{}) error {
	var slice []*Pet
	var object *Pet
	count := 1
	if singular {
		object = maybePet.(*Pet)
	} else {
		slice = *maybePet.(*[]*Pet)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &petR{}
		}
		args[0] = object.PersonID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &petR{}
			}
			args[i] = obj.PersonID
		}
	}
	query := fmt.Sprintf(
		"select * from \"people\" where \"id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)
	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}
	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Person")
	}
	defer results.Close()
	var resultSlice []*Person
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Person")
	}
	if len(resultSlice) == 0 {
		return nil
	}
	if singular {
		object.R.Person = resultSlice[0]
		return nil
	}
	for _, local := range slice {
		for _, foreign := range resultSlice {
			if local.PersonID.Int == foreign.ID {
				local.R.Person = foreign
				break
			}
		}
	}
	return nil
}
func (o *Pet) SetPersonG(insert bool, related *Person) error {
	return o.SetPerson(boil.GetDB(), insert, related)
}
func (o *Pet) SetPersonP(exec boil.Executor, insert bool, related *Person) {
	if err := o.SetPerson(exec, insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Pet) SetPersonGP(insert bool, related *Person) {
	if err := o.SetPerson(boil.GetDB(), insert, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Pet) SetPerson(exec boil.Executor, insert bool, related *Person) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}
	updateQuery := fmt.Sprintf(
		"UPDATE \"pets\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"person_id"}),
		strmangle.WhereClause("\"", "\"", 2, petPrimaryKeyColumns),
	)
	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.PersonID.Int = related.ID
	o.PersonID.Valid = true
	if o.R == nil {
		o.R = &petR{
			Person: related,
		}
	} else {
		o.R.Person = related
	}
	if related.R == nil {
		related.R = &personR{
			Pets: PetSlice{o},
		}
	} else {
		related.R.Pets = append(related.R.Pets, o)
	}
	return nil
}
func (o *Pet) RemovePersonG(related *Person) error {
	return o.RemovePerson(boil.GetDB(), related)
}
func (o *Pet) RemovePersonP(exec boil.Executor, related *Person) {
	if err := o.RemovePerson(exec, related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Pet) RemovePersonGP(related *Person) {
	if err := o.RemovePerson(boil.GetDB(), related); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Pet) RemovePerson(exec boil.Executor, related *Person) error {
	var err error
	o.PersonID.Valid = false
	if err = o.Update(exec, "person_id"); err != nil {
		o.PersonID.Valid = true
		return errors.Wrap(err, "failed to update local table")
	}
	o.R.Person = nil
	if related == nil || related.R == nil {
		return nil
	}
	for i, ri := range related.R.Pets {
		if o.PersonID.Int != ri.PersonID.Int {
			continue
		}
		ln := len(related.R.Pets)
		if ln > 1 && i < ln-1 {
			related.R.Pets[i] = related.R.Pets[ln-1]
		}
		related.R.Pets = related.R.Pets[:ln-1]
		break
	}
	return nil
}
func PetsG(mods ...qm.QueryMod) petQuery {
	return Pets(boil.GetDB(), mods...)
}
func Pets(exec boil.Executor, mods ...qm.QueryMod) petQuery {
	mods = append(mods, qm.From("\"pets\""))
	return petQuery{NewQuery(exec, mods...)}
}
func FindPetG(id int, selectCols ...string) (*Pet, error) {
	return FindPet(boil.GetDB(), id, selectCols...)
}
func FindPetGP(id int, selectCols ...string) *Pet {
	retobj, err := FindPet(boil.GetDB(), id, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindPet(exec boil.Executor, id int, selectCols ...string) (*Pet, error) {
	petObj := &Pet{}
	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"pets\" where \"id\"=$1", sel,
	)
	q := queries.Raw(exec, query, id)
	err := q.Bind(petObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "models: unable to select from pets")
	}
	return petObj, nil
}
func FindPetP(exec boil.Executor, id int, selectCols ...string) *Pet {
	retobj, err := FindPet(exec, id, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func (o *Pet) InsertG(whitelist ...string) error {
	return o.Insert(boil.GetDB(), whitelist...)
}
func (o *Pet) InsertGP(whitelist ...string) {
	if err := o.Insert(boil.GetDB(), whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}