func (o *Tag) ParentTagsG(mods ...qm.QueryMod) tagQuery {
	return o.ParentTags(boil.GetDB(), mods...)
}
ParentTagsG retrieves all the tag's tags via parent_id column.
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"
	"gopkg.in/volatiletech/null.v6"
)
type Tag struct {
	ID          int64       `boil:"id" json:"id" toml:"id" yaml:"id"`
	Description null.String `boil:"description" json:"description,omitempty" toml:"description" yaml:"description,omitempty"`
	ParentID    null.Int64  `boil:"parent_id" json:"parent_id,omitempty" toml:"parent_id" yaml:"parent_id,omitempty"`
	UID         string      `boil:"uid" json:"uid" toml:"uid" yaml:"uid"`
	Pattern     null.String `boil:"pattern" json:"pattern,omitempty" toml:"pattern" yaml:"pattern,omitempty"`
	R *tagR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L tagL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}
var TagColumns = struct {
	ID          string
	Description string
	ParentID    string
	UID         string
	Pattern     string
}{
	ID:          "id",
	Description: "description",
	ParentID:    "parent_id",
	UID:         "uid",
	Pattern:     "pattern",
}
type tagR struct {
	Parent       *Tag
	ContentUnits ContentUnitSlice
	TagI18ns     TagI18nSlice
	ParentTags   TagSlice
}
type tagL struct{}
var (
	tagColumns               = []string{"id", "description", "parent_id", "uid", "pattern"}
	tagColumnsWithoutDefault = []string{"description", "parent_id", "uid", "pattern"}
	tagColumnsWithDefault    = []string{"id"}
	tagPrimaryKeyColumns     = []string{"id"}
)
type (
	TagSlice []*Tag
	tagQuery struct {
		*queries.Query
	}
)
var (
	tagType                 = reflect.TypeOf(&Tag{})
	tagMapping              = queries.MakeStructMapping(tagType)
	tagPrimaryKeyMapping, _ = queries.BindMapping(tagType, tagMapping, tagPrimaryKeyColumns)
	tagInsertCacheMut       sync.RWMutex
	tagInsertCache          = make(map[string]insertCache)
	tagUpdateCacheMut       sync.RWMutex
	tagUpdateCache          = make(map[string]updateCache)
	tagUpsertCacheMut       sync.RWMutex
	tagUpsertCache          = make(map[string]insertCache)
)
var (
	_ = time.Second
	_ = bytes.MinRead
)
func (q tagQuery) OneP() *Tag {
	o, err := q.One()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q tagQuery) One() (*Tag, error) {
	o := &Tag{}
	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 tags")
	}
	return o, nil
}
func (q tagQuery) AllP() TagSlice {
	o, err := q.All()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return o
}
func (q tagQuery) All() (TagSlice, error) {
	var o []*Tag
	err := q.Bind(&o)
	if err != nil {
		return nil, errors.Wrap(err, "mdbmodels: failed to assign all query results to Tag slice")
	}
	return o, nil
}
func (q tagQuery) CountP() int64 {
	c, err := q.Count()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return c
}
func (q tagQuery) 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 tags rows")
	}
	return count, nil
}
func (q tagQuery) ExistsP() bool {
	e, err := q.Exists()
	if err != nil {
		panic(boil.WrapErr(err))
	}
	return e
}
func (q tagQuery) 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 tags exists")
	}
	return count > 0, nil
}
func (o *Tag) ParentG(mods ...qm.QueryMod) tagQuery {
	return o.Parent(boil.GetDB(), mods...)
}
func (o *Tag) Parent(exec boil.Executor, mods ...qm.QueryMod) tagQuery {
	queryMods := []qm.QueryMod{
		qm.Where("id=?", o.ParentID),
	}
	queryMods = append(queryMods, mods...)
	query := Tags(exec, queryMods...)
	queries.SetFrom(query.Query, "\"tags\"")
	return query
}
func (o *Tag) ContentUnitsG(mods ...qm.QueryMod) contentUnitQuery {
	return o.ContentUnits(boil.GetDB(), mods...)
}
func (o *Tag) ContentUnits(exec boil.Executor, mods ...qm.QueryMod) contentUnitQuery {
	var queryMods []qm.QueryMod
	if len(mods) != 0 {
		queryMods = append(queryMods, mods...)
	}
	queryMods = append(queryMods,
		qm.InnerJoin("\"content_units_tags\" on \"content_units\".\"id\" = \"content_units_tags\".\"content_unit_id\""),
		qm.Where("\"content_units_tags\".\"tag_id\"=?", o.ID),
	)
	query := ContentUnits(exec, queryMods...)
	queries.SetFrom(query.Query, "\"content_units\"")
	if len(queries.GetSelect(query.Query)) == 0 {
		queries.SetSelect(query.Query, []string{"\"content_units\".*"})
	}
	return query
}
func (o *Tag) TagI18nsG(mods ...qm.QueryMod) tagI18nQuery {
	return o.TagI18ns(boil.GetDB(), mods...)
}
func (o *Tag) TagI18ns(exec boil.Executor, mods ...qm.QueryMod) tagI18nQuery {
	var queryMods []qm.QueryMod
	if len(mods) != 0 {
		queryMods = append(queryMods, mods...)
	}
	queryMods = append(queryMods,
		qm.Where("\"tag_i18n\".\"tag_id\"=?", o.ID),
	)
	query := TagI18ns(exec, queryMods...)
	queries.SetFrom(query.Query, "\"tag_i18n\"")
	if len(queries.GetSelect(query.Query)) == 0 {
		queries.SetSelect(query.Query, []string{"\"tag_i18n\".*"})
	}
	return query
}