updated deps; regen ent

This commit is contained in:
2022-11-03 02:19:19 +01:00
parent 4b256dd594
commit ff3bbe0037
44 changed files with 938 additions and 2309 deletions

View File

@@ -513,6 +513,11 @@ func (mpq *MatchPlayerQuery) Select(fields ...string) *MatchPlayerSelect {
return selbuild
}
// Aggregate returns a MatchPlayerSelect configured with the given aggregations.
func (mpq *MatchPlayerQuery) Aggregate(fns ...AggregateFunc) *MatchPlayerSelect {
return mpq.Select().Aggregate(fns...)
}
func (mpq *MatchPlayerQuery) prepareQuery(ctx context.Context) error {
for _, f := range mpq.fields {
if !matchplayer.ValidColumn(f) {
@@ -542,10 +547,10 @@ func (mpq *MatchPlayerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]
mpq.withMessages != nil,
}
)
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*MatchPlayer).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []interface{}) error {
_spec.Assign = func(columns []string, values []any) error {
node := &MatchPlayer{config: mpq.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
@@ -796,11 +801,14 @@ func (mpq *MatchPlayerQuery) sqlCount(ctx context.Context) (int, error) {
}
func (mpq *MatchPlayerQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := mpq.sqlCount(ctx)
if err != nil {
switch _, err := mpq.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
}
return n > 0, nil
}
func (mpq *MatchPlayerQuery) querySpec() *sqlgraph.QuerySpec {
@@ -910,7 +918,7 @@ func (mpgb *MatchPlayerGroupBy) Aggregate(fns ...AggregateFunc) *MatchPlayerGrou
}
// Scan applies the group-by query and scans the result into the given value.
func (mpgb *MatchPlayerGroupBy) Scan(ctx context.Context, v interface{}) error {
func (mpgb *MatchPlayerGroupBy) Scan(ctx context.Context, v any) error {
query, err := mpgb.path(ctx)
if err != nil {
return err
@@ -919,7 +927,7 @@ func (mpgb *MatchPlayerGroupBy) Scan(ctx context.Context, v interface{}) error {
return mpgb.sqlScan(ctx, v)
}
func (mpgb *MatchPlayerGroupBy) sqlScan(ctx context.Context, v interface{}) error {
func (mpgb *MatchPlayerGroupBy) sqlScan(ctx context.Context, v any) error {
for _, f := range mpgb.fields {
if !matchplayer.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
@@ -944,8 +952,6 @@ func (mpgb *MatchPlayerGroupBy) sqlQuery() *sql.Selector {
for _, fn := range mpgb.fns {
aggregation = append(aggregation, fn(selector))
}
// If no columns were selected in a custom aggregation function, the default
// selection is the fields used for "group-by", and the aggregation functions.
if len(selector.SelectedColumns()) == 0 {
columns := make([]string, 0, len(mpgb.fields)+len(mpgb.fns))
for _, f := range mpgb.fields {
@@ -965,8 +971,14 @@ type MatchPlayerSelect struct {
sql *sql.Selector
}
// Aggregate adds the given aggregation functions to the selector query.
func (mps *MatchPlayerSelect) Aggregate(fns ...AggregateFunc) *MatchPlayerSelect {
mps.fns = append(mps.fns, fns...)
return mps
}
// Scan applies the selector query and scans the result into the given value.
func (mps *MatchPlayerSelect) Scan(ctx context.Context, v interface{}) error {
func (mps *MatchPlayerSelect) Scan(ctx context.Context, v any) error {
if err := mps.prepareQuery(ctx); err != nil {
return err
}
@@ -974,7 +986,17 @@ func (mps *MatchPlayerSelect) Scan(ctx context.Context, v interface{}) error {
return mps.sqlScan(ctx, v)
}
func (mps *MatchPlayerSelect) sqlScan(ctx context.Context, v interface{}) error {
func (mps *MatchPlayerSelect) sqlScan(ctx context.Context, v any) error {
aggregation := make([]string, 0, len(mps.fns))
for _, fn := range mps.fns {
aggregation = append(aggregation, fn(mps.sql))
}
switch n := len(*mps.selector.flds); {
case n == 0 && len(aggregation) > 0:
mps.sql.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
mps.sql.AppendSelect(aggregation...)
}
rows := &sql.Rows{}
query, args := mps.sql.Query()
if err := mps.driver.Query(ctx, query, args, rows); err != nil {