updated deps & regen ent
This commit is contained in:
68
ent/ent.go
68
ent/ent.go
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
@@ -66,39 +67,35 @@ func NewTxContext(parent context.Context, tx *Tx) context.Context {
|
||||
}
|
||||
|
||||
// OrderFunc applies an ordering on the sql selector.
|
||||
// Deprecated: Use Asc/Desc functions or the package builders instead.
|
||||
type OrderFunc func(*sql.Selector)
|
||||
|
||||
// columnChecker returns a function indicates if the column exists in the given column.
|
||||
func columnChecker(table string) func(string) error {
|
||||
checks := map[string]func(string) bool{
|
||||
match.Table: match.ValidColumn,
|
||||
matchplayer.Table: matchplayer.ValidColumn,
|
||||
messages.Table: messages.ValidColumn,
|
||||
player.Table: player.ValidColumn,
|
||||
roundstats.Table: roundstats.ValidColumn,
|
||||
spray.Table: spray.ValidColumn,
|
||||
weapon.Table: weapon.ValidColumn,
|
||||
}
|
||||
check, ok := checks[table]
|
||||
if !ok {
|
||||
return func(string) error {
|
||||
return fmt.Errorf("unknown table %q", table)
|
||||
}
|
||||
}
|
||||
return func(column string) error {
|
||||
if !check(column) {
|
||||
return fmt.Errorf("unknown column %q for table %q", column, table)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var (
|
||||
initCheck sync.Once
|
||||
columnCheck sql.ColumnCheck
|
||||
)
|
||||
|
||||
// columnChecker checks if the column exists in the given table.
|
||||
func checkColumn(table, column string) error {
|
||||
initCheck.Do(func() {
|
||||
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
|
||||
match.Table: match.ValidColumn,
|
||||
matchplayer.Table: matchplayer.ValidColumn,
|
||||
messages.Table: messages.ValidColumn,
|
||||
player.Table: player.ValidColumn,
|
||||
roundstats.Table: roundstats.ValidColumn,
|
||||
spray.Table: spray.ValidColumn,
|
||||
weapon.Table: weapon.ValidColumn,
|
||||
})
|
||||
})
|
||||
return columnCheck(table, column)
|
||||
}
|
||||
|
||||
// Asc applies the given fields in ASC order.
|
||||
func Asc(fields ...string) OrderFunc {
|
||||
func Asc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Asc(s.C(f)))
|
||||
@@ -107,11 +104,10 @@ func Asc(fields ...string) OrderFunc {
|
||||
}
|
||||
|
||||
// Desc applies the given fields in DESC order.
|
||||
func Desc(fields ...string) OrderFunc {
|
||||
func Desc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Desc(s.C(f)))
|
||||
@@ -143,8 +139,7 @@ func Count() AggregateFunc {
|
||||
// Max applies the "max" aggregation function on the given field of each group.
|
||||
func Max(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -155,8 +150,7 @@ func Max(field string) AggregateFunc {
|
||||
// Mean applies the "mean" aggregation function on the given field of each group.
|
||||
func Mean(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -167,8 +161,7 @@ func Mean(field string) AggregateFunc {
|
||||
// Min applies the "min" aggregation function on the given field of each group.
|
||||
func Min(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -179,8 +172,7 @@ func Min(field string) AggregateFunc {
|
||||
// Sum applies the "sum" aggregation function on the given field of each group.
|
||||
func Sum(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -517,7 +509,7 @@ func withHooks[V Value, M any, PM interface {
|
||||
return exec(ctx)
|
||||
}
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutationT, ok := m.(PM)
|
||||
mutationT, ok := any(m).(PM)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
|
14
ent/match.go
14
ent/match.go
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
)
|
||||
@@ -46,7 +47,8 @@ type Match struct {
|
||||
TickRate float64 `json:"tick_rate,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the MatchQuery when eager-loading is set.
|
||||
Edges MatchEdges `json:"edges"`
|
||||
Edges MatchEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// MatchEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -96,7 +98,7 @@ func (*Match) scanValues(columns []string) ([]any, error) {
|
||||
case match.FieldDate:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Match", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -200,11 +202,19 @@ func (m *Match) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
m.TickRate = value.Float64
|
||||
}
|
||||
default:
|
||||
m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Match.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (m *Match) Value(name string) (ent.Value, error) {
|
||||
return m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryStats queries the "stats" edge of the Match entity.
|
||||
func (m *Match) QueryStats() *MatchPlayerQuery {
|
||||
return NewMatchClient(m.config).QueryStats(m)
|
||||
|
@@ -2,6 +2,11 @@
|
||||
|
||||
package match
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the match type in the database.
|
||||
Label = "match"
|
||||
@@ -98,3 +103,118 @@ var (
|
||||
// DefaultGamebanPresent holds the default value on creation for the "gameban_present" field.
|
||||
DefaultGamebanPresent bool
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Match queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByShareCode orders the results by the share_code field.
|
||||
func ByShareCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldShareCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMap orders the results by the map field.
|
||||
func ByMap(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMap, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDate orders the results by the date field.
|
||||
func ByDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByScoreTeamA orders the results by the score_team_a field.
|
||||
func ByScoreTeamA(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldScoreTeamA, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByScoreTeamB orders the results by the score_team_b field.
|
||||
func ByScoreTeamB(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldScoreTeamB, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByReplayURL orders the results by the replay_url field.
|
||||
func ByReplayURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldReplayURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDuration orders the results by the duration field.
|
||||
func ByDuration(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDuration, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchResult orders the results by the match_result field.
|
||||
func ByMatchResult(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMatchResult, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaxRounds orders the results by the max_rounds field.
|
||||
func ByMaxRounds(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaxRounds, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDemoParsed orders the results by the demo_parsed field.
|
||||
func ByDemoParsed(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDemoParsed, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVacPresent orders the results by the vac_present field.
|
||||
func ByVacPresent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVacPresent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGamebanPresent orders the results by the gameban_present field.
|
||||
func ByGamebanPresent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGamebanPresent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTickRate orders the results by the tick_rate field.
|
||||
func ByTickRate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTickRate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatsCount orders the results by stats count.
|
||||
func ByStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByStats orders the results by stats terms.
|
||||
func ByStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByPlayersCount orders the results by players count.
|
||||
func ByPlayersCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newPlayersStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByPlayers orders the results by players terms.
|
||||
func ByPlayers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newPlayersStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, StatsTable, StatsColumn),
|
||||
)
|
||||
}
|
||||
func newPlayersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, PlayersTable, PlayersPrimaryKey...),
|
||||
)
|
||||
}
|
||||
|
@@ -724,11 +724,7 @@ func HasStats() predicate.Match {
|
||||
// HasStatsWith applies the HasEdge predicate on the "stats" edge with a given conditions (other predicates).
|
||||
func HasStatsWith(preds ...predicate.MatchPlayer) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, StatsTable, StatsColumn),
|
||||
)
|
||||
step := newStatsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -751,11 +747,7 @@ func HasPlayers() predicate.Match {
|
||||
// HasPlayersWith applies the HasEdge predicate on the "players" edge with a given conditions (other predicates).
|
||||
func HasPlayersWith(preds ...predicate.Player) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, PlayersTable, PlayersPrimaryKey...),
|
||||
)
|
||||
step := newPlayersStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@@ -198,7 +198,7 @@ func (mc *MatchCreate) Mutation() *MatchMutation {
|
||||
// Save creates the Match in the database.
|
||||
func (mc *MatchCreate) Save(ctx context.Context) (*Match, error) {
|
||||
mc.defaults()
|
||||
return withHooks[*Match, MatchMutation](ctx, mc.sqlSave, mc.mutation, mc.hooks)
|
||||
return withHooks(ctx, mc.sqlSave, mc.mutation, mc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -367,10 +367,7 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -386,10 +383,7 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -424,8 +418,8 @@ func (mcb *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, mcb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@@ -27,7 +27,7 @@ func (md *MatchDelete) Where(ps ...predicate.Match) *MatchDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (md *MatchDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks[int, MatchMutation](ctx, md.sqlExec, md.mutation, md.hooks)
|
||||
return withHooks(ctx, md.sqlExec, md.mutation, md.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
@@ -21,7 +21,7 @@ import (
|
||||
type MatchQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []match.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Match
|
||||
withStats *MatchPlayerQuery
|
||||
@@ -58,7 +58,7 @@ func (mq *MatchQuery) Unique(unique bool) *MatchQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (mq *MatchQuery) Order(o ...OrderFunc) *MatchQuery {
|
||||
func (mq *MatchQuery) Order(o ...match.OrderOption) *MatchQuery {
|
||||
mq.order = append(mq.order, o...)
|
||||
return mq
|
||||
}
|
||||
@@ -296,7 +296,7 @@ func (mq *MatchQuery) Clone() *MatchQuery {
|
||||
return &MatchQuery{
|
||||
config: mq.config,
|
||||
ctx: mq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, mq.order...),
|
||||
order: append([]match.OrderOption{}, mq.order...),
|
||||
inters: append([]Interceptor{}, mq.inters...),
|
||||
predicates: append([]predicate.Match{}, mq.predicates...),
|
||||
withStats: mq.withStats.Clone(),
|
||||
@@ -460,8 +460,11 @@ func (mq *MatchQuery) loadStats(ctx context.Context, query *MatchPlayerQuery, no
|
||||
init(nodes[i])
|
||||
}
|
||||
}
|
||||
if len(query.ctx.Fields) > 0 {
|
||||
query.ctx.AppendFieldOnce(matchplayer.FieldMatchStats)
|
||||
}
|
||||
query.Where(predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(match.StatsColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(match.StatsColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@@ -471,7 +474,7 @@ func (mq *MatchQuery) loadStats(ctx context.Context, query *MatchPlayerQuery, no
|
||||
fk := n.MatchStats
|
||||
node, ok := nodeids[fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "match_stats" returned %v for node %v`, fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "match_stats" returned %v for node %v`, fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
|
@@ -308,7 +308,7 @@ func (mu *MatchUpdate) RemovePlayers(p ...*Player) *MatchUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (mu *MatchUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks[int, MatchMutation](ctx, mu.sqlSave, mu.mutation, mu.hooks)
|
||||
return withHooks(ctx, mu.sqlSave, mu.mutation, mu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -428,10 +428,7 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -444,10 +441,7 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -463,10 +457,7 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -482,10 +473,7 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -498,10 +486,7 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -517,10 +502,7 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -840,7 +822,7 @@ func (muo *MatchUpdateOne) Select(field string, fields ...string) *MatchUpdateOn
|
||||
|
||||
// Save executes the query and returns the updated Match entity.
|
||||
func (muo *MatchUpdateOne) Save(ctx context.Context) (*Match, error) {
|
||||
return withHooks[*Match, MatchMutation](ctx, muo.sqlSave, muo.mutation, muo.hooks)
|
||||
return withHooks(ctx, muo.sqlSave, muo.mutation, muo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -977,10 +959,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -993,10 +972,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1012,10 +988,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1031,10 +1004,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1047,10 +1017,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1066,10 +1033,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
@@ -85,7 +86,8 @@ type MatchPlayer struct {
|
||||
AvgPing float64 `json:"avg_ping,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the MatchPlayerQuery when eager-loading is set.
|
||||
Edges MatchPlayerEdges `json:"edges"`
|
||||
Edges MatchPlayerEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// MatchPlayerEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -181,7 +183,7 @@ func (*MatchPlayer) scanValues(columns []string) ([]any, error) {
|
||||
case matchplayer.FieldCrosshair, matchplayer.FieldColor:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type MatchPlayer", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -399,11 +401,19 @@ func (mp *MatchPlayer) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
mp.AvgPing = value.Float64
|
||||
}
|
||||
default:
|
||||
mp.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the MatchPlayer.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (mp *MatchPlayer) Value(name string) (ent.Value, error) {
|
||||
return mp.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatches queries the "matches" edge of the MatchPlayer entity.
|
||||
func (mp *MatchPlayer) QueryMatches() *MatchQuery {
|
||||
return NewMatchPlayerClient(mp.config).QueryMatches(mp)
|
||||
|
@@ -4,6 +4,9 @@ package matchplayer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -209,3 +212,288 @@ func ColorValidator(c Color) error {
|
||||
return fmt.Errorf("matchplayer: invalid enum value for color field: %q", c)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the MatchPlayer queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTeamID orders the results by the team_id field.
|
||||
func ByTeamID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTeamID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByKills orders the results by the kills field.
|
||||
func ByKills(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldKills, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeaths orders the results by the deaths field.
|
||||
func ByDeaths(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeaths, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAssists orders the results by the assists field.
|
||||
func ByAssists(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAssists, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeadshot orders the results by the headshot field.
|
||||
func ByHeadshot(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeadshot, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMvp orders the results by the mvp field.
|
||||
func ByMvp(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMvp, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByScore orders the results by the score field.
|
||||
func ByScore(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldScore, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRankNew orders the results by the rank_new field.
|
||||
func ByRankNew(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRankNew, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRankOld orders the results by the rank_old field.
|
||||
func ByRankOld(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRankOld, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk2 orders the results by the mk_2 field.
|
||||
func ByMk2(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk2, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk3 orders the results by the mk_3 field.
|
||||
func ByMk3(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk3, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk4 orders the results by the mk_4 field.
|
||||
func ByMk4(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk4, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk5 orders the results by the mk_5 field.
|
||||
func ByMk5(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk5, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDmgEnemy orders the results by the dmg_enemy field.
|
||||
func ByDmgEnemy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDmgEnemy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDmgTeam orders the results by the dmg_team field.
|
||||
func ByDmgTeam(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDmgTeam, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdHe orders the results by the ud_he field.
|
||||
func ByUdHe(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdHe, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdFlames orders the results by the ud_flames field.
|
||||
func ByUdFlames(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdFlames, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdFlash orders the results by the ud_flash field.
|
||||
func ByUdFlash(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdFlash, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdDecoy orders the results by the ud_decoy field.
|
||||
func ByUdDecoy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdDecoy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdSmoke orders the results by the ud_smoke field.
|
||||
func ByUdSmoke(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdSmoke, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCrosshair orders the results by the crosshair field.
|
||||
func ByCrosshair(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCrosshair, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByColor orders the results by the color field.
|
||||
func ByColor(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldColor, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByKast orders the results by the kast field.
|
||||
func ByKast(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldKast, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashDurationSelf orders the results by the flash_duration_self field.
|
||||
func ByFlashDurationSelf(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashDurationSelf, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashDurationTeam orders the results by the flash_duration_team field.
|
||||
func ByFlashDurationTeam(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashDurationTeam, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashDurationEnemy orders the results by the flash_duration_enemy field.
|
||||
func ByFlashDurationEnemy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashDurationEnemy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashTotalSelf orders the results by the flash_total_self field.
|
||||
func ByFlashTotalSelf(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashTotalSelf, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashTotalTeam orders the results by the flash_total_team field.
|
||||
func ByFlashTotalTeam(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashTotalTeam, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashTotalEnemy orders the results by the flash_total_enemy field.
|
||||
func ByFlashTotalEnemy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashTotalEnemy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchStats orders the results by the match_stats field.
|
||||
func ByMatchStats(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMatchStats, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPlayerStats orders the results by the player_stats field.
|
||||
func ByPlayerStats(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPlayerStats, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashAssists orders the results by the flash_assists field.
|
||||
func ByFlashAssists(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashAssists, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAvgPing orders the results by the avg_ping field.
|
||||
func ByAvgPing(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAvgPing, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchesField orders the results by matches field.
|
||||
func ByMatchesField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchesStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
|
||||
// ByPlayersField orders the results by players field.
|
||||
func ByPlayersField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newPlayersStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
|
||||
// ByWeaponStatsCount orders the results by weapon_stats count.
|
||||
func ByWeaponStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newWeaponStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByWeaponStats orders the results by weapon_stats terms.
|
||||
func ByWeaponStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newWeaponStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByRoundStatsCount orders the results by round_stats count.
|
||||
func ByRoundStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newRoundStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByRoundStats orders the results by round_stats terms.
|
||||
func ByRoundStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newRoundStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// BySprayCount orders the results by spray count.
|
||||
func BySprayCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newSprayStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// BySpray orders the results by spray terms.
|
||||
func BySpray(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newSprayStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMessagesCount orders the results by messages count.
|
||||
func ByMessagesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newMessagesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMessages orders the results by messages terms.
|
||||
func ByMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newMatchesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchesTable, MatchesColumn),
|
||||
)
|
||||
}
|
||||
func newPlayersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, PlayersTable, PlayersColumn),
|
||||
)
|
||||
}
|
||||
func newWeaponStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(WeaponStatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, WeaponStatsTable, WeaponStatsColumn),
|
||||
)
|
||||
}
|
||||
func newRoundStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(RoundStatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, RoundStatsTable, RoundStatsColumn),
|
||||
)
|
||||
}
|
||||
func newSprayStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(SprayInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, SprayTable, SprayColumn),
|
||||
)
|
||||
}
|
||||
func newMessagesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MessagesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, MessagesTable, MessagesColumn),
|
||||
)
|
||||
}
|
||||
|
@@ -1772,11 +1772,7 @@ func HasMatches() predicate.MatchPlayer {
|
||||
// HasMatchesWith applies the HasEdge predicate on the "matches" edge with a given conditions (other predicates).
|
||||
func HasMatchesWith(preds ...predicate.Match) predicate.MatchPlayer {
|
||||
return predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchesTable, MatchesColumn),
|
||||
)
|
||||
step := newMatchesStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -1799,11 +1795,7 @@ func HasPlayers() predicate.MatchPlayer {
|
||||
// HasPlayersWith applies the HasEdge predicate on the "players" edge with a given conditions (other predicates).
|
||||
func HasPlayersWith(preds ...predicate.Player) predicate.MatchPlayer {
|
||||
return predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, PlayersTable, PlayersColumn),
|
||||
)
|
||||
step := newPlayersStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -1826,11 +1818,7 @@ func HasWeaponStats() predicate.MatchPlayer {
|
||||
// HasWeaponStatsWith applies the HasEdge predicate on the "weapon_stats" edge with a given conditions (other predicates).
|
||||
func HasWeaponStatsWith(preds ...predicate.Weapon) predicate.MatchPlayer {
|
||||
return predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(WeaponStatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, WeaponStatsTable, WeaponStatsColumn),
|
||||
)
|
||||
step := newWeaponStatsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -1853,11 +1841,7 @@ func HasRoundStats() predicate.MatchPlayer {
|
||||
// HasRoundStatsWith applies the HasEdge predicate on the "round_stats" edge with a given conditions (other predicates).
|
||||
func HasRoundStatsWith(preds ...predicate.RoundStats) predicate.MatchPlayer {
|
||||
return predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(RoundStatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, RoundStatsTable, RoundStatsColumn),
|
||||
)
|
||||
step := newRoundStatsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -1880,11 +1864,7 @@ func HasSpray() predicate.MatchPlayer {
|
||||
// HasSprayWith applies the HasEdge predicate on the "spray" edge with a given conditions (other predicates).
|
||||
func HasSprayWith(preds ...predicate.Spray) predicate.MatchPlayer {
|
||||
return predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(SprayInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, SprayTable, SprayColumn),
|
||||
)
|
||||
step := newSprayStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -1907,11 +1887,7 @@ func HasMessages() predicate.MatchPlayer {
|
||||
// HasMessagesWith applies the HasEdge predicate on the "messages" edge with a given conditions (other predicates).
|
||||
func HasMessagesWith(preds ...predicate.Messages) predicate.MatchPlayer {
|
||||
return predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MessagesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, MessagesTable, MessagesColumn),
|
||||
)
|
||||
step := newMessagesStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@@ -536,7 +536,7 @@ func (mpc *MatchPlayerCreate) Mutation() *MatchPlayerMutation {
|
||||
|
||||
// Save creates the MatchPlayer in the database.
|
||||
func (mpc *MatchPlayerCreate) Save(ctx context.Context) (*MatchPlayer, error) {
|
||||
return withHooks[*MatchPlayer, MatchPlayerMutation](ctx, mpc.sqlSave, mpc.mutation, mpc.hooks)
|
||||
return withHooks(ctx, mpc.sqlSave, mpc.mutation, mpc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -747,10 +747,7 @@ func (mpc *MatchPlayerCreate) createSpec() (*MatchPlayer, *sqlgraph.CreateSpec)
|
||||
Columns: []string{matchplayer.MatchesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -767,10 +764,7 @@ func (mpc *MatchPlayerCreate) createSpec() (*MatchPlayer, *sqlgraph.CreateSpec)
|
||||
Columns: []string{matchplayer.PlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -787,10 +781,7 @@ func (mpc *MatchPlayerCreate) createSpec() (*MatchPlayer, *sqlgraph.CreateSpec)
|
||||
Columns: []string{matchplayer.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -806,10 +797,7 @@ func (mpc *MatchPlayerCreate) createSpec() (*MatchPlayer, *sqlgraph.CreateSpec)
|
||||
Columns: []string{matchplayer.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -825,10 +813,7 @@ func (mpc *MatchPlayerCreate) createSpec() (*MatchPlayer, *sqlgraph.CreateSpec)
|
||||
Columns: []string{matchplayer.SprayColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -844,10 +829,7 @@ func (mpc *MatchPlayerCreate) createSpec() (*MatchPlayer, *sqlgraph.CreateSpec)
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -881,8 +863,8 @@ func (mpcb *MatchPlayerCreateBulk) Save(ctx context.Context) ([]*MatchPlayer, er
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, mpcb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@@ -27,7 +27,7 @@ func (mpd *MatchPlayerDelete) Where(ps ...predicate.MatchPlayer) *MatchPlayerDel
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (mpd *MatchPlayerDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks[int, MatchPlayerMutation](ctx, mpd.sqlExec, mpd.mutation, mpd.hooks)
|
||||
return withHooks(ctx, mpd.sqlExec, mpd.mutation, mpd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
@@ -25,7 +25,7 @@ import (
|
||||
type MatchPlayerQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []matchplayer.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.MatchPlayer
|
||||
withMatches *MatchQuery
|
||||
@@ -66,7 +66,7 @@ func (mpq *MatchPlayerQuery) Unique(unique bool) *MatchPlayerQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (mpq *MatchPlayerQuery) Order(o ...OrderFunc) *MatchPlayerQuery {
|
||||
func (mpq *MatchPlayerQuery) Order(o ...matchplayer.OrderOption) *MatchPlayerQuery {
|
||||
mpq.order = append(mpq.order, o...)
|
||||
return mpq
|
||||
}
|
||||
@@ -392,7 +392,7 @@ func (mpq *MatchPlayerQuery) Clone() *MatchPlayerQuery {
|
||||
return &MatchPlayerQuery{
|
||||
config: mpq.config,
|
||||
ctx: mpq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, mpq.order...),
|
||||
order: append([]matchplayer.OrderOption{}, mpq.order...),
|
||||
inters: append([]Interceptor{}, mpq.inters...),
|
||||
predicates: append([]predicate.MatchPlayer{}, mpq.predicates...),
|
||||
withMatches: mpq.withMatches.Clone(),
|
||||
@@ -694,7 +694,7 @@ func (mpq *MatchPlayerQuery) loadWeaponStats(ctx context.Context, query *WeaponQ
|
||||
}
|
||||
query.withFKs = true
|
||||
query.Where(predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(matchplayer.WeaponStatsColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(matchplayer.WeaponStatsColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@@ -707,7 +707,7 @@ func (mpq *MatchPlayerQuery) loadWeaponStats(ctx context.Context, query *WeaponQ
|
||||
}
|
||||
node, ok := nodeids[*fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "match_player_weapon_stats" returned %v for node %v`, *fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "match_player_weapon_stats" returned %v for node %v`, *fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
@@ -725,7 +725,7 @@ func (mpq *MatchPlayerQuery) loadRoundStats(ctx context.Context, query *RoundSta
|
||||
}
|
||||
query.withFKs = true
|
||||
query.Where(predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(matchplayer.RoundStatsColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(matchplayer.RoundStatsColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@@ -738,7 +738,7 @@ func (mpq *MatchPlayerQuery) loadRoundStats(ctx context.Context, query *RoundSta
|
||||
}
|
||||
node, ok := nodeids[*fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "match_player_round_stats" returned %v for node %v`, *fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "match_player_round_stats" returned %v for node %v`, *fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
@@ -756,7 +756,7 @@ func (mpq *MatchPlayerQuery) loadSpray(ctx context.Context, query *SprayQuery, n
|
||||
}
|
||||
query.withFKs = true
|
||||
query.Where(predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(matchplayer.SprayColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(matchplayer.SprayColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@@ -769,7 +769,7 @@ func (mpq *MatchPlayerQuery) loadSpray(ctx context.Context, query *SprayQuery, n
|
||||
}
|
||||
node, ok := nodeids[*fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "match_player_spray" returned %v for node %v`, *fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "match_player_spray" returned %v for node %v`, *fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
@@ -787,7 +787,7 @@ func (mpq *MatchPlayerQuery) loadMessages(ctx context.Context, query *MessagesQu
|
||||
}
|
||||
query.withFKs = true
|
||||
query.Where(predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(matchplayer.MessagesColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(matchplayer.MessagesColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@@ -800,7 +800,7 @@ func (mpq *MatchPlayerQuery) loadMessages(ctx context.Context, query *MessagesQu
|
||||
}
|
||||
node, ok := nodeids[*fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "match_player_messages" returned %v for node %v`, *fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "match_player_messages" returned %v for node %v`, *fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
@@ -835,6 +835,12 @@ func (mpq *MatchPlayerQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
if mpq.withMatches != nil {
|
||||
_spec.Node.AddColumnOnce(matchplayer.FieldMatchStats)
|
||||
}
|
||||
if mpq.withPlayers != nil {
|
||||
_spec.Node.AddColumnOnce(matchplayer.FieldPlayerStats)
|
||||
}
|
||||
}
|
||||
if ps := mpq.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
|
@@ -1000,7 +1000,7 @@ func (mpu *MatchPlayerUpdate) RemoveMessages(m ...*Messages) *MatchPlayerUpdate
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (mpu *MatchPlayerUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks[int, MatchPlayerMutation](ctx, mpu.sqlSave, mpu.mutation, mpu.hooks)
|
||||
return withHooks(ctx, mpu.sqlSave, mpu.mutation, mpu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -1313,10 +1313,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.MatchesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1329,10 +1326,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.MatchesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1348,10 +1342,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.PlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1364,10 +1355,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.PlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1383,10 +1371,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1399,10 +1384,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1418,10 +1400,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1437,10 +1416,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1453,10 +1429,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1472,10 +1445,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1491,10 +1461,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.SprayColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1507,10 +1474,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.SprayColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1526,10 +1490,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.SprayColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1545,10 +1506,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1561,10 +1519,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1580,10 +1535,7 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -2592,7 +2544,7 @@ func (mpuo *MatchPlayerUpdateOne) Select(field string, fields ...string) *MatchP
|
||||
|
||||
// Save executes the query and returns the updated MatchPlayer entity.
|
||||
func (mpuo *MatchPlayerUpdateOne) Save(ctx context.Context) (*MatchPlayer, error) {
|
||||
return withHooks[*MatchPlayer, MatchPlayerMutation](ctx, mpuo.sqlSave, mpuo.mutation, mpuo.hooks)
|
||||
return withHooks(ctx, mpuo.sqlSave, mpuo.mutation, mpuo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -2922,10 +2874,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.MatchesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -2938,10 +2887,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.MatchesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -2957,10 +2903,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.PlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -2973,10 +2916,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.PlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -2992,10 +2932,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -3008,10 +2945,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -3027,10 +2961,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.WeaponStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -3046,10 +2977,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -3062,10 +2990,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -3081,10 +3006,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.RoundStatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -3100,10 +3022,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.SprayColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -3116,10 +3035,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.SprayColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -3135,10 +3051,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.SprayColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -3154,10 +3067,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -3170,10 +3080,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -3189,10 +3096,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay
|
||||
Columns: []string{matchplayer.MessagesColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/messages"
|
||||
@@ -26,6 +27,7 @@ type Messages struct {
|
||||
// The values are being populated by the MessagesQuery when eager-loading is set.
|
||||
Edges MessagesEdges `json:"edges"`
|
||||
match_player_messages *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// MessagesEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -64,7 +66,7 @@ func (*Messages) scanValues(columns []string) ([]any, error) {
|
||||
case messages.ForeignKeys[0]: // match_player_messages
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Messages", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -109,11 +111,19 @@ func (m *Messages) assignValues(columns []string, values []any) error {
|
||||
m.match_player_messages = new(int)
|
||||
*m.match_player_messages = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Messages.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (m *Messages) Value(name string) (ent.Value, error) {
|
||||
return m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatchPlayer queries the "match_player" edge of the Messages entity.
|
||||
func (m *Messages) QueryMatchPlayer() *MatchPlayerQuery {
|
||||
return NewMessagesClient(m.config).QueryMatchPlayer(m)
|
||||
|
@@ -2,6 +2,11 @@
|
||||
|
||||
package messages
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the messages type in the database.
|
||||
Label = "messages"
|
||||
@@ -54,3 +59,40 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Messages queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMessage orders the results by the message field.
|
||||
func ByMessage(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMessage, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAllChat orders the results by the all_chat field.
|
||||
func ByAllChat(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAllChat, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTick orders the results by the tick field.
|
||||
func ByTick(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTick, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchPlayerField orders the results by match_player field.
|
||||
func ByMatchPlayerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchPlayerStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newMatchPlayerStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
}
|
||||
|
@@ -197,11 +197,7 @@ func HasMatchPlayer() predicate.Messages {
|
||||
// HasMatchPlayerWith applies the HasEdge predicate on the "match_player" edge with a given conditions (other predicates).
|
||||
func HasMatchPlayerWith(preds ...predicate.MatchPlayer) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
step := newMatchPlayerStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@@ -64,7 +64,7 @@ func (mc *MessagesCreate) Mutation() *MessagesMutation {
|
||||
|
||||
// Save creates the Messages in the database.
|
||||
func (mc *MessagesCreate) Save(ctx context.Context) (*Messages, error) {
|
||||
return withHooks[*Messages, MessagesMutation](ctx, mc.sqlSave, mc.mutation, mc.hooks)
|
||||
return withHooks(ctx, mc.sqlSave, mc.mutation, mc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -146,10 +146,7 @@ func (mc *MessagesCreate) createSpec() (*Messages, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -184,8 +181,8 @@ func (mcb *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, mcb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@@ -27,7 +27,7 @@ func (md *MessagesDelete) Where(ps ...predicate.Messages) *MessagesDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (md *MessagesDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks[int, MessagesMutation](ctx, md.sqlExec, md.mutation, md.hooks)
|
||||
return withHooks(ctx, md.sqlExec, md.mutation, md.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
@@ -19,7 +19,7 @@ import (
|
||||
type MessagesQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []messages.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Messages
|
||||
withMatchPlayer *MatchPlayerQuery
|
||||
@@ -56,7 +56,7 @@ func (mq *MessagesQuery) Unique(unique bool) *MessagesQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (mq *MessagesQuery) Order(o ...OrderFunc) *MessagesQuery {
|
||||
func (mq *MessagesQuery) Order(o ...messages.OrderOption) *MessagesQuery {
|
||||
mq.order = append(mq.order, o...)
|
||||
return mq
|
||||
}
|
||||
@@ -272,7 +272,7 @@ func (mq *MessagesQuery) Clone() *MessagesQuery {
|
||||
return &MessagesQuery{
|
||||
config: mq.config,
|
||||
ctx: mq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, mq.order...),
|
||||
order: append([]messages.OrderOption{}, mq.order...),
|
||||
inters: append([]Interceptor{}, mq.inters...),
|
||||
predicates: append([]predicate.Messages{}, mq.predicates...),
|
||||
withMatchPlayer: mq.withMatchPlayer.Clone(),
|
||||
|
@@ -86,7 +86,7 @@ func (mu *MessagesUpdate) ClearMatchPlayer() *MessagesUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (mu *MessagesUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks[int, MessagesMutation](ctx, mu.sqlSave, mu.mutation, mu.hooks)
|
||||
return withHooks(ctx, mu.sqlSave, mu.mutation, mu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -146,10 +146,7 @@ func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -162,10 +159,7 @@ func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -265,7 +259,7 @@ func (muo *MessagesUpdateOne) Select(field string, fields ...string) *MessagesUp
|
||||
|
||||
// Save executes the query and returns the updated Messages entity.
|
||||
func (muo *MessagesUpdateOne) Save(ctx context.Context) (*Messages, error) {
|
||||
return withHooks[*Messages, MessagesMutation](ctx, muo.sqlSave, muo.mutation, muo.hooks)
|
||||
return withHooks(ctx, muo.sqlSave, muo.mutation, muo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -342,10 +336,7 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -358,10 +349,7 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
|
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
)
|
||||
@@ -50,7 +51,8 @@ type Player struct {
|
||||
Ties int `json:"ties,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the PlayerQuery when eager-loading is set.
|
||||
Edges PlayerEdges `json:"edges"`
|
||||
Edges PlayerEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// PlayerEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -94,7 +96,7 @@ func (*Player) scanValues(columns []string) ([]any, error) {
|
||||
case player.FieldVacDate, player.FieldGameBanDate, player.FieldSteamUpdated, player.FieldSharecodeUpdated, player.FieldProfileCreated:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Player", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -210,11 +212,19 @@ func (pl *Player) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
pl.Ties = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
pl.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Player.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (pl *Player) Value(name string) (ent.Value, error) {
|
||||
return pl.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryStats queries the "stats" edge of the Player entity.
|
||||
func (pl *Player) QueryStats() *MatchPlayerQuery {
|
||||
return NewPlayerClient(pl.config).QueryStats(pl)
|
||||
|
@@ -4,6 +4,9 @@ package player
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -104,3 +107,133 @@ var (
|
||||
// DefaultSteamUpdated holds the default value on creation for the "steam_updated" field.
|
||||
DefaultSteamUpdated func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Player queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByName orders the results by the name field.
|
||||
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAvatar orders the results by the avatar field.
|
||||
func ByAvatar(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAvatar, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVanityURL orders the results by the vanity_url field.
|
||||
func ByVanityURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVanityURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVanityURLReal orders the results by the vanity_url_real field.
|
||||
func ByVanityURLReal(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVanityURLReal, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVacDate orders the results by the vac_date field.
|
||||
func ByVacDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVacDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVacCount orders the results by the vac_count field.
|
||||
func ByVacCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVacCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameBanDate orders the results by the game_ban_date field.
|
||||
func ByGameBanDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameBanDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameBanCount orders the results by the game_ban_count field.
|
||||
func ByGameBanCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameBanCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySteamUpdated orders the results by the steam_updated field.
|
||||
func BySteamUpdated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSteamUpdated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySharecodeUpdated orders the results by the sharecode_updated field.
|
||||
func BySharecodeUpdated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSharecodeUpdated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAuthCode orders the results by the auth_code field.
|
||||
func ByAuthCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAuthCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByProfileCreated orders the results by the profile_created field.
|
||||
func ByProfileCreated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldProfileCreated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByOldestSharecodeSeen orders the results by the oldest_sharecode_seen field.
|
||||
func ByOldestSharecodeSeen(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldOldestSharecodeSeen, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByWins orders the results by the wins field.
|
||||
func ByWins(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldWins, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLooses orders the results by the looses field.
|
||||
func ByLooses(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLooses, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTies orders the results by the ties field.
|
||||
func ByTies(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTies, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatsCount orders the results by stats count.
|
||||
func ByStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByStats orders the results by stats terms.
|
||||
func ByStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMatchesCount orders the results by matches count.
|
||||
func ByMatchesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newMatchesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMatches orders the results by matches terms.
|
||||
func ByMatches(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, StatsTable, StatsColumn),
|
||||
)
|
||||
}
|
||||
func newMatchesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, MatchesTable, MatchesPrimaryKey...),
|
||||
)
|
||||
}
|
||||
|
@@ -1089,11 +1089,7 @@ func HasStats() predicate.Player {
|
||||
// HasStatsWith applies the HasEdge predicate on the "stats" edge with a given conditions (other predicates).
|
||||
func HasStatsWith(preds ...predicate.MatchPlayer) predicate.Player {
|
||||
return predicate.Player(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, StatsTable, StatsColumn),
|
||||
)
|
||||
step := newStatsStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -1116,11 +1112,7 @@ func HasMatches() predicate.Player {
|
||||
// HasMatchesWith applies the HasEdge predicate on the "matches" edge with a given conditions (other predicates).
|
||||
func HasMatchesWith(preds ...predicate.Match) predicate.Player {
|
||||
return predicate.Player(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, MatchesTable, MatchesPrimaryKey...),
|
||||
)
|
||||
step := newMatchesStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@@ -290,7 +290,7 @@ func (pc *PlayerCreate) Mutation() *PlayerMutation {
|
||||
// Save creates the Player in the database.
|
||||
func (pc *PlayerCreate) Save(ctx context.Context) (*Player, error) {
|
||||
pc.defaults()
|
||||
return withHooks[*Player, PlayerMutation](ctx, pc.sqlSave, pc.mutation, pc.hooks)
|
||||
return withHooks(ctx, pc.sqlSave, pc.mutation, pc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -432,10 +432,7 @@ func (pc *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -451,10 +448,7 @@ func (pc *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -489,8 +483,8 @@ func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, pcb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@@ -27,7 +27,7 @@ func (pd *PlayerDelete) Where(ps ...predicate.Player) *PlayerDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (pd *PlayerDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks[int, PlayerMutation](ctx, pd.sqlExec, pd.mutation, pd.hooks)
|
||||
return withHooks(ctx, pd.sqlExec, pd.mutation, pd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
@@ -21,7 +21,7 @@ import (
|
||||
type PlayerQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []player.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Player
|
||||
withStats *MatchPlayerQuery
|
||||
@@ -58,7 +58,7 @@ func (pq *PlayerQuery) Unique(unique bool) *PlayerQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (pq *PlayerQuery) Order(o ...OrderFunc) *PlayerQuery {
|
||||
func (pq *PlayerQuery) Order(o ...player.OrderOption) *PlayerQuery {
|
||||
pq.order = append(pq.order, o...)
|
||||
return pq
|
||||
}
|
||||
@@ -296,7 +296,7 @@ func (pq *PlayerQuery) Clone() *PlayerQuery {
|
||||
return &PlayerQuery{
|
||||
config: pq.config,
|
||||
ctx: pq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, pq.order...),
|
||||
order: append([]player.OrderOption{}, pq.order...),
|
||||
inters: append([]Interceptor{}, pq.inters...),
|
||||
predicates: append([]predicate.Player{}, pq.predicates...),
|
||||
withStats: pq.withStats.Clone(),
|
||||
@@ -460,8 +460,11 @@ func (pq *PlayerQuery) loadStats(ctx context.Context, query *MatchPlayerQuery, n
|
||||
init(nodes[i])
|
||||
}
|
||||
}
|
||||
if len(query.ctx.Fields) > 0 {
|
||||
query.ctx.AppendFieldOnce(matchplayer.FieldPlayerStats)
|
||||
}
|
||||
query.Where(predicate.MatchPlayer(func(s *sql.Selector) {
|
||||
s.Where(sql.InValues(player.StatsColumn, fks...))
|
||||
s.Where(sql.InValues(s.C(player.StatsColumn), fks...))
|
||||
}))
|
||||
neighbors, err := query.All(ctx)
|
||||
if err != nil {
|
||||
@@ -471,7 +474,7 @@ func (pq *PlayerQuery) loadStats(ctx context.Context, query *MatchPlayerQuery, n
|
||||
fk := n.PlayerStats
|
||||
node, ok := nodeids[fk]
|
||||
if !ok {
|
||||
return fmt.Errorf(`unexpected foreign-key "player_stats" returned %v for node %v`, fk, n.ID)
|
||||
return fmt.Errorf(`unexpected referenced foreign-key "player_stats" returned %v for node %v`, fk, n.ID)
|
||||
}
|
||||
assign(node, n)
|
||||
}
|
||||
|
@@ -459,7 +459,7 @@ func (pu *PlayerUpdate) RemoveMatches(m ...*Match) *PlayerUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (pu *PlayerUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks[int, PlayerMutation](ctx, pu.sqlSave, pu.mutation, pu.hooks)
|
||||
return withHooks(ctx, pu.sqlSave, pu.mutation, pu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -615,10 +615,7 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -631,10 +628,7 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -650,10 +644,7 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -669,10 +660,7 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -685,10 +673,7 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -704,10 +689,7 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1178,7 +1160,7 @@ func (puo *PlayerUpdateOne) Select(field string, fields ...string) *PlayerUpdate
|
||||
|
||||
// Save executes the query and returns the updated Player entity.
|
||||
func (puo *PlayerUpdateOne) Save(ctx context.Context) (*Player, error) {
|
||||
return withHooks[*Player, PlayerMutation](ctx, puo.sqlSave, puo.mutation, puo.hooks)
|
||||
return withHooks(ctx, puo.sqlSave, puo.mutation, puo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -1351,10 +1333,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1367,10 +1346,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1386,10 +1362,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1405,10 +1378,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -1421,10 +1391,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -1440,10 +1407,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
@@ -28,6 +29,7 @@ type RoundStats struct {
|
||||
// The values are being populated by the RoundStatsQuery when eager-loading is set.
|
||||
Edges RoundStatsEdges `json:"edges"`
|
||||
match_player_round_stats *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// RoundStatsEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -62,7 +64,7 @@ func (*RoundStats) scanValues(columns []string) ([]any, error) {
|
||||
case roundstats.ForeignKeys[0]: // match_player_round_stats
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type RoundStats", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -113,11 +115,19 @@ func (rs *RoundStats) assignValues(columns []string, values []any) error {
|
||||
rs.match_player_round_stats = new(int)
|
||||
*rs.match_player_round_stats = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
rs.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the RoundStats.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (rs *RoundStats) Value(name string) (ent.Value, error) {
|
||||
return rs.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatchPlayer queries the "match_player" edge of the RoundStats entity.
|
||||
func (rs *RoundStats) QueryMatchPlayer() *MatchPlayerQuery {
|
||||
return NewRoundStatsClient(rs.config).QueryMatchPlayer(rs)
|
||||
|
@@ -2,6 +2,11 @@
|
||||
|
||||
package roundstats
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the roundstats type in the database.
|
||||
Label = "round_stats"
|
||||
@@ -57,3 +62,45 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the RoundStats queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRound orders the results by the round field.
|
||||
func ByRound(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRound, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBank orders the results by the bank field.
|
||||
func ByBank(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBank, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEquipment orders the results by the equipment field.
|
||||
func ByEquipment(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEquipment, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySpent orders the results by the spent field.
|
||||
func BySpent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSpent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchPlayerField orders the results by match_player field.
|
||||
func ByMatchPlayerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchPlayerStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newMatchPlayerStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
}
|
||||
|
@@ -247,11 +247,7 @@ func HasMatchPlayer() predicate.RoundStats {
|
||||
// HasMatchPlayerWith applies the HasEdge predicate on the "match_player" edge with a given conditions (other predicates).
|
||||
func HasMatchPlayerWith(preds ...predicate.MatchPlayer) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
step := newMatchPlayerStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@@ -70,7 +70,7 @@ func (rsc *RoundStatsCreate) Mutation() *RoundStatsMutation {
|
||||
|
||||
// Save creates the RoundStats in the database.
|
||||
func (rsc *RoundStatsCreate) Save(ctx context.Context) (*RoundStats, error) {
|
||||
return withHooks[*RoundStats, RoundStatsMutation](ctx, rsc.sqlSave, rsc.mutation, rsc.hooks)
|
||||
return withHooks(ctx, rsc.sqlSave, rsc.mutation, rsc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -159,10 +159,7 @@ func (rsc *RoundStatsCreate) createSpec() (*RoundStats, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -197,8 +194,8 @@ func (rscb *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, erro
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, rscb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@@ -27,7 +27,7 @@ func (rsd *RoundStatsDelete) Where(ps ...predicate.RoundStats) *RoundStatsDelete
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (rsd *RoundStatsDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks[int, RoundStatsMutation](ctx, rsd.sqlExec, rsd.mutation, rsd.hooks)
|
||||
return withHooks(ctx, rsd.sqlExec, rsd.mutation, rsd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
@@ -19,7 +19,7 @@ import (
|
||||
type RoundStatsQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []roundstats.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.RoundStats
|
||||
withMatchPlayer *MatchPlayerQuery
|
||||
@@ -56,7 +56,7 @@ func (rsq *RoundStatsQuery) Unique(unique bool) *RoundStatsQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (rsq *RoundStatsQuery) Order(o ...OrderFunc) *RoundStatsQuery {
|
||||
func (rsq *RoundStatsQuery) Order(o ...roundstats.OrderOption) *RoundStatsQuery {
|
||||
rsq.order = append(rsq.order, o...)
|
||||
return rsq
|
||||
}
|
||||
@@ -272,7 +272,7 @@ func (rsq *RoundStatsQuery) Clone() *RoundStatsQuery {
|
||||
return &RoundStatsQuery{
|
||||
config: rsq.config,
|
||||
ctx: rsq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, rsq.order...),
|
||||
order: append([]roundstats.OrderOption{}, rsq.order...),
|
||||
inters: append([]Interceptor{}, rsq.inters...),
|
||||
predicates: append([]predicate.RoundStats{}, rsq.predicates...),
|
||||
withMatchPlayer: rsq.withMatchPlayer.Clone(),
|
||||
|
@@ -113,7 +113,7 @@ func (rsu *RoundStatsUpdate) ClearMatchPlayer() *RoundStatsUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (rsu *RoundStatsUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks[int, RoundStatsMutation](ctx, rsu.sqlSave, rsu.mutation, rsu.hooks)
|
||||
return withHooks(ctx, rsu.sqlSave, rsu.mutation, rsu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -185,10 +185,7 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -201,10 +198,7 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -331,7 +325,7 @@ func (rsuo *RoundStatsUpdateOne) Select(field string, fields ...string) *RoundSt
|
||||
|
||||
// Save executes the query and returns the updated RoundStats entity.
|
||||
func (rsuo *RoundStatsUpdateOne) Save(ctx context.Context) (*RoundStats, error) {
|
||||
return withHooks[*RoundStats, RoundStatsMutation](ctx, rsuo.sqlSave, rsuo.mutation, rsuo.hooks)
|
||||
return withHooks(ctx, rsuo.sqlSave, rsuo.mutation, rsuo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -420,10 +414,7 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -436,10 +427,7 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
|
@@ -5,6 +5,6 @@ package runtime
|
||||
// The schema-stitching logic is generated in somegit.dev/csgowtf/csgowtfd/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.11.9" // Version of ent codegen.
|
||||
Sum = "h1:dbbCkAiPVTRBIJwoZctiSYjB7zxQIBOzVSU5H9VYIQI=" // Sum of ent codegen.
|
||||
Version = "v0.12.3" // Version of ent codegen.
|
||||
Sum = "h1:N5lO2EOrHpCH5HYfiMOCHYbo+oh5M8GjT0/cx5x6xkk=" // Sum of ent codegen.
|
||||
)
|
||||
|
12
ent/spray.go
12
ent/spray.go
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
@@ -24,6 +25,7 @@ type Spray struct {
|
||||
// The values are being populated by the SprayQuery when eager-loading is set.
|
||||
Edges SprayEdges `json:"edges"`
|
||||
match_player_spray *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// SprayEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -60,7 +62,7 @@ func (*Spray) scanValues(columns []string) ([]any, error) {
|
||||
case spray.ForeignKeys[0]: // match_player_spray
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Spray", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -99,11 +101,19 @@ func (s *Spray) assignValues(columns []string, values []any) error {
|
||||
s.match_player_spray = new(int)
|
||||
*s.match_player_spray = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
s.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Spray.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (s *Spray) Value(name string) (ent.Value, error) {
|
||||
return s.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatchPlayers queries the "match_players" edge of the Spray entity.
|
||||
func (s *Spray) QueryMatchPlayers() *MatchPlayerQuery {
|
||||
return NewSprayClient(s.config).QueryMatchPlayers(s)
|
||||
|
@@ -2,6 +2,11 @@
|
||||
|
||||
package spray
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the spray type in the database.
|
||||
Label = "spray"
|
||||
@@ -51,3 +56,30 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Spray queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByWeapon orders the results by the weapon field.
|
||||
func ByWeapon(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldWeapon, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchPlayersField orders the results by match_players field.
|
||||
func ByMatchPlayersField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchPlayersStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newMatchPlayersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayersTable, MatchPlayersColumn),
|
||||
)
|
||||
}
|
||||
|
@@ -157,11 +157,7 @@ func HasMatchPlayers() predicate.Spray {
|
||||
// HasMatchPlayersWith applies the HasEdge predicate on the "match_players" edge with a given conditions (other predicates).
|
||||
func HasMatchPlayersWith(preds ...predicate.MatchPlayer) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayersTable, MatchPlayersColumn),
|
||||
)
|
||||
step := newMatchPlayersStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@@ -58,7 +58,7 @@ func (sc *SprayCreate) Mutation() *SprayMutation {
|
||||
|
||||
// Save creates the Spray in the database.
|
||||
func (sc *SprayCreate) Save(ctx context.Context) (*Spray, error) {
|
||||
return withHooks[*Spray, SprayMutation](ctx, sc.sqlSave, sc.mutation, sc.hooks)
|
||||
return withHooks(ctx, sc.sqlSave, sc.mutation, sc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -133,10 +133,7 @@ func (sc *SprayCreate) createSpec() (*Spray, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -171,8 +168,8 @@ func (scb *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, scb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@@ -27,7 +27,7 @@ func (sd *SprayDelete) Where(ps ...predicate.Spray) *SprayDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (sd *SprayDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks[int, SprayMutation](ctx, sd.sqlExec, sd.mutation, sd.hooks)
|
||||
return withHooks(ctx, sd.sqlExec, sd.mutation, sd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
@@ -19,7 +19,7 @@ import (
|
||||
type SprayQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []spray.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Spray
|
||||
withMatchPlayers *MatchPlayerQuery
|
||||
@@ -56,7 +56,7 @@ func (sq *SprayQuery) Unique(unique bool) *SprayQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (sq *SprayQuery) Order(o ...OrderFunc) *SprayQuery {
|
||||
func (sq *SprayQuery) Order(o ...spray.OrderOption) *SprayQuery {
|
||||
sq.order = append(sq.order, o...)
|
||||
return sq
|
||||
}
|
||||
@@ -272,7 +272,7 @@ func (sq *SprayQuery) Clone() *SprayQuery {
|
||||
return &SprayQuery{
|
||||
config: sq.config,
|
||||
ctx: sq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, sq.order...),
|
||||
order: append([]spray.OrderOption{}, sq.order...),
|
||||
inters: append([]Interceptor{}, sq.inters...),
|
||||
predicates: append([]predicate.Spray{}, sq.predicates...),
|
||||
withMatchPlayers: sq.withMatchPlayers.Clone(),
|
||||
|
@@ -80,7 +80,7 @@ func (su *SprayUpdate) ClearMatchPlayers() *SprayUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (su *SprayUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks[int, SprayMutation](ctx, su.sqlSave, su.mutation, su.hooks)
|
||||
return withHooks(ctx, su.sqlSave, su.mutation, su.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -137,10 +137,7 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -153,10 +150,7 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -250,7 +244,7 @@ func (suo *SprayUpdateOne) Select(field string, fields ...string) *SprayUpdateOn
|
||||
|
||||
// Save executes the query and returns the updated Spray entity.
|
||||
func (suo *SprayUpdateOne) Save(ctx context.Context) (*Spray, error) {
|
||||
return withHooks[*Spray, SprayMutation](ctx, suo.sqlSave, suo.mutation, suo.hooks)
|
||||
return withHooks(ctx, suo.sqlSave, suo.mutation, suo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -324,10 +318,7 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -340,10 +331,7 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
@@ -28,6 +29,7 @@ type Weapon struct {
|
||||
// The values are being populated by the WeaponQuery when eager-loading is set.
|
||||
Edges WeaponEdges `json:"edges"`
|
||||
match_player_weapon_stats *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// WeaponEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -62,7 +64,7 @@ func (*Weapon) scanValues(columns []string) ([]any, error) {
|
||||
case weapon.ForeignKeys[0]: // match_player_weapon_stats
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Weapon", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -113,11 +115,19 @@ func (w *Weapon) assignValues(columns []string, values []any) error {
|
||||
w.match_player_weapon_stats = new(int)
|
||||
*w.match_player_weapon_stats = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
w.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Weapon.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (w *Weapon) Value(name string) (ent.Value, error) {
|
||||
return w.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryStat queries the "stat" edge of the Weapon entity.
|
||||
func (w *Weapon) QueryStat() *MatchPlayerQuery {
|
||||
return NewWeaponClient(w.config).QueryStat(w)
|
||||
|
@@ -2,6 +2,11 @@
|
||||
|
||||
package weapon
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the weapon type in the database.
|
||||
Label = "weapon"
|
||||
@@ -57,3 +62,45 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Weapon queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVictim orders the results by the victim field.
|
||||
func ByVictim(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVictim, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDmg orders the results by the dmg field.
|
||||
func ByDmg(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDmg, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEqType orders the results by the eq_type field.
|
||||
func ByEqType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEqType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHitGroup orders the results by the hit_group field.
|
||||
func ByHitGroup(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHitGroup, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatField orders the results by stat field.
|
||||
func ByStatField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newStatStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newStatStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, StatTable, StatColumn),
|
||||
)
|
||||
}
|
||||
|
@@ -247,11 +247,7 @@ func HasStat() predicate.Weapon {
|
||||
// HasStatWith applies the HasEdge predicate on the "stat" edge with a given conditions (other predicates).
|
||||
func HasStatWith(preds ...predicate.MatchPlayer) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, StatTable, StatColumn),
|
||||
)
|
||||
step := newStatStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
@@ -70,7 +70,7 @@ func (wc *WeaponCreate) Mutation() *WeaponMutation {
|
||||
|
||||
// Save creates the Weapon in the database.
|
||||
func (wc *WeaponCreate) Save(ctx context.Context) (*Weapon, error) {
|
||||
return withHooks[*Weapon, WeaponMutation](ctx, wc.sqlSave, wc.mutation, wc.hooks)
|
||||
return withHooks(ctx, wc.sqlSave, wc.mutation, wc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -159,10 +159,7 @@ func (wc *WeaponCreate) createSpec() (*Weapon, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -197,8 +194,8 @@ func (wcb *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)
|
||||
} else {
|
||||
|
@@ -27,7 +27,7 @@ func (wd *WeaponDelete) Where(ps ...predicate.Weapon) *WeaponDelete {
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (wd *WeaponDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks[int, WeaponMutation](ctx, wd.sqlExec, wd.mutation, wd.hooks)
|
||||
return withHooks(ctx, wd.sqlExec, wd.mutation, wd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
|
@@ -19,7 +19,7 @@ import (
|
||||
type WeaponQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []OrderFunc
|
||||
order []weapon.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.Weapon
|
||||
withStat *MatchPlayerQuery
|
||||
@@ -56,7 +56,7 @@ func (wq *WeaponQuery) Unique(unique bool) *WeaponQuery {
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (wq *WeaponQuery) Order(o ...OrderFunc) *WeaponQuery {
|
||||
func (wq *WeaponQuery) Order(o ...weapon.OrderOption) *WeaponQuery {
|
||||
wq.order = append(wq.order, o...)
|
||||
return wq
|
||||
}
|
||||
@@ -272,7 +272,7 @@ func (wq *WeaponQuery) Clone() *WeaponQuery {
|
||||
return &WeaponQuery{
|
||||
config: wq.config,
|
||||
ctx: wq.ctx.Clone(),
|
||||
order: append([]OrderFunc{}, wq.order...),
|
||||
order: append([]weapon.OrderOption{}, wq.order...),
|
||||
inters: append([]Interceptor{}, wq.inters...),
|
||||
predicates: append([]predicate.Weapon{}, wq.predicates...),
|
||||
withStat: wq.withStat.Clone(),
|
||||
|
@@ -113,7 +113,7 @@ func (wu *WeaponUpdate) ClearStat() *WeaponUpdate {
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (wu *WeaponUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks[int, WeaponMutation](ctx, wu.sqlSave, wu.mutation, wu.hooks)
|
||||
return withHooks(ctx, wu.sqlSave, wu.mutation, wu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -185,10 +185,7 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -201,10 +198,7 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -331,7 +325,7 @@ func (wuo *WeaponUpdateOne) Select(field string, fields ...string) *WeaponUpdate
|
||||
|
||||
// Save executes the query and returns the updated Weapon entity.
|
||||
func (wuo *WeaponUpdateOne) Save(ctx context.Context) (*Weapon, error) {
|
||||
return withHooks[*Weapon, WeaponMutation](ctx, wuo.sqlSave, wuo.mutation, wuo.hooks)
|
||||
return withHooks(ctx, wuo.sqlSave, wuo.mutation, wuo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
@@ -420,10 +414,7 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
@@ -436,10 +427,7 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
|
Reference in New Issue
Block a user