updated deps; regen ent
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
@@ -25,10 +24,9 @@ type WeaponQuery struct {
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
predicates []predicate.Weapon
|
||||
// eager-loading edges.
|
||||
withStat *MatchPlayerQuery
|
||||
withFKs bool
|
||||
modifiers []func(s *sql.Selector)
|
||||
withStat *MatchPlayerQuery
|
||||
withFKs bool
|
||||
modifiers []func(*sql.Selector)
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
@@ -301,17 +299,18 @@ func (wq *WeaponQuery) WithStat(opts ...func(*MatchPlayerQuery)) *WeaponQuery {
|
||||
// GroupBy(weapon.FieldVictim).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (wq *WeaponQuery) GroupBy(field string, fields ...string) *WeaponGroupBy {
|
||||
group := &WeaponGroupBy{config: wq.config}
|
||||
group.fields = append([]string{field}, fields...)
|
||||
group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
|
||||
grbuild := &WeaponGroupBy{config: wq.config}
|
||||
grbuild.fields = append([]string{field}, fields...)
|
||||
grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) {
|
||||
if err := wq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return wq.sqlQuery(ctx), nil
|
||||
}
|
||||
return group
|
||||
grbuild.label = weapon.Label
|
||||
grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
@@ -326,10 +325,12 @@ func (wq *WeaponQuery) GroupBy(field string, fields ...string) *WeaponGroupBy {
|
||||
// client.Weapon.Query().
|
||||
// Select(weapon.FieldVictim).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (wq *WeaponQuery) Select(fields ...string) *WeaponSelect {
|
||||
wq.fields = append(wq.fields, fields...)
|
||||
return &WeaponSelect{WeaponQuery: wq}
|
||||
selbuild := &WeaponSelect{WeaponQuery: wq}
|
||||
selbuild.label = weapon.Label
|
||||
selbuild.flds, selbuild.scan = &wq.fields, selbuild.Scan
|
||||
return selbuild
|
||||
}
|
||||
|
||||
func (wq *WeaponQuery) prepareQuery(ctx context.Context) error {
|
||||
@@ -348,7 +349,7 @@ func (wq *WeaponQuery) prepareQuery(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (wq *WeaponQuery) sqlAll(ctx context.Context) ([]*Weapon, error) {
|
||||
func (wq *WeaponQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Weapon, error) {
|
||||
var (
|
||||
nodes = []*Weapon{}
|
||||
withFKs = wq.withFKs
|
||||
@@ -364,58 +365,63 @@ func (wq *WeaponQuery) sqlAll(ctx context.Context) ([]*Weapon, error) {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, weapon.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
node := &Weapon{config: wq.config}
|
||||
nodes = append(nodes, node)
|
||||
return node.scanValues(columns)
|
||||
return (*Weapon).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
if len(nodes) == 0 {
|
||||
return fmt.Errorf("ent: Assign called without calling ScanValues")
|
||||
}
|
||||
node := nodes[len(nodes)-1]
|
||||
node := &Weapon{config: wq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
return node.assignValues(columns, values)
|
||||
}
|
||||
if len(wq.modifiers) > 0 {
|
||||
_spec.Modifiers = wq.modifiers
|
||||
}
|
||||
for i := range hooks {
|
||||
hooks[i](ctx, _spec)
|
||||
}
|
||||
if err := sqlgraph.QueryNodes(ctx, wq.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
if query := wq.withStat; query != nil {
|
||||
ids := make([]int, 0, len(nodes))
|
||||
nodeids := make(map[int][]*Weapon)
|
||||
for i := range nodes {
|
||||
if nodes[i].match_player_weapon_stats == nil {
|
||||
continue
|
||||
}
|
||||
fk := *nodes[i].match_player_weapon_stats
|
||||
if _, ok := nodeids[fk]; !ok {
|
||||
ids = append(ids, fk)
|
||||
}
|
||||
nodeids[fk] = append(nodeids[fk], nodes[i])
|
||||
}
|
||||
query.Where(matchplayer.IDIn(ids...))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
if err := wq.loadStat(ctx, query, nodes, nil,
|
||||
func(n *Weapon, e *MatchPlayer) { n.Edges.Stat = e }); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, n := range neighbors {
|
||||
nodes, ok := nodeids[n.ID]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf(`unexpected foreign-key "match_player_weapon_stats" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
nodes[i].Edges.Stat = n
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (wq *WeaponQuery) loadStat(ctx context.Context, query *MatchPlayerQuery, nodes []*Weapon, init func(*Weapon), assign func(*Weapon, *MatchPlayer)) error {
|
||||
ids := make([]int, 0, len(nodes))
|
||||
nodeids := make(map[int][]*Weapon)
|
||||
for i := range nodes {
|
||||
if nodes[i].match_player_weapon_stats == nil {
|
||||
continue
|
||||
}
|
||||
fk := *nodes[i].match_player_weapon_stats
|
||||
if _, ok := nodeids[fk]; !ok {
|
||||
ids = append(ids, fk)
|
||||
}
|
||||
nodeids[fk] = append(nodeids[fk], nodes[i])
|
||||
}
|
||||
query.Where(matchplayer.IDIn(ids...))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, n := range neighbors {
|
||||
nodes, ok := nodeids[n.ID]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "match_player_weapon_stats" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
assign(nodes[i], n)
|
||||
}
|
||||
}
|
||||
|
||||
return nodes, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (wq *WeaponQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
@@ -530,6 +536,7 @@ func (wq *WeaponQuery) Modify(modifiers ...func(s *sql.Selector)) *WeaponSelect
|
||||
// WeaponGroupBy is the group-by builder for Weapon entities.
|
||||
type WeaponGroupBy struct {
|
||||
config
|
||||
selector
|
||||
fields []string
|
||||
fns []AggregateFunc
|
||||
// intermediate query (i.e. traversal path).
|
||||
@@ -553,209 +560,6 @@ func (wgb *WeaponGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
return wgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := wgb.Scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(wgb.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponGroupBy.Strings is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := wgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) StringsX(ctx context.Context) []string {
|
||||
v, err := wgb.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = wgb.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponGroupBy.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) StringX(ctx context.Context) string {
|
||||
v, err := wgb.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(wgb.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponGroupBy.Ints is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := wgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) IntsX(ctx context.Context) []int {
|
||||
v, err := wgb.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = wgb.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponGroupBy.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) IntX(ctx context.Context) int {
|
||||
v, err := wgb.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(wgb.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponGroupBy.Float64s is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := wgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := wgb.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = wgb.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponGroupBy.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) Float64X(ctx context.Context) float64 {
|
||||
v, err := wgb.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from group-by.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(wgb.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponGroupBy.Bools is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := wgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) BoolsX(ctx context.Context) []bool {
|
||||
v, err := wgb.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a group-by query.
|
||||
// It is only allowed when executing a group-by query with one field.
|
||||
func (wgb *WeaponGroupBy) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = wgb.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponGroupBy.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (wgb *WeaponGroupBy) BoolX(ctx context.Context) bool {
|
||||
v, err := wgb.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (wgb *WeaponGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
for _, f := range wgb.fields {
|
||||
if !weapon.ValidColumn(f) {
|
||||
@@ -797,6 +601,7 @@ func (wgb *WeaponGroupBy) sqlQuery() *sql.Selector {
|
||||
// WeaponSelect is the builder for selecting fields of Weapon entities.
|
||||
type WeaponSelect struct {
|
||||
*WeaponQuery
|
||||
selector
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
}
|
||||
@@ -810,201 +615,6 @@ func (ws *WeaponSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
return ws.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := ws.Scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(ws.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponSelect.Strings is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := ws.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) StringsX(ctx context.Context) []string {
|
||||
v, err := ws.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = ws.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponSelect.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) StringX(ctx context.Context) string {
|
||||
v, err := ws.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(ws.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponSelect.Ints is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := ws.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) IntsX(ctx context.Context) []int {
|
||||
v, err := ws.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = ws.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponSelect.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) IntX(ctx context.Context) int {
|
||||
v, err := ws.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(ws.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponSelect.Float64s is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := ws.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := ws.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = ws.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponSelect.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) Float64X(ctx context.Context) float64 {
|
||||
v, err := ws.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(ws.fields) > 1 {
|
||||
return nil, errors.New("ent: WeaponSelect.Bools is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := ws.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) BoolsX(ctx context.Context) []bool {
|
||||
v, err := ws.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a selector. It is only allowed when selecting one field.
|
||||
func (ws *WeaponSelect) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = ws.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{weapon.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: WeaponSelect.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (ws *WeaponSelect) BoolX(ctx context.Context) bool {
|
||||
v, err := ws.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (ws *WeaponSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := ws.sql.Query()
|
||||
|
Reference in New Issue
Block a user