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"
|
||||
|
||||
@@ -19,16 +18,15 @@ import (
|
||||
// RoundStatsQuery is the builder for querying RoundStats entities.
|
||||
type RoundStatsQuery struct {
|
||||
config
|
||||
limit *int
|
||||
offset *int
|
||||
unique *bool
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
predicates []predicate.RoundStats
|
||||
// eager-loading edges.
|
||||
limit *int
|
||||
offset *int
|
||||
unique *bool
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
predicates []predicate.RoundStats
|
||||
withMatchPlayer *MatchPlayerQuery
|
||||
withFKs bool
|
||||
modifiers []func(s *sql.Selector)
|
||||
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 (rsq *RoundStatsQuery) WithMatchPlayer(opts ...func(*MatchPlayerQuery)) *Ro
|
||||
// GroupBy(roundstats.FieldRound).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (rsq *RoundStatsQuery) GroupBy(field string, fields ...string) *RoundStatsGroupBy {
|
||||
group := &RoundStatsGroupBy{config: rsq.config}
|
||||
group.fields = append([]string{field}, fields...)
|
||||
group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
|
||||
grbuild := &RoundStatsGroupBy{config: rsq.config}
|
||||
grbuild.fields = append([]string{field}, fields...)
|
||||
grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) {
|
||||
if err := rsq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsq.sqlQuery(ctx), nil
|
||||
}
|
||||
return group
|
||||
grbuild.label = roundstats.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 (rsq *RoundStatsQuery) GroupBy(field string, fields ...string) *RoundStatsG
|
||||
// client.RoundStats.Query().
|
||||
// Select(roundstats.FieldRound).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (rsq *RoundStatsQuery) Select(fields ...string) *RoundStatsSelect {
|
||||
rsq.fields = append(rsq.fields, fields...)
|
||||
return &RoundStatsSelect{RoundStatsQuery: rsq}
|
||||
selbuild := &RoundStatsSelect{RoundStatsQuery: rsq}
|
||||
selbuild.label = roundstats.Label
|
||||
selbuild.flds, selbuild.scan = &rsq.fields, selbuild.Scan
|
||||
return selbuild
|
||||
}
|
||||
|
||||
func (rsq *RoundStatsQuery) prepareQuery(ctx context.Context) error {
|
||||
@@ -348,7 +349,7 @@ func (rsq *RoundStatsQuery) prepareQuery(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rsq *RoundStatsQuery) sqlAll(ctx context.Context) ([]*RoundStats, error) {
|
||||
func (rsq *RoundStatsQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*RoundStats, error) {
|
||||
var (
|
||||
nodes = []*RoundStats{}
|
||||
withFKs = rsq.withFKs
|
||||
@@ -364,58 +365,63 @@ func (rsq *RoundStatsQuery) sqlAll(ctx context.Context) ([]*RoundStats, error) {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, roundstats.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
node := &RoundStats{config: rsq.config}
|
||||
nodes = append(nodes, node)
|
||||
return node.scanValues(columns)
|
||||
return (*RoundStats).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 := &RoundStats{config: rsq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
return node.assignValues(columns, values)
|
||||
}
|
||||
if len(rsq.modifiers) > 0 {
|
||||
_spec.Modifiers = rsq.modifiers
|
||||
}
|
||||
for i := range hooks {
|
||||
hooks[i](ctx, _spec)
|
||||
}
|
||||
if err := sqlgraph.QueryNodes(ctx, rsq.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
if query := rsq.withMatchPlayer; query != nil {
|
||||
ids := make([]int, 0, len(nodes))
|
||||
nodeids := make(map[int][]*RoundStats)
|
||||
for i := range nodes {
|
||||
if nodes[i].match_player_round_stats == nil {
|
||||
continue
|
||||
}
|
||||
fk := *nodes[i].match_player_round_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 := rsq.loadMatchPlayer(ctx, query, nodes, nil,
|
||||
func(n *RoundStats, e *MatchPlayer) { n.Edges.MatchPlayer = 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_round_stats" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
nodes[i].Edges.MatchPlayer = n
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (rsq *RoundStatsQuery) loadMatchPlayer(ctx context.Context, query *MatchPlayerQuery, nodes []*RoundStats, init func(*RoundStats), assign func(*RoundStats, *MatchPlayer)) error {
|
||||
ids := make([]int, 0, len(nodes))
|
||||
nodeids := make(map[int][]*RoundStats)
|
||||
for i := range nodes {
|
||||
if nodes[i].match_player_round_stats == nil {
|
||||
continue
|
||||
}
|
||||
fk := *nodes[i].match_player_round_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_round_stats" returned %v`, n.ID)
|
||||
}
|
||||
for i := range nodes {
|
||||
assign(nodes[i], n)
|
||||
}
|
||||
}
|
||||
|
||||
return nodes, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rsq *RoundStatsQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
@@ -530,6 +536,7 @@ func (rsq *RoundStatsQuery) Modify(modifiers ...func(s *sql.Selector)) *RoundSta
|
||||
// RoundStatsGroupBy is the group-by builder for RoundStats entities.
|
||||
type RoundStatsGroupBy struct {
|
||||
config
|
||||
selector
|
||||
fields []string
|
||||
fns []AggregateFunc
|
||||
// intermediate query (i.e. traversal path).
|
||||
@@ -553,209 +560,6 @@ func (rsgb *RoundStatsGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
return rsgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := rsgb.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 (rsgb *RoundStatsGroupBy) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(rsgb.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsGroupBy.Strings is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := rsgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) StringsX(ctx context.Context) []string {
|
||||
v, err := rsgb.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 (rsgb *RoundStatsGroupBy) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = rsgb.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsGroupBy.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) StringX(ctx context.Context) string {
|
||||
v, err := rsgb.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 (rsgb *RoundStatsGroupBy) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(rsgb.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsGroupBy.Ints is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := rsgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) IntsX(ctx context.Context) []int {
|
||||
v, err := rsgb.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 (rsgb *RoundStatsGroupBy) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = rsgb.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsGroupBy.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) IntX(ctx context.Context) int {
|
||||
v, err := rsgb.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 (rsgb *RoundStatsGroupBy) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(rsgb.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsGroupBy.Float64s is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := rsgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := rsgb.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 (rsgb *RoundStatsGroupBy) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = rsgb.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsGroupBy.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) Float64X(ctx context.Context) float64 {
|
||||
v, err := rsgb.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 (rsgb *RoundStatsGroupBy) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(rsgb.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsGroupBy.Bools is not achievable when grouping more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := rsgb.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) BoolsX(ctx context.Context) []bool {
|
||||
v, err := rsgb.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 (rsgb *RoundStatsGroupBy) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = rsgb.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsGroupBy.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (rsgb *RoundStatsGroupBy) BoolX(ctx context.Context) bool {
|
||||
v, err := rsgb.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (rsgb *RoundStatsGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
for _, f := range rsgb.fields {
|
||||
if !roundstats.ValidColumn(f) {
|
||||
@@ -797,6 +601,7 @@ func (rsgb *RoundStatsGroupBy) sqlQuery() *sql.Selector {
|
||||
// RoundStatsSelect is the builder for selecting fields of RoundStats entities.
|
||||
type RoundStatsSelect struct {
|
||||
*RoundStatsQuery
|
||||
selector
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
}
|
||||
@@ -810,201 +615,6 @@ func (rss *RoundStatsSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
return rss.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) ScanX(ctx context.Context, v interface{}) {
|
||||
if err := rss.Scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
|
||||
func (rss *RoundStatsSelect) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(rss.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsSelect.Strings is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := rss.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) StringsX(ctx context.Context) []string {
|
||||
v, err := rss.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 (rss *RoundStatsSelect) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = rss.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsSelect.Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) StringX(ctx context.Context) string {
|
||||
v, err := rss.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 (rss *RoundStatsSelect) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(rss.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsSelect.Ints is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := rss.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) IntsX(ctx context.Context) []int {
|
||||
v, err := rss.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 (rss *RoundStatsSelect) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = rss.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsSelect.Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) IntX(ctx context.Context) int {
|
||||
v, err := rss.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 (rss *RoundStatsSelect) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(rss.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsSelect.Float64s is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := rss.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := rss.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 (rss *RoundStatsSelect) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = rss.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsSelect.Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) Float64X(ctx context.Context) float64 {
|
||||
v, err := rss.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 (rss *RoundStatsSelect) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(rss.fields) > 1 {
|
||||
return nil, errors.New("ent: RoundStatsSelect.Bools is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := rss.Scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) BoolsX(ctx context.Context) []bool {
|
||||
v, err := rss.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 (rss *RoundStatsSelect) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = rss.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{roundstats.Label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: RoundStatsSelect.Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (rss *RoundStatsSelect) BoolX(ctx context.Context) bool {
|
||||
v, err := rss.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func (rss *RoundStatsSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := rss.sql.Query()
|
||||
|
Reference in New Issue
Block a user