added spray patterns

This commit is contained in:
2021-10-31 08:40:02 +01:00
parent 268793f0e5
commit 978232dd0a
66 changed files with 16805 additions and 11903 deletions

View File

@@ -4,9 +4,9 @@ package ent
import (
"context"
"csgowtfd/ent/matchplayer"
"csgowtfd/ent/predicate"
"csgowtfd/ent/roundstats"
"csgowtfd/ent/stats"
"errors"
"fmt"
"math"
@@ -26,9 +26,9 @@ type RoundStatsQuery struct {
fields []string
predicates []predicate.RoundStats
// eager-loading edges.
withStat *StatsQuery
withFKs bool
modifiers []func(s *sql.Selector)
withMatchPlayer *MatchPlayerQuery
withFKs bool
modifiers []func(s *sql.Selector)
// intermediate query (i.e. traversal path).
sql *sql.Selector
path func(context.Context) (*sql.Selector, error)
@@ -65,9 +65,9 @@ func (rsq *RoundStatsQuery) Order(o ...OrderFunc) *RoundStatsQuery {
return rsq
}
// QueryStat chains the current query on the "stat" edge.
func (rsq *RoundStatsQuery) QueryStat() *StatsQuery {
query := &StatsQuery{config: rsq.config}
// QueryMatchPlayer chains the current query on the "match_player" edge.
func (rsq *RoundStatsQuery) QueryMatchPlayer() *MatchPlayerQuery {
query := &MatchPlayerQuery{config: rsq.config}
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := rsq.prepareQuery(ctx); err != nil {
return nil, err
@@ -78,8 +78,8 @@ func (rsq *RoundStatsQuery) QueryStat() *StatsQuery {
}
step := sqlgraph.NewStep(
sqlgraph.From(roundstats.Table, roundstats.FieldID, selector),
sqlgraph.To(stats.Table, stats.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, roundstats.StatTable, roundstats.StatColumn),
sqlgraph.To(matchplayer.Table, matchplayer.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, roundstats.MatchPlayerTable, roundstats.MatchPlayerColumn),
)
fromU = sqlgraph.SetNeighbors(rsq.driver.Dialect(), step)
return fromU, nil
@@ -263,26 +263,26 @@ func (rsq *RoundStatsQuery) Clone() *RoundStatsQuery {
return nil
}
return &RoundStatsQuery{
config: rsq.config,
limit: rsq.limit,
offset: rsq.offset,
order: append([]OrderFunc{}, rsq.order...),
predicates: append([]predicate.RoundStats{}, rsq.predicates...),
withStat: rsq.withStat.Clone(),
config: rsq.config,
limit: rsq.limit,
offset: rsq.offset,
order: append([]OrderFunc{}, rsq.order...),
predicates: append([]predicate.RoundStats{}, rsq.predicates...),
withMatchPlayer: rsq.withMatchPlayer.Clone(),
// clone intermediate query.
sql: rsq.sql.Clone(),
path: rsq.path,
}
}
// WithStat tells the query-builder to eager-load the nodes that are connected to
// the "stat" edge. The optional arguments are used to configure the query builder of the edge.
func (rsq *RoundStatsQuery) WithStat(opts ...func(*StatsQuery)) *RoundStatsQuery {
query := &StatsQuery{config: rsq.config}
// WithMatchPlayer tells the query-builder to eager-load the nodes that are connected to
// the "match_player" edge. The optional arguments are used to configure the query builder of the edge.
func (rsq *RoundStatsQuery) WithMatchPlayer(opts ...func(*MatchPlayerQuery)) *RoundStatsQuery {
query := &MatchPlayerQuery{config: rsq.config}
for _, opt := range opts {
opt(query)
}
rsq.withStat = query
rsq.withMatchPlayer = query
return rsq
}
@@ -353,10 +353,10 @@ func (rsq *RoundStatsQuery) sqlAll(ctx context.Context) ([]*RoundStats, error) {
withFKs = rsq.withFKs
_spec = rsq.querySpec()
loadedTypes = [1]bool{
rsq.withStat != nil,
rsq.withMatchPlayer != nil,
}
)
if rsq.withStat != nil {
if rsq.withMatchPlayer != nil {
withFKs = true
}
if withFKs {
@@ -385,20 +385,20 @@ func (rsq *RoundStatsQuery) sqlAll(ctx context.Context) ([]*RoundStats, error) {
return nodes, nil
}
if query := rsq.withStat; query != 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].stats_round_stats == nil {
if nodes[i].match_player_round_stats == nil {
continue
}
fk := *nodes[i].stats_round_stats
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(stats.IDIn(ids...))
query.Where(matchplayer.IDIn(ids...))
neighbors, err := query.All(ctx)
if err != nil {
return nil, err
@@ -406,10 +406,10 @@ func (rsq *RoundStatsQuery) sqlAll(ctx context.Context) ([]*RoundStats, error) {
for _, n := range neighbors {
nodes, ok := nodeids[n.ID]
if !ok {
return nil, fmt.Errorf(`unexpected foreign-key "stats_round_stats" returned %v`, n.ID)
return nil, fmt.Errorf(`unexpected foreign-key "match_player_round_stats" returned %v`, n.ID)
}
for i := range nodes {
nodes[i].Edges.Stat = n
nodes[i].Edges.MatchPlayer = n
}
}
}