func (o *Blog) UpdateP(exec boil.Executor, whitelist ...string) {
	err := o.Update(exec, whitelist...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
}
UpdateP uses an executor to update the Blog, and panics on error.
See Update for whitelist behavior description.
package mdbmodels
import (
	"bytes"
	"database/sql"
	"fmt"
	"reflect"
	"strings"
	"sync"
	"time"
	"github.com/Bnei-Baruch/sqlboiler/boil"
	"github.com/Bnei-Baruch/sqlboiler/queries"
	"github.com/Bnei-Baruch/sqlboiler/queries/qm"
	"github.com/Bnei-Baruch/sqlboiler/strmangle"
	"github.com/pkg/errors"
)
type Blog struct {
	ID   int64  `boil:"id" json:"id" toml:"id" yaml:"id"`
	Name string `boil:"name" json:"name" toml:"name" yaml:"name"`
	URL  string `boil:"url" json:"url" toml:"url" yaml:"url"`
	R *blogR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L blogL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var BlogColumns = struct {
	ID   string
	Name string
	URL  string
}{
	ID:   "id",
	Name: "name",
	URL:  "url",
}
type blogR struct {
	BlogPosts BlogPostSlice
}
type blogL struct{}
var (
	blogColumns               = []string{"id", "name", "url"}
	blogColumnsWithoutDefault = []string{"name", "url"}
	blogColumnsWithDefault    = []string{"id"}
	blogPrimaryKeyColumns     = []string{"id"}
)
type (
	BlogSlice []*Blog
	blogQuery struct {
		*queries.Query
	}
)
var (
	blogType                 = reflect.TypeOf(&Blog{})
	blogMapping              = queries.MakeStructMapping(blogType)
	blogPrimaryKeyMapping, _ = queries.BindMapping(blogType, blogMapping, blogPrimaryKeyColumns)
	blogInsertCacheMut       sync.RWMutex
	blogInsertCache          = make(map[string]insertCache)
	blogUpdateCacheMut       sync.RWMutex
	blogUpdateCache          = make(map[string]updateCache)
	blogUpsertCacheMut       sync.RWMutex
	blogUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = bytes.MinRead
)
func (q blogQuery) OneP() *Blog {
	o, err := q.One()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q blogQuery) One() (*Blog, error) {
	o := &Blog{}
	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, "mdbmodels: failed to execute a one query for blogs")
	}
	return o, nil
}
func (q blogQuery) AllP() BlogSlice {
	o, err := q.All()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q blogQuery) All() (BlogSlice, error) {
	var o []*Blog
	err := q.Bind(&o)
	if err != nil {
		return nil, errors.Wrap(err, "mdbmodels: failed to assign all query results to Blog slice")
	}
	return o, nil
}
func (q blogQuery) CountP() int64 {
	c, err := q.Count()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q blogQuery) 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, "mdbmodels: failed to count blogs rows")
	}
	return count, nil
}
func (q blogQuery) ExistsP() bool {
	e, err := q.Exists()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q blogQuery) 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, "mdbmodels: failed to check if blogs exists")
	}
	return count > 0, nil
}
func (o *Blog) BlogPostsG(mods ...qm.QueryMod) blogPostQuery {
	return o.BlogPosts(boil.GetDB(), mods...)
}
func (o *Blog) BlogPosts(exec boil.Executor, mods ...qm.QueryMod) blogPostQuery {
	var queryMods []qm.QueryMod
	if len(mods) != 0 {
		queryMods = append(queryMods, mods...)
	}
	queryMods = append(queryMods,
		qm.Where("\"blog_posts\".\"blog_id\"=?", o.ID),
	)
	query := BlogPosts(exec, queryMods...)
	queries.SetFrom(query.Query, "\"blog_posts\"")
	if len(queries.GetSelect(query.Query)) == 0 {
		queries.SetSelect(query.Query, []string{"\"blog_posts\".*"})
	}
	return query
}
func (blogL) LoadBlogPosts(e boil.Executor, singular bool, maybeBlog interface{}) error {
	var slice []*Blog
	var object *Blog
	count := 1
	if singular {
		object = maybeBlog.(*Blog)
	} else {
		slice = *maybeBlog.(*[]*Blog)
		count = len(slice)
	}
	args := make([]interface{}, count)
	if singular {
		if object.R == nil {
			object.R = &blogR{}
		}
		args[0] = object.ID
	} else {
		for i, obj := range slice {
			if obj.R == nil {
				obj.R = &blogR{}
			}
			args[i] = obj.ID
		}
	}
	query := fmt.Sprintf(
		"select * from \"blog_posts\" where \"blog_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 blog_posts")
	}
	defer results.Close()
	var resultSlice []*BlogPost
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice blog_posts")
	}
	if singular {
		object.R.BlogPosts = resultSlice
		return nil
	}
	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.ID == foreign.BlogID {
				local.R.BlogPosts = append(local.R.BlogPosts, foreign)
				break
			}
		}
	}
	return nil
}
func (o *Blog) AddBlogPostsG(insert bool, related ...*BlogPost) error {
	return o.AddBlogPosts(boil.GetDB(), insert, related...)
}
func (o *Blog) AddBlogPostsP(exec boil.Executor, insert bool, related ...*BlogPost) {
	if err := o.AddBlogPosts(exec, insert, related...); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Blog) AddBlogPostsGP(insert bool, related ...*BlogPost) {
	if err := o.AddBlogPosts(boil.GetDB(), insert, related...); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Blog) AddBlogPosts(exec boil.Executor, insert bool, related ...*BlogPost) error {
	var err error
	for _, rel := range related {
		if insert {
			rel.BlogID = o.ID
			if err = rel.Insert(exec); err != nil {
				return errors.Wrap(err, "failed to insert into foreign table")
			}
		} else {
			updateQuery := fmt.Sprintf(
				"UPDATE \"blog_posts\" SET %s WHERE %s",
				strmangle.SetParamNames("\"", "\"", 1, []string{"blog_id"}),
				strmangle.WhereClause("\"", "\"", 2, blogPostPrimaryKeyColumns),
			)
			values := []interface{}{o.ID, rel.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 foreign table")
			}
			rel.BlogID = o.ID
		}
	}
	if o.R == nil {
		o.R = &blogR{
			BlogPosts: related,
		}
	} else {
		o.R.BlogPosts = append(o.R.BlogPosts, related...)
	}
	for _, rel := range related {
		if rel.R == nil {
			rel.R = &blogPostR{
				Blog: o,
			}
		} else {
			rel.R.Blog = o
		}
	}
	return nil
}
func BlogsG(mods ...qm.QueryMod) blogQuery {
	return Blogs(boil.GetDB(), mods...)
}
func Blogs(exec boil.Executor, mods ...qm.QueryMod) blogQuery {
	mods = append(mods, qm.From("\"blogs\""))
	return blogQuery{NewQuery(exec, mods...)}
}
func FindBlogG(id int64, selectCols ...string) (*Blog, error) {
	return FindBlog(boil.GetDB(), id, selectCols...)
}
func FindBlogGP(id int64, selectCols ...string) *Blog {
	retobj, err := FindBlog(boil.GetDB(), id, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func FindBlog(exec boil.Executor, id int64, selectCols ...string) (*Blog, error) {
	blogObj := &Blog{}
	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"blogs\" where \"id\"=$1", sel,
	)
	q := queries.Raw(exec, query, id)
	err := q.Bind(blogObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "mdbmodels: unable to select from blogs")
	}
	return blogObj, nil
}
func FindBlogP(exec boil.Executor, id int64, selectCols ...string) *Blog {
	retobj, err := FindBlog(exec, id, selectCols...)
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return retobj
}
func (o *Blog) InsertG(whitelist ...string) error {
	return o.Insert(boil.GetDB(), whitelist...)
}
func (o *Blog) InsertGP(whitelist ...string) {
	if err := o.Insert(boil.GetDB(), whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Blog) InsertP(exec boil.Executor, whitelist ...string) {
	if err := o.Insert(exec, whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}
func (o *Blog) Insert(exec boil.Executor, whitelist ...string) error {
	if o == nil {
		return errors.New("mdbmodels: no blogs provided for insertion")
	}
	var err error
	nzDefaults := queries.NonZeroDefaultSet(blogColumnsWithDefault, o)
	key := makeCacheKey(whitelist, nzDefaults)
	blogInsertCacheMut.RLock()
	cache, cached := blogInsertCache[key]
	blogInsertCacheMut.RUnlock()
	if !cached {
		wl, returnColumns := strmangle.InsertColumnSet(
			blogColumns,
			blogColumnsWithDefault,
			blogColumnsWithoutDefault,
			nzDefaults,
			whitelist,
		)
		cache.valueMapping, err = queries.BindMapping(blogType, blogMapping, wl)
		if err != nil {
			return err
		}
		cache.retMapping, err = queries.BindMapping(blogType, blogMapping, returnColumns)
		if err != nil {
			return err
		}
		if len(wl) != 0 {
			cache.query = fmt.Sprintf("INSERT INTO \"blogs\" (\"%s\") %%sVALUES (%s)%%s", strings.Join(wl, "\",\""), strmangle.Placeholders(dialect.IndexPlaceholders, len(wl), 1, 1))
		} else {
			cache.query = "INSERT INTO \"blogs\" DEFAULT VALUES"
		}
		var queryOutput, queryReturning string
		if len(cache.retMapping) != 0 {
			queryReturning = fmt.Sprintf(" RETURNING \"%s\"", strings.Join(returnColumns, "\",\""))
		}
		if len(wl) != 0 {
			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)
	}
	if len(cache.retMapping) != 0 {
		err = exec.QueryRow(cache.query, vals...).Scan(queries.PtrsFromMapping(value, cache.retMapping)...)
	} else {
		_, err = exec.Exec(cache.query, vals...)
	}
	if err != nil {
		return errors.Wrap(err, "mdbmodels: unable to insert into blogs")
	}
	if !cached {
		blogInsertCacheMut.Lock()
		blogInsertCache[key] = cache
		blogInsertCacheMut.Unlock()
	}
	return nil
}
func (o *Blog) UpdateG(whitelist ...string) error {
	return o.Update(boil.GetDB(), whitelist...)
}
func (o *Blog) UpdateGP(whitelist ...string) {
	if err := o.Update(boil.GetDB(), whitelist...); err != nil {
		panic(boil.WrapErr(err))
	}
}