From 657ca32bb3f0af32737285cf24f961d38a2c6f21 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Mon, 15 Aug 2022 12:10:15 +0200 Subject: [PATCH] updated deps; regen ent --- csgo/demo_parser.go | 6 +- ent/client.go | 50 +-- ent/config.go | 2 +- ent/context.go | 2 +- ent/ent.go | 210 ++++++++- ent/enttest/enttest.go | 20 +- ent/hook/hook.go | 6 +- ent/match.go | 49 +- ent/match/match.go | 2 +- ent/match/where.go | 146 +----- ent/match_create.go | 16 +- ent/match_delete.go | 8 +- ent/match_query.go | 625 +++++--------------------- ent/match_update.go | 40 +- ent/matchplayer.go | 109 +++-- ent/matchplayer/matchplayer.go | 2 +- ent/matchplayer/where.go | 398 +---------------- ent/matchplayer_create.go | 16 +- ent/matchplayer_delete.go | 8 +- ent/matchplayer_query.go | 788 +++++++++------------------------ ent/matchplayer_update.go | 40 +- ent/messages.go | 19 +- ent/messages/messages.go | 2 +- ent/messages/where.go | 38 +- ent/messages_create.go | 16 +- ent/messages_delete.go | 8 +- ent/messages_query.go | 508 +++------------------ ent/messages_update.go | 40 +- ent/migrate/migrate.go | 27 +- ent/migrate/schema.go | 2 +- ent/mutation.go | 2 +- ent/player.go | 55 ++- ent/player/player.go | 2 +- ent/player/where.go | 206 +-------- ent/player_create.go | 16 +- ent/player_delete.go | 8 +- ent/player_query.go | 625 +++++--------------------- ent/player_update.go | 40 +- ent/predicate/predicate.go | 2 +- ent/roundstats.go | 22 +- ent/roundstats/roundstats.go | 2 +- ent/roundstats/where.go | 62 +-- ent/roundstats_create.go | 16 +- ent/roundstats_delete.go | 8 +- ent/roundstats_query.go | 508 +++------------------ ent/roundstats_update.go | 40 +- ent/runtime.go | 2 +- ent/runtime/runtime.go | 6 +- ent/spray.go | 16 +- ent/spray/spray.go | 2 +- ent/spray/where.go | 38 +- ent/spray_create.go | 16 +- ent/spray_delete.go | 8 +- ent/spray_query.go | 508 +++------------------ ent/spray_update.go | 40 +- ent/tx.go | 2 +- ent/weapon.go | 22 +- ent/weapon/weapon.go | 2 +- ent/weapon/where.go | 62 +-- ent/weapon_create.go | 16 +- ent/weapon_delete.go | 8 +- ent/weapon_query.go | 500 +++------------------ ent/weapon_update.go | 40 +- go.mod | 51 +-- go.sum | 164 +++---- main.go | 2 +- 66 files changed, 1578 insertions(+), 4744 deletions(-) diff --git a/csgo/demo_parser.go b/csgo/demo_parser.go index 14e2756..4a4eee4 100644 --- a/csgo/demo_parser.go +++ b/csgo/demo_parser.go @@ -11,9 +11,9 @@ import ( "git.harting.dev/csgowtf/csgowtfd/ent/matchplayer" "git.harting.dev/csgowtf/csgowtfd/ent/player" "github.com/golang/geo/r2" - "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs" - "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/common" - "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/events" + "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs" + "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/common" + "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events" log "github.com/sirupsen/logrus" "io" "net/http" diff --git a/ent/client.go b/ent/client.go index fb3551c..0c68022 100644 --- a/ent/client.go +++ b/ent/client.go @@ -1,9 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" + "errors" "fmt" "log" @@ -83,7 +84,7 @@ func Open(driverName, dataSourceName string, options ...Option) (*Client, error) // is used until the transaction is committed or rolled back. func (c *Client) Tx(ctx context.Context) (*Tx, error) { if _, ok := c.driver.(*txDriver); ok { - return nil, fmt.Errorf("ent: cannot start a transaction within a transaction") + return nil, errors.New("ent: cannot start a transaction within a transaction") } tx, err := newTx(ctx, c.driver) if err != nil { @@ -107,7 +108,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { // BeginTx returns a transactional client with specified options. func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) { if _, ok := c.driver.(*txDriver); ok { - return nil, fmt.Errorf("ent: cannot start a transaction within a transaction") + return nil, errors.New("ent: cannot start a transaction within a transaction") } tx, err := c.driver.(interface { BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error) @@ -136,7 +137,6 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) // Match. // Query(). // Count(ctx) -// func (c *Client) Debug() *Client { if c.debug { return c @@ -181,7 +181,7 @@ func (c *MatchClient) Use(hooks ...Hook) { c.hooks.Match = append(c.hooks.Match, hooks...) } -// Create returns a create builder for Match. +// Create returns a builder for creating a Match entity. func (c *MatchClient) Create() *MatchCreate { mutation := newMatchMutation(c.config, OpCreate) return &MatchCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -216,12 +216,12 @@ func (c *MatchClient) Delete() *MatchDelete { return &MatchDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *MatchClient) DeleteOne(m *Match) *MatchDeleteOne { return c.DeleteOneID(m.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *MatchClient) DeleteOneID(id uint64) *MatchDeleteOne { builder := c.Delete().Where(match.ID(id)) builder.mutation.id = &id @@ -303,7 +303,7 @@ func (c *MatchPlayerClient) Use(hooks ...Hook) { c.hooks.MatchPlayer = append(c.hooks.MatchPlayer, hooks...) } -// Create returns a create builder for MatchPlayer. +// Create returns a builder for creating a MatchPlayer entity. func (c *MatchPlayerClient) Create() *MatchPlayerCreate { mutation := newMatchPlayerMutation(c.config, OpCreate) return &MatchPlayerCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -338,12 +338,12 @@ func (c *MatchPlayerClient) Delete() *MatchPlayerDelete { return &MatchPlayerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *MatchPlayerClient) DeleteOne(mp *MatchPlayer) *MatchPlayerDeleteOne { return c.DeleteOneID(mp.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *MatchPlayerClient) DeleteOneID(id int) *MatchPlayerDeleteOne { builder := c.Delete().Where(matchplayer.ID(id)) builder.mutation.id = &id @@ -489,7 +489,7 @@ func (c *MessagesClient) Use(hooks ...Hook) { c.hooks.Messages = append(c.hooks.Messages, hooks...) } -// Create returns a create builder for Messages. +// Create returns a builder for creating a Messages entity. func (c *MessagesClient) Create() *MessagesCreate { mutation := newMessagesMutation(c.config, OpCreate) return &MessagesCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -524,12 +524,12 @@ func (c *MessagesClient) Delete() *MessagesDelete { return &MessagesDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *MessagesClient) DeleteOne(m *Messages) *MessagesDeleteOne { return c.DeleteOneID(m.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *MessagesClient) DeleteOneID(id int) *MessagesDeleteOne { builder := c.Delete().Where(messages.ID(id)) builder.mutation.id = &id @@ -595,7 +595,7 @@ func (c *PlayerClient) Use(hooks ...Hook) { c.hooks.Player = append(c.hooks.Player, hooks...) } -// Create returns a create builder for Player. +// Create returns a builder for creating a Player entity. func (c *PlayerClient) Create() *PlayerCreate { mutation := newPlayerMutation(c.config, OpCreate) return &PlayerCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -630,12 +630,12 @@ func (c *PlayerClient) Delete() *PlayerDelete { return &PlayerDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *PlayerClient) DeleteOne(pl *Player) *PlayerDeleteOne { return c.DeleteOneID(pl.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *PlayerClient) DeleteOneID(id uint64) *PlayerDeleteOne { builder := c.Delete().Where(player.ID(id)) builder.mutation.id = &id @@ -717,7 +717,7 @@ func (c *RoundStatsClient) Use(hooks ...Hook) { c.hooks.RoundStats = append(c.hooks.RoundStats, hooks...) } -// Create returns a create builder for RoundStats. +// Create returns a builder for creating a RoundStats entity. func (c *RoundStatsClient) Create() *RoundStatsCreate { mutation := newRoundStatsMutation(c.config, OpCreate) return &RoundStatsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -752,12 +752,12 @@ func (c *RoundStatsClient) Delete() *RoundStatsDelete { return &RoundStatsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *RoundStatsClient) DeleteOne(rs *RoundStats) *RoundStatsDeleteOne { return c.DeleteOneID(rs.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *RoundStatsClient) DeleteOneID(id int) *RoundStatsDeleteOne { builder := c.Delete().Where(roundstats.ID(id)) builder.mutation.id = &id @@ -823,7 +823,7 @@ func (c *SprayClient) Use(hooks ...Hook) { c.hooks.Spray = append(c.hooks.Spray, hooks...) } -// Create returns a create builder for Spray. +// Create returns a builder for creating a Spray entity. func (c *SprayClient) Create() *SprayCreate { mutation := newSprayMutation(c.config, OpCreate) return &SprayCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -858,12 +858,12 @@ func (c *SprayClient) Delete() *SprayDelete { return &SprayDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *SprayClient) DeleteOne(s *Spray) *SprayDeleteOne { return c.DeleteOneID(s.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *SprayClient) DeleteOneID(id int) *SprayDeleteOne { builder := c.Delete().Where(spray.ID(id)) builder.mutation.id = &id @@ -929,7 +929,7 @@ func (c *WeaponClient) Use(hooks ...Hook) { c.hooks.Weapon = append(c.hooks.Weapon, hooks...) } -// Create returns a create builder for Weapon. +// Create returns a builder for creating a Weapon entity. func (c *WeaponClient) Create() *WeaponCreate { mutation := newWeaponMutation(c.config, OpCreate) return &WeaponCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} @@ -964,12 +964,12 @@ func (c *WeaponClient) Delete() *WeaponDelete { return &WeaponDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// DeleteOne returns a delete builder for the given entity. +// DeleteOne returns a builder for deleting the given entity. func (c *WeaponClient) DeleteOne(w *Weapon) *WeaponDeleteOne { return c.DeleteOneID(w.ID) } -// DeleteOneID returns a delete builder for the given id. +// DeleteOne returns a builder for deleting the given entity by its id. func (c *WeaponClient) DeleteOneID(id int) *WeaponDeleteOne { builder := c.Delete().Where(weapon.ID(id)) builder.mutation.id = &id diff --git a/ent/config.go b/ent/config.go index 7958ab0..38e1f15 100644 --- a/ent/config.go +++ b/ent/config.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent diff --git a/ent/context.go b/ent/context.go index 0840726..7811bfa 100644 --- a/ent/context.go +++ b/ent/context.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent diff --git a/ent/ent.go b/ent/ent.go index 56d2b89..0690af1 100644 --- a/ent/ent.go +++ b/ent/ent.go @@ -1,13 +1,15 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( + "context" "errors" "fmt" "entgo.io/ent" "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" "git.harting.dev/csgowtf/csgowtfd/ent/match" "git.harting.dev/csgowtf/csgowtfd/ent/matchplayer" "git.harting.dev/csgowtf/csgowtfd/ent/messages" @@ -91,7 +93,6 @@ type AggregateFunc func(*sql.Selector) string // GroupBy(field1, field2). // Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). // Scan(ctx, &v) -// func As(fn AggregateFunc, end string) AggregateFunc { return func(s *sql.Selector) string { return sql.As(fn(s), end) @@ -269,3 +270,208 @@ func IsConstraintError(err error) bool { var e *ConstraintError return errors.As(err, &e) } + +// selector embedded by the different Select/GroupBy builders. +type selector struct { + label string + flds *[]string + scan func(context.Context, interface{}) error +} + +// ScanX is like Scan, but panics if an error occurs. +func (s *selector) ScanX(ctx context.Context, v interface{}) { + if err := s.scan(ctx, v); err != nil { + panic(err) + } +} + +// Strings returns list of strings from a selector. It is only allowed when selecting one field. +func (s *selector) Strings(ctx context.Context) ([]string, error) { + if len(*s.flds) > 1 { + return nil, errors.New("ent: Strings is not achievable when selecting more than 1 field") + } + var v []string + if err := s.scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// StringsX is like Strings, but panics if an error occurs. +func (s *selector) StringsX(ctx context.Context) []string { + v, err := s.Strings(ctx) + if err != nil { + panic(err) + } + return v +} + +// String returns a single string from a selector. It is only allowed when selecting one field. +func (s *selector) String(ctx context.Context) (_ string, err error) { + var v []string + if v, err = s.Strings(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("ent: Strings returned %d results when one was expected", len(v)) + } + return +} + +// StringX is like String, but panics if an error occurs. +func (s *selector) StringX(ctx context.Context) string { + v, err := s.String(ctx) + if err != nil { + panic(err) + } + return v +} + +// Ints returns list of ints from a selector. It is only allowed when selecting one field. +func (s *selector) Ints(ctx context.Context) ([]int, error) { + if len(*s.flds) > 1 { + return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field") + } + var v []int + if err := s.scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// IntsX is like Ints, but panics if an error occurs. +func (s *selector) IntsX(ctx context.Context) []int { + v, err := s.Ints(ctx) + if err != nil { + panic(err) + } + return v +} + +// Int returns a single int from a selector. It is only allowed when selecting one field. +func (s *selector) Int(ctx context.Context) (_ int, err error) { + var v []int + if v, err = s.Ints(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v)) + } + return +} + +// IntX is like Int, but panics if an error occurs. +func (s *selector) IntX(ctx context.Context) int { + v, err := s.Int(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. +func (s *selector) Float64s(ctx context.Context) ([]float64, error) { + if len(*s.flds) > 1 { + return nil, errors.New("ent: Float64s is not achievable when selecting more than 1 field") + } + var v []float64 + if err := s.scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// Float64sX is like Float64s, but panics if an error occurs. +func (s *selector) Float64sX(ctx context.Context) []float64 { + v, err := s.Float64s(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. +func (s *selector) Float64(ctx context.Context) (_ float64, err error) { + var v []float64 + if v, err = s.Float64s(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("ent: Float64s returned %d results when one was expected", len(v)) + } + return +} + +// Float64X is like Float64, but panics if an error occurs. +func (s *selector) Float64X(ctx context.Context) float64 { + v, err := s.Float64(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bools returns list of bools from a selector. It is only allowed when selecting one field. +func (s *selector) Bools(ctx context.Context) ([]bool, error) { + if len(*s.flds) > 1 { + return nil, errors.New("ent: Bools is not achievable when selecting more than 1 field") + } + var v []bool + if err := s.scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// BoolsX is like Bools, but panics if an error occurs. +func (s *selector) BoolsX(ctx context.Context) []bool { + v, err := s.Bools(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bool returns a single bool from a selector. It is only allowed when selecting one field. +func (s *selector) Bool(ctx context.Context) (_ bool, err error) { + var v []bool + if v, err = s.Bools(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{s.label} + default: + err = fmt.Errorf("ent: Bools returned %d results when one was expected", len(v)) + } + return +} + +// BoolX is like Bool, but panics if an error occurs. +func (s *selector) BoolX(ctx context.Context) bool { + v, err := s.Bool(ctx) + if err != nil { + panic(err) + } + return v +} + +// queryHook describes an internal hook for the different sqlAll methods. +type queryHook func(context.Context, *sqlgraph.QuerySpec) diff --git a/ent/enttest/enttest.go b/ent/enttest/enttest.go index 3764078..ce6c847 100644 --- a/ent/enttest/enttest.go +++ b/ent/enttest/enttest.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package enttest @@ -10,6 +10,7 @@ import ( _ "git.harting.dev/csgowtf/csgowtfd/ent/runtime" "entgo.io/ent/dialect/sql/schema" + "git.harting.dev/csgowtf/csgowtfd/ent/migrate" ) type ( @@ -59,10 +60,7 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Cl t.Error(err) t.FailNow() } - if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil { - t.Error(err) - t.FailNow() - } + migrateSchema(t, c, o) return c } @@ -70,9 +68,17 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Cl func NewClient(t TestingT, opts ...Option) *ent.Client { o := newOptions(opts) c := ent.NewClient(o.opts...) - if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil { + migrateSchema(t, c, o) + return c +} +func migrateSchema(t TestingT, c *ent.Client, o *options) { + tables, err := schema.CopyTables(migrate.Tables) + if err != nil { + t.Error(err) + t.FailNow() + } + if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil { t.Error(err) t.FailNow() } - return c } diff --git a/ent/hook/hook.go b/ent/hook/hook.go index ce000a9..859cdb5 100644 --- a/ent/hook/hook.go +++ b/ent/hook/hook.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package hook @@ -195,7 +195,6 @@ func HasFields(field string, fields ...string) Condition { // If executes the given hook under condition. // // hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...))) -// func If(hk ent.Hook, cond Condition) ent.Hook { return func(next ent.Mutator) ent.Mutator { return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) { @@ -210,7 +209,6 @@ func If(hk ent.Hook, cond Condition) ent.Hook { // On executes the given hook only for the given operation. // // hook.On(Log, ent.Delete|ent.Create) -// func On(hk ent.Hook, op ent.Op) ent.Hook { return If(hk, HasOp(op)) } @@ -218,7 +216,6 @@ func On(hk ent.Hook, op ent.Op) ent.Hook { // Unless skips the given hook only for the given operation. // // hook.Unless(Log, ent.Update|ent.UpdateOne) -// func Unless(hk ent.Hook, op ent.Op) ent.Hook { return If(hk, Not(HasOp(op))) } @@ -239,7 +236,6 @@ func FixedError(err error) ent.Hook { // Reject(ent.Delete|ent.Update), // } // } -// func Reject(op ent.Op) ent.Hook { hk := FixedError(fmt.Errorf("%s operation is not allowed", op)) return On(hk, op) diff --git a/ent/match.go b/ent/match.go index a85f1ec..3e524d0 100644 --- a/ent/match.go +++ b/ent/match.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -225,11 +225,11 @@ func (m *Match) Update() *MatchUpdateOne { // Unwrap unwraps the Match entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (m *Match) Unwrap() *Match { - tx, ok := m.config.driver.(*txDriver) + _tx, ok := m.config.driver.(*txDriver) if !ok { panic("ent: Match is not a transactional entity") } - m.config.driver = tx.drv + m.config.driver = _tx.drv return m } @@ -237,34 +237,47 @@ func (m *Match) Unwrap() *Match { func (m *Match) String() string { var builder strings.Builder builder.WriteString("Match(") - builder.WriteString(fmt.Sprintf("id=%v", m.ID)) - builder.WriteString(", share_code=") + builder.WriteString(fmt.Sprintf("id=%v, ", m.ID)) + builder.WriteString("share_code=") builder.WriteString(m.ShareCode) - builder.WriteString(", map=") + builder.WriteString(", ") + builder.WriteString("map=") builder.WriteString(m.Map) - builder.WriteString(", date=") + builder.WriteString(", ") + builder.WriteString("date=") builder.WriteString(m.Date.Format(time.ANSIC)) - builder.WriteString(", score_team_a=") + builder.WriteString(", ") + builder.WriteString("score_team_a=") builder.WriteString(fmt.Sprintf("%v", m.ScoreTeamA)) - builder.WriteString(", score_team_b=") + builder.WriteString(", ") + builder.WriteString("score_team_b=") builder.WriteString(fmt.Sprintf("%v", m.ScoreTeamB)) - builder.WriteString(", replay_url=") + builder.WriteString(", ") + builder.WriteString("replay_url=") builder.WriteString(m.ReplayURL) - builder.WriteString(", duration=") + builder.WriteString(", ") + builder.WriteString("duration=") builder.WriteString(fmt.Sprintf("%v", m.Duration)) - builder.WriteString(", match_result=") + builder.WriteString(", ") + builder.WriteString("match_result=") builder.WriteString(fmt.Sprintf("%v", m.MatchResult)) - builder.WriteString(", max_rounds=") + builder.WriteString(", ") + builder.WriteString("max_rounds=") builder.WriteString(fmt.Sprintf("%v", m.MaxRounds)) - builder.WriteString(", demo_parsed=") + builder.WriteString(", ") + builder.WriteString("demo_parsed=") builder.WriteString(fmt.Sprintf("%v", m.DemoParsed)) - builder.WriteString(", vac_present=") + builder.WriteString(", ") + builder.WriteString("vac_present=") builder.WriteString(fmt.Sprintf("%v", m.VacPresent)) - builder.WriteString(", gameban_present=") + builder.WriteString(", ") + builder.WriteString("gameban_present=") builder.WriteString(fmt.Sprintf("%v", m.GamebanPresent)) - builder.WriteString(", decryption_key=") + builder.WriteString(", ") + builder.WriteString("decryption_key=") builder.WriteString(fmt.Sprintf("%v", m.DecryptionKey)) - builder.WriteString(", tick_rate=") + builder.WriteString(", ") + builder.WriteString("tick_rate=") builder.WriteString(fmt.Sprintf("%v", m.TickRate)) builder.WriteByte(')') return builder.String() diff --git a/ent/match/match.go b/ent/match/match.go index 9c690a7..7865bad 100644 --- a/ent/match/match.go +++ b/ent/match/match.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package match diff --git a/ent/match/where.go b/ent/match/where.go index d0c96c4..ade5f1a 100644 --- a/ent/match/where.go +++ b/ent/match/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package match @@ -34,12 +34,6 @@ func IDNEQ(id uint64) predicate.Match { // IDIn applies the In predicate on the ID field. func IDIn(ids ...uint64) predicate.Match { return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -51,12 +45,6 @@ func IDIn(ids ...uint64) predicate.Match { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uint64) predicate.Match { return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -212,12 +200,6 @@ func ShareCodeIn(vs ...string) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldShareCode), v...)) }) } @@ -229,12 +211,6 @@ func ShareCodeNotIn(vs ...string) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldShareCode), v...)) }) } @@ -323,12 +299,6 @@ func MapIn(vs ...string) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMap), v...)) }) } @@ -340,12 +310,6 @@ func MapNotIn(vs ...string) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMap), v...)) }) } @@ -448,12 +412,6 @@ func DateIn(vs ...time.Time) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldDate), v...)) }) } @@ -465,12 +423,6 @@ func DateNotIn(vs ...time.Time) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldDate), v...)) }) } @@ -524,12 +476,6 @@ func ScoreTeamAIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldScoreTeamA), v...)) }) } @@ -541,12 +487,6 @@ func ScoreTeamANotIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldScoreTeamA), v...)) }) } @@ -600,12 +540,6 @@ func ScoreTeamBIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldScoreTeamB), v...)) }) } @@ -617,12 +551,6 @@ func ScoreTeamBNotIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldScoreTeamB), v...)) }) } @@ -676,12 +604,6 @@ func ReplayURLIn(vs ...string) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldReplayURL), v...)) }) } @@ -693,12 +615,6 @@ func ReplayURLNotIn(vs ...string) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldReplayURL), v...)) }) } @@ -801,12 +717,6 @@ func DurationIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldDuration), v...)) }) } @@ -818,12 +728,6 @@ func DurationNotIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldDuration), v...)) }) } @@ -877,12 +781,6 @@ func MatchResultIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMatchResult), v...)) }) } @@ -894,12 +792,6 @@ func MatchResultNotIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMatchResult), v...)) }) } @@ -953,12 +845,6 @@ func MaxRoundsIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMaxRounds), v...)) }) } @@ -970,12 +856,6 @@ func MaxRoundsNotIn(vs ...int) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMaxRounds), v...)) }) } @@ -1071,12 +951,6 @@ func DecryptionKeyIn(vs ...[]byte) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldDecryptionKey), v...)) }) } @@ -1088,12 +962,6 @@ func DecryptionKeyNotIn(vs ...[]byte) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldDecryptionKey), v...)) }) } @@ -1161,12 +1029,6 @@ func TickRateIn(vs ...float64) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldTickRate), v...)) }) } @@ -1178,12 +1040,6 @@ func TickRateNotIn(vs ...float64) predicate.Match { v[i] = vs[i] } return predicate.Match(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldTickRate), v...)) }) } diff --git a/ent/match_create.go b/ent/match_create.go index 501f240..b512c09 100644 --- a/ent/match_create.go +++ b/ent/match_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -230,9 +230,15 @@ func (mc *MatchCreate) Save(ctx context.Context) (*Match, error) { } mut = mc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, mc.mutation); err != nil { + v, err := mut.Mutate(ctx, mc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Match) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from MatchMutation", v) + } + node = nv } return node, err } @@ -314,7 +320,7 @@ func (mc *MatchCreate) sqlSave(ctx context.Context) (*Match, error) { _node, _spec := mc.createSpec() if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -526,7 +532,7 @@ func (mcb *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) { // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, mcb.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } } } @@ -534,11 +540,11 @@ func (mcb *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) { return nil, err } mutation.id = &nodes[i].ID - mutation.done = true if specs[i].ID.Value != nil && nodes[i].ID == 0 { id := specs[i].ID.Value.(int64) nodes[i].ID = uint64(id) } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { diff --git a/ent/match_delete.go b/ent/match_delete.go index e95440b..179a0f5 100644 --- a/ent/match_delete.go +++ b/ent/match_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -84,7 +84,11 @@ func (md *MatchDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, md.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, md.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // MatchDeleteOne is the builder for deleting a single Match entity. diff --git a/ent/match_query.go b/ent/match_query.go index 01514c8..a3e0713 100644 --- a/ent/match_query.go +++ b/ent/match_query.go @@ -1,11 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" - "errors" "fmt" "math" @@ -21,16 +20,15 @@ import ( // MatchQuery is the builder for querying Match entities. type MatchQuery struct { config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Match - // eager-loading edges. + limit *int + offset *int + unique *bool + order []OrderFunc + fields []string + predicates []predicate.Match withStats *MatchPlayerQuery withPlayers *PlayerQuery - modifiers []func(s *sql.Selector) + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -337,17 +335,18 @@ func (mq *MatchQuery) WithPlayers(opts ...func(*PlayerQuery)) *MatchQuery { // GroupBy(match.FieldShareCode). // Aggregate(ent.Count()). // Scan(ctx, &v) -// func (mq *MatchQuery) GroupBy(field string, fields ...string) *MatchGroupBy { - group := &MatchGroupBy{config: mq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &MatchGroupBy{config: mq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := mq.prepareQuery(ctx); err != nil { return nil, err } return mq.sqlQuery(ctx), nil } - return group + grbuild.label = match.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -362,10 +361,12 @@ func (mq *MatchQuery) GroupBy(field string, fields ...string) *MatchGroupBy { // client.Match.Query(). // Select(match.FieldShareCode). // Scan(ctx, &v) -// func (mq *MatchQuery) Select(fields ...string) *MatchSelect { mq.fields = append(mq.fields, fields...) - return &MatchSelect{MatchQuery: mq} + selbuild := &MatchSelect{MatchQuery: mq} + selbuild.label = match.Label + selbuild.flds, selbuild.scan = &mq.fields, selbuild.Scan + return selbuild } func (mq *MatchQuery) prepareQuery(ctx context.Context) error { @@ -384,7 +385,7 @@ func (mq *MatchQuery) prepareQuery(ctx context.Context) error { return nil } -func (mq *MatchQuery) sqlAll(ctx context.Context) ([]*Match, error) { +func (mq *MatchQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Match, error) { var ( nodes = []*Match{} _spec = mq.querySpec() @@ -394,119 +395,127 @@ func (mq *MatchQuery) sqlAll(ctx context.Context) ([]*Match, error) { } ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Match{config: mq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Match).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Match{config: mq.config} + nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(mq.modifiers) > 0 { _spec.Modifiers = mq.modifiers } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, mq.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := mq.withStats; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[uint64]*Match) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Stats = []*MatchPlayer{} - } - query.Where(predicate.MatchPlayer(func(s *sql.Selector) { - s.Where(sql.InValues(match.StatsColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { + if err := mq.loadStats(ctx, query, nodes, + func(n *Match) { n.Edges.Stats = []*MatchPlayer{} }, + func(n *Match, e *MatchPlayer) { n.Edges.Stats = append(n.Edges.Stats, e) }); err != nil { return nil, err } - for _, n := range neighbors { - fk := n.MatchStats - node, ok := nodeids[fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_stats" returned %v for node %v`, fk, n.ID) - } - node.Edges.Stats = append(node.Edges.Stats, n) - } } - if query := mq.withPlayers; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[uint64]*Match, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Players = []*Player{} - } - var ( - edgeids []uint64 - edges = make(map[uint64][]*Match) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: true, - Table: match.PlayersTable, - Columns: match.PlayersPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(match.PlayersPrimaryKey[1], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullInt64) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullInt64) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := uint64(eout.Int64) - inValue := uint64(ein.Int64) - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, mq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "players": %w`, err) - } - query.Where(player.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := mq.loadPlayers(ctx, query, nodes, + func(n *Match) { n.Edges.Players = []*Player{} }, + func(n *Match, e *Player) { n.Edges.Players = append(n.Edges.Players, e) }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "players" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Players = append(nodes[i].Edges.Players, n) - } + } + return nodes, nil +} + +func (mq *MatchQuery) loadStats(ctx context.Context, query *MatchPlayerQuery, nodes []*Match, init func(*Match), assign func(*Match, *MatchPlayer)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[uint64]*Match) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) } } - - return nodes, nil + query.Where(predicate.MatchPlayer(func(s *sql.Selector) { + s.Where(sql.InValues(match.StatsColumn, fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + 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) + } + assign(node, n) + } + return nil +} +func (mq *MatchQuery) loadPlayers(ctx context.Context, query *PlayerQuery, nodes []*Match, init func(*Match), assign func(*Match, *Player)) error { + edgeIDs := make([]driver.Value, len(nodes)) + byID := make(map[uint64]*Match) + nids := make(map[uint64]map[*Match]struct{}) + for i, node := range nodes { + edgeIDs[i] = node.ID + byID[node.ID] = node + if init != nil { + init(node) + } + } + query.Where(func(s *sql.Selector) { + joinT := sql.Table(match.PlayersTable) + s.Join(joinT).On(s.C(player.FieldID), joinT.C(match.PlayersPrimaryKey[0])) + s.Where(sql.InValues(joinT.C(match.PlayersPrimaryKey[1]), edgeIDs...)) + columns := s.SelectedColumns() + s.Select(joinT.C(match.PlayersPrimaryKey[1])) + s.AppendSelect(columns...) + s.SetDistinct(false) + }) + if err := query.prepareQuery(ctx); err != nil { + return err + } + neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) { + assign := spec.Assign + values := spec.ScanValues + spec.ScanValues = func(columns []string) ([]interface{}, error) { + values, err := values(columns[1:]) + if err != nil { + return nil, err + } + return append([]interface{}{new(sql.NullInt64)}, values...), nil + } + spec.Assign = func(columns []string, values []interface{}) error { + outValue := uint64(values[0].(*sql.NullInt64).Int64) + inValue := uint64(values[1].(*sql.NullInt64).Int64) + if nids[inValue] == nil { + nids[inValue] = map[*Match]struct{}{byID[outValue]: struct{}{}} + return assign(columns[1:], values[1:]) + } + nids[inValue][byID[outValue]] = struct{}{} + return nil + } + }) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nids[n.ID] + if !ok { + return fmt.Errorf(`unexpected "players" node returned %v`, n.ID) + } + for kn := range nodes { + assign(kn, n) + } + } + return nil } func (mq *MatchQuery) sqlCount(ctx context.Context) (int, error) { @@ -621,6 +630,7 @@ func (mq *MatchQuery) Modify(modifiers ...func(s *sql.Selector)) *MatchSelect { // MatchGroupBy is the group-by builder for Match entities. type MatchGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -644,209 +654,6 @@ func (mgb *MatchGroupBy) Scan(ctx context.Context, v interface{}) error { return mgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (mgb *MatchGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := mgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MatchGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (mgb *MatchGroupBy) StringsX(ctx context.Context) []string { - v, err := mgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = mgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (mgb *MatchGroupBy) StringX(ctx context.Context) string { - v, err := mgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MatchGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (mgb *MatchGroupBy) IntsX(ctx context.Context) []int { - v, err := mgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = mgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (mgb *MatchGroupBy) IntX(ctx context.Context) int { - v, err := mgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MatchGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (mgb *MatchGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := mgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = mgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (mgb *MatchGroupBy) Float64X(ctx context.Context) float64 { - v, err := mgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MatchGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (mgb *MatchGroupBy) BoolsX(ctx context.Context) []bool { - v, err := mgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MatchGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = mgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (mgb *MatchGroupBy) BoolX(ctx context.Context) bool { - v, err := mgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (mgb *MatchGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range mgb.fields { if !match.ValidColumn(f) { @@ -888,6 +695,7 @@ func (mgb *MatchGroupBy) sqlQuery() *sql.Selector { // MatchSelect is the builder for selecting fields of Match entities. type MatchSelect struct { *MatchQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -901,201 +709,6 @@ func (ms *MatchSelect) Scan(ctx context.Context, v interface{}) error { return ms.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ms *MatchSelect) ScanX(ctx context.Context, v interface{}) { - if err := ms.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) Strings(ctx context.Context) ([]string, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MatchSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ms *MatchSelect) StringsX(ctx context.Context) []string { - v, err := ms.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ms.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ms *MatchSelect) StringX(ctx context.Context) string { - v, err := ms.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) Ints(ctx context.Context) ([]int, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MatchSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ms *MatchSelect) IntsX(ctx context.Context) []int { - v, err := ms.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ms.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ms *MatchSelect) IntX(ctx context.Context) int { - v, err := ms.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MatchSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ms *MatchSelect) Float64sX(ctx context.Context) []float64 { - v, err := ms.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ms.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ms *MatchSelect) Float64X(ctx context.Context) float64 { - v, err := ms.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MatchSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ms *MatchSelect) BoolsX(ctx context.Context) []bool { - v, err := ms.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ms *MatchSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ms.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{match.Label} - default: - err = fmt.Errorf("ent: MatchSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ms *MatchSelect) BoolX(ctx context.Context) bool { - v, err := ms.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ms *MatchSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} query, args := ms.sql.Query() diff --git a/ent/match_update.go b/ent/match_update.go index ccbd8d9..b5fa800 100644 --- a/ent/match_update.go +++ b/ent/match_update.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -20,8 +20,9 @@ import ( // MatchUpdate is the builder for updating Match entities. type MatchUpdate struct { config - hooks []Hook - mutation *MatchMutation + hooks []Hook + mutation *MatchMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the MatchUpdate builder. @@ -359,6 +360,12 @@ func (mu *MatchUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (mu *MatchUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MatchUpdate { + mu.modifiers = append(mu.modifiers, modifiers...) + return mu +} + func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -649,11 +656,12 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = mu.modifiers if n, err = sqlgraph.UpdateNodes(ctx, mu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{match.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -663,9 +671,10 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) { // MatchUpdateOne is the builder for updating a single Match entity. type MatchUpdateOne struct { config - fields []string - hooks []Hook - mutation *MatchMutation + fields []string + hooks []Hook + mutation *MatchMutation + modifiers []func(*sql.UpdateBuilder) } // SetShareCode sets the "share_code" field. @@ -975,9 +984,15 @@ func (muo *MatchUpdateOne) Save(ctx context.Context) (*Match, error) { } mut = muo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, muo.mutation); err != nil { + v, err := mut.Mutate(ctx, muo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Match) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from MatchMutation", v) + } + node = nv } return node, err } @@ -1004,6 +1019,12 @@ func (muo *MatchUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (muo *MatchUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MatchUpdateOne { + muo.modifiers = append(muo.modifiers, modifiers...) + return muo +} + func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -1311,6 +1332,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = muo.modifiers _node = &Match{config: muo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues @@ -1318,7 +1340,7 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{match.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/ent/matchplayer.go b/ent/matchplayer.go index da12910..0edaffe 100644 --- a/ent/matchplayer.go +++ b/ent/matchplayer.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -110,8 +110,7 @@ type MatchPlayerEdges struct { func (e MatchPlayerEdges) MatchesOrErr() (*Match, error) { if e.loadedTypes[0] { if e.Matches == nil { - // The edge matches was loaded in eager-loading, - // but was not found. + // Edge was loaded but was not found. return nil, &NotFoundError{label: match.Label} } return e.Matches, nil @@ -124,8 +123,7 @@ func (e MatchPlayerEdges) MatchesOrErr() (*Match, error) { func (e MatchPlayerEdges) PlayersOrErr() (*Player, error) { if e.loadedTypes[1] { if e.Players == nil { - // The edge players was loaded in eager-loading, - // but was not found. + // Edge was loaded but was not found. return nil, &NotFoundError{label: player.Label} } return e.Players, nil @@ -438,11 +436,11 @@ func (mp *MatchPlayer) Update() *MatchPlayerUpdateOne { // Unwrap unwraps the MatchPlayer entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (mp *MatchPlayer) Unwrap() *MatchPlayer { - tx, ok := mp.config.driver.(*txDriver) + _tx, ok := mp.config.driver.(*txDriver) if !ok { panic("ent: MatchPlayer is not a transactional entity") } - mp.config.driver = tx.drv + mp.config.driver = _tx.drv return mp } @@ -450,70 +448,101 @@ func (mp *MatchPlayer) Unwrap() *MatchPlayer { func (mp *MatchPlayer) String() string { var builder strings.Builder builder.WriteString("MatchPlayer(") - builder.WriteString(fmt.Sprintf("id=%v", mp.ID)) - builder.WriteString(", team_id=") + builder.WriteString(fmt.Sprintf("id=%v, ", mp.ID)) + builder.WriteString("team_id=") builder.WriteString(fmt.Sprintf("%v", mp.TeamID)) - builder.WriteString(", kills=") + builder.WriteString(", ") + builder.WriteString("kills=") builder.WriteString(fmt.Sprintf("%v", mp.Kills)) - builder.WriteString(", deaths=") + builder.WriteString(", ") + builder.WriteString("deaths=") builder.WriteString(fmt.Sprintf("%v", mp.Deaths)) - builder.WriteString(", assists=") + builder.WriteString(", ") + builder.WriteString("assists=") builder.WriteString(fmt.Sprintf("%v", mp.Assists)) - builder.WriteString(", headshot=") + builder.WriteString(", ") + builder.WriteString("headshot=") builder.WriteString(fmt.Sprintf("%v", mp.Headshot)) - builder.WriteString(", mvp=") + builder.WriteString(", ") + builder.WriteString("mvp=") builder.WriteString(fmt.Sprintf("%v", mp.Mvp)) - builder.WriteString(", score=") + builder.WriteString(", ") + builder.WriteString("score=") builder.WriteString(fmt.Sprintf("%v", mp.Score)) - builder.WriteString(", rank_new=") + builder.WriteString(", ") + builder.WriteString("rank_new=") builder.WriteString(fmt.Sprintf("%v", mp.RankNew)) - builder.WriteString(", rank_old=") + builder.WriteString(", ") + builder.WriteString("rank_old=") builder.WriteString(fmt.Sprintf("%v", mp.RankOld)) - builder.WriteString(", mk_2=") + builder.WriteString(", ") + builder.WriteString("mk_2=") builder.WriteString(fmt.Sprintf("%v", mp.Mk2)) - builder.WriteString(", mk_3=") + builder.WriteString(", ") + builder.WriteString("mk_3=") builder.WriteString(fmt.Sprintf("%v", mp.Mk3)) - builder.WriteString(", mk_4=") + builder.WriteString(", ") + builder.WriteString("mk_4=") builder.WriteString(fmt.Sprintf("%v", mp.Mk4)) - builder.WriteString(", mk_5=") + builder.WriteString(", ") + builder.WriteString("mk_5=") builder.WriteString(fmt.Sprintf("%v", mp.Mk5)) - builder.WriteString(", dmg_enemy=") + builder.WriteString(", ") + builder.WriteString("dmg_enemy=") builder.WriteString(fmt.Sprintf("%v", mp.DmgEnemy)) - builder.WriteString(", dmg_team=") + builder.WriteString(", ") + builder.WriteString("dmg_team=") builder.WriteString(fmt.Sprintf("%v", mp.DmgTeam)) - builder.WriteString(", ud_he=") + builder.WriteString(", ") + builder.WriteString("ud_he=") builder.WriteString(fmt.Sprintf("%v", mp.UdHe)) - builder.WriteString(", ud_flames=") + builder.WriteString(", ") + builder.WriteString("ud_flames=") builder.WriteString(fmt.Sprintf("%v", mp.UdFlames)) - builder.WriteString(", ud_flash=") + builder.WriteString(", ") + builder.WriteString("ud_flash=") builder.WriteString(fmt.Sprintf("%v", mp.UdFlash)) - builder.WriteString(", ud_decoy=") + builder.WriteString(", ") + builder.WriteString("ud_decoy=") builder.WriteString(fmt.Sprintf("%v", mp.UdDecoy)) - builder.WriteString(", ud_smoke=") + builder.WriteString(", ") + builder.WriteString("ud_smoke=") builder.WriteString(fmt.Sprintf("%v", mp.UdSmoke)) - builder.WriteString(", crosshair=") + builder.WriteString(", ") + builder.WriteString("crosshair=") builder.WriteString(mp.Crosshair) - builder.WriteString(", color=") + builder.WriteString(", ") + builder.WriteString("color=") builder.WriteString(fmt.Sprintf("%v", mp.Color)) - builder.WriteString(", kast=") + builder.WriteString(", ") + builder.WriteString("kast=") builder.WriteString(fmt.Sprintf("%v", mp.Kast)) - builder.WriteString(", flash_duration_self=") + builder.WriteString(", ") + builder.WriteString("flash_duration_self=") builder.WriteString(fmt.Sprintf("%v", mp.FlashDurationSelf)) - builder.WriteString(", flash_duration_team=") + builder.WriteString(", ") + builder.WriteString("flash_duration_team=") builder.WriteString(fmt.Sprintf("%v", mp.FlashDurationTeam)) - builder.WriteString(", flash_duration_enemy=") + builder.WriteString(", ") + builder.WriteString("flash_duration_enemy=") builder.WriteString(fmt.Sprintf("%v", mp.FlashDurationEnemy)) - builder.WriteString(", flash_total_self=") + builder.WriteString(", ") + builder.WriteString("flash_total_self=") builder.WriteString(fmt.Sprintf("%v", mp.FlashTotalSelf)) - builder.WriteString(", flash_total_team=") + builder.WriteString(", ") + builder.WriteString("flash_total_team=") builder.WriteString(fmt.Sprintf("%v", mp.FlashTotalTeam)) - builder.WriteString(", flash_total_enemy=") + builder.WriteString(", ") + builder.WriteString("flash_total_enemy=") builder.WriteString(fmt.Sprintf("%v", mp.FlashTotalEnemy)) - builder.WriteString(", match_stats=") + builder.WriteString(", ") + builder.WriteString("match_stats=") builder.WriteString(fmt.Sprintf("%v", mp.MatchStats)) - builder.WriteString(", player_stats=") + builder.WriteString(", ") + builder.WriteString("player_stats=") builder.WriteString(fmt.Sprintf("%v", mp.PlayerStats)) - builder.WriteString(", flash_assists=") + builder.WriteString(", ") + builder.WriteString("flash_assists=") builder.WriteString(fmt.Sprintf("%v", mp.FlashAssists)) builder.WriteByte(')') return builder.String() diff --git a/ent/matchplayer/matchplayer.go b/ent/matchplayer/matchplayer.go index ca64162..fee33d5 100644 --- a/ent/matchplayer/matchplayer.go +++ b/ent/matchplayer/matchplayer.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package matchplayer diff --git a/ent/matchplayer/where.go b/ent/matchplayer/where.go index 5b87178..812d8ba 100644 --- a/ent/matchplayer/where.go +++ b/ent/matchplayer/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package matchplayer @@ -32,12 +32,6 @@ func IDNEQ(id int) predicate.MatchPlayer { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.MatchPlayer { return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -49,12 +43,6 @@ func IDIn(ids ...int) predicate.MatchPlayer { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.MatchPlayer { return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -329,12 +317,6 @@ func TeamIDIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldTeamID), v...)) }) } @@ -346,12 +328,6 @@ func TeamIDNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldTeamID), v...)) }) } @@ -405,12 +381,6 @@ func KillsIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldKills), v...)) }) } @@ -422,12 +392,6 @@ func KillsNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldKills), v...)) }) } @@ -481,12 +445,6 @@ func DeathsIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldDeaths), v...)) }) } @@ -498,12 +456,6 @@ func DeathsNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldDeaths), v...)) }) } @@ -557,12 +509,6 @@ func AssistsIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldAssists), v...)) }) } @@ -574,12 +520,6 @@ func AssistsNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldAssists), v...)) }) } @@ -633,12 +573,6 @@ func HeadshotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldHeadshot), v...)) }) } @@ -650,12 +584,6 @@ func HeadshotNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldHeadshot), v...)) }) } @@ -709,12 +637,6 @@ func MvpIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMvp), v...)) }) } @@ -726,12 +648,6 @@ func MvpNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMvp), v...)) }) } @@ -785,12 +701,6 @@ func ScoreIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldScore), v...)) }) } @@ -802,12 +712,6 @@ func ScoreNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldScore), v...)) }) } @@ -861,12 +765,6 @@ func RankNewIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldRankNew), v...)) }) } @@ -878,12 +776,6 @@ func RankNewNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldRankNew), v...)) }) } @@ -951,12 +843,6 @@ func RankOldIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldRankOld), v...)) }) } @@ -968,12 +854,6 @@ func RankOldNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldRankOld), v...)) }) } @@ -1041,12 +921,6 @@ func Mk2In(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMk2), v...)) }) } @@ -1058,12 +932,6 @@ func Mk2NotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMk2), v...)) }) } @@ -1131,12 +999,6 @@ func Mk3In(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMk3), v...)) }) } @@ -1148,12 +1010,6 @@ func Mk3NotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMk3), v...)) }) } @@ -1221,12 +1077,6 @@ func Mk4In(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMk4), v...)) }) } @@ -1238,12 +1088,6 @@ func Mk4NotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMk4), v...)) }) } @@ -1311,12 +1155,6 @@ func Mk5In(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMk5), v...)) }) } @@ -1328,12 +1166,6 @@ func Mk5NotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMk5), v...)) }) } @@ -1401,12 +1233,6 @@ func DmgEnemyIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldDmgEnemy), v...)) }) } @@ -1418,12 +1244,6 @@ func DmgEnemyNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldDmgEnemy), v...)) }) } @@ -1491,12 +1311,6 @@ func DmgTeamIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldDmgTeam), v...)) }) } @@ -1508,12 +1322,6 @@ func DmgTeamNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldDmgTeam), v...)) }) } @@ -1581,12 +1389,6 @@ func UdHeIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldUdHe), v...)) }) } @@ -1598,12 +1400,6 @@ func UdHeNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldUdHe), v...)) }) } @@ -1671,12 +1467,6 @@ func UdFlamesIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldUdFlames), v...)) }) } @@ -1688,12 +1478,6 @@ func UdFlamesNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldUdFlames), v...)) }) } @@ -1761,12 +1545,6 @@ func UdFlashIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldUdFlash), v...)) }) } @@ -1778,12 +1556,6 @@ func UdFlashNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldUdFlash), v...)) }) } @@ -1851,12 +1623,6 @@ func UdDecoyIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldUdDecoy), v...)) }) } @@ -1868,12 +1634,6 @@ func UdDecoyNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldUdDecoy), v...)) }) } @@ -1941,12 +1701,6 @@ func UdSmokeIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldUdSmoke), v...)) }) } @@ -1958,12 +1712,6 @@ func UdSmokeNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldUdSmoke), v...)) }) } @@ -2031,12 +1779,6 @@ func CrosshairIn(vs ...string) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldCrosshair), v...)) }) } @@ -2048,12 +1790,6 @@ func CrosshairNotIn(vs ...string) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldCrosshair), v...)) }) } @@ -2156,12 +1892,6 @@ func ColorIn(vs ...Color) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldColor), v...)) }) } @@ -2173,12 +1903,6 @@ func ColorNotIn(vs ...Color) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldColor), v...)) }) } @@ -2218,12 +1942,6 @@ func KastIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldKast), v...)) }) } @@ -2235,12 +1953,6 @@ func KastNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldKast), v...)) }) } @@ -2308,12 +2020,6 @@ func FlashDurationSelfIn(vs ...float32) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldFlashDurationSelf), v...)) }) } @@ -2325,12 +2031,6 @@ func FlashDurationSelfNotIn(vs ...float32) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldFlashDurationSelf), v...)) }) } @@ -2398,12 +2098,6 @@ func FlashDurationTeamIn(vs ...float32) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldFlashDurationTeam), v...)) }) } @@ -2415,12 +2109,6 @@ func FlashDurationTeamNotIn(vs ...float32) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldFlashDurationTeam), v...)) }) } @@ -2488,12 +2176,6 @@ func FlashDurationEnemyIn(vs ...float32) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldFlashDurationEnemy), v...)) }) } @@ -2505,12 +2187,6 @@ func FlashDurationEnemyNotIn(vs ...float32) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldFlashDurationEnemy), v...)) }) } @@ -2578,12 +2254,6 @@ func FlashTotalSelfIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldFlashTotalSelf), v...)) }) } @@ -2595,12 +2265,6 @@ func FlashTotalSelfNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldFlashTotalSelf), v...)) }) } @@ -2668,12 +2332,6 @@ func FlashTotalTeamIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldFlashTotalTeam), v...)) }) } @@ -2685,12 +2343,6 @@ func FlashTotalTeamNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldFlashTotalTeam), v...)) }) } @@ -2758,12 +2410,6 @@ func FlashTotalEnemyIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldFlashTotalEnemy), v...)) }) } @@ -2775,12 +2421,6 @@ func FlashTotalEnemyNotIn(vs ...uint) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldFlashTotalEnemy), v...)) }) } @@ -2848,12 +2488,6 @@ func MatchStatsIn(vs ...uint64) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMatchStats), v...)) }) } @@ -2865,12 +2499,6 @@ func MatchStatsNotIn(vs ...uint64) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMatchStats), v...)) }) } @@ -2910,12 +2538,6 @@ func PlayerStatsIn(vs ...uint64) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldPlayerStats), v...)) }) } @@ -2927,12 +2549,6 @@ func PlayerStatsNotIn(vs ...uint64) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldPlayerStats), v...)) }) } @@ -2972,12 +2588,6 @@ func FlashAssistsIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldFlashAssists), v...)) }) } @@ -2989,12 +2599,6 @@ func FlashAssistsNotIn(vs ...int) predicate.MatchPlayer { v[i] = vs[i] } return predicate.MatchPlayer(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldFlashAssists), v...)) }) } diff --git a/ent/matchplayer_create.go b/ent/matchplayer_create.go index 4ef1450..9011313 100644 --- a/ent/matchplayer_create.go +++ b/ent/matchplayer_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -554,9 +554,15 @@ func (mpc *MatchPlayerCreate) Save(ctx context.Context) (*MatchPlayer, error) { } mut = mpc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, mpc.mutation); err != nil { + v, err := mut.Mutate(ctx, mpc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*MatchPlayer) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from MatchPlayerMutation", v) + } + node = nv } return node, err } @@ -618,7 +624,7 @@ func (mpc *MatchPlayerCreate) sqlSave(ctx context.Context) (*MatchPlayer, error) _node, _spec := mpc.createSpec() if err := sqlgraph.CreateNode(ctx, mpc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -1029,7 +1035,7 @@ func (mpcb *MatchPlayerCreateBulk) Save(ctx context.Context) ([]*MatchPlayer, er // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, mpcb.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } } } @@ -1037,11 +1043,11 @@ func (mpcb *MatchPlayerCreateBulk) Save(ctx context.Context) ([]*MatchPlayer, er return nil, err } mutation.id = &nodes[i].ID - mutation.done = true if specs[i].ID.Value != nil { id := specs[i].ID.Value.(int64) nodes[i].ID = int(id) } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { diff --git a/ent/matchplayer_delete.go b/ent/matchplayer_delete.go index 018657d..1a6bcbf 100644 --- a/ent/matchplayer_delete.go +++ b/ent/matchplayer_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -84,7 +84,11 @@ func (mpd *MatchPlayerDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, mpd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, mpd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // MatchPlayerDeleteOne is the builder for deleting a single MatchPlayer entity. diff --git a/ent/matchplayer_query.go b/ent/matchplayer_query.go index a20bea2..d5f3f78 100644 --- a/ent/matchplayer_query.go +++ b/ent/matchplayer_query.go @@ -1,11 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" - "errors" "fmt" "math" @@ -25,20 +24,19 @@ import ( // MatchPlayerQuery is the builder for querying MatchPlayer entities. type MatchPlayerQuery struct { config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.MatchPlayer - // eager-loading edges. + limit *int + offset *int + unique *bool + order []OrderFunc + fields []string + predicates []predicate.MatchPlayer withMatches *MatchQuery withPlayers *PlayerQuery withWeaponStats *WeaponQuery withRoundStats *RoundStatsQuery withSpray *SprayQuery withMessages *MessagesQuery - modifiers []func(s *sql.Selector) + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -481,17 +479,18 @@ func (mpq *MatchPlayerQuery) WithMessages(opts ...func(*MessagesQuery)) *MatchPl // GroupBy(matchplayer.FieldTeamID). // Aggregate(ent.Count()). // Scan(ctx, &v) -// func (mpq *MatchPlayerQuery) GroupBy(field string, fields ...string) *MatchPlayerGroupBy { - group := &MatchPlayerGroupBy{config: mpq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &MatchPlayerGroupBy{config: mpq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := mpq.prepareQuery(ctx); err != nil { return nil, err } return mpq.sqlQuery(ctx), nil } - return group + grbuild.label = matchplayer.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -506,10 +505,12 @@ func (mpq *MatchPlayerQuery) GroupBy(field string, fields ...string) *MatchPlaye // client.MatchPlayer.Query(). // Select(matchplayer.FieldTeamID). // Scan(ctx, &v) -// func (mpq *MatchPlayerQuery) Select(fields ...string) *MatchPlayerSelect { mpq.fields = append(mpq.fields, fields...) - return &MatchPlayerSelect{MatchPlayerQuery: mpq} + selbuild := &MatchPlayerSelect{MatchPlayerQuery: mpq} + selbuild.label = matchplayer.Label + selbuild.flds, selbuild.scan = &mpq.fields, selbuild.Scan + return selbuild } func (mpq *MatchPlayerQuery) prepareQuery(ctx context.Context) error { @@ -528,7 +529,7 @@ func (mpq *MatchPlayerQuery) prepareQuery(ctx context.Context) error { return nil } -func (mpq *MatchPlayerQuery) sqlAll(ctx context.Context) ([]*MatchPlayer, error) { +func (mpq *MatchPlayerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*MatchPlayer, error) { var ( nodes = []*MatchPlayer{} _spec = mpq.querySpec() @@ -542,197 +543,244 @@ func (mpq *MatchPlayerQuery) sqlAll(ctx context.Context) ([]*MatchPlayer, error) } ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &MatchPlayer{config: mpq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*MatchPlayer).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &MatchPlayer{config: mpq.config} + nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(mpq.modifiers) > 0 { _spec.Modifiers = mpq.modifiers } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, mpq.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := mpq.withMatches; query != nil { - ids := make([]uint64, 0, len(nodes)) - nodeids := make(map[uint64][]*MatchPlayer) - for i := range nodes { - fk := nodes[i].MatchStats - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(match.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := mpq.loadMatches(ctx, query, nodes, nil, + func(n *MatchPlayer, e *Match) { n.Edges.Matches = e }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_stats" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Matches = n - } - } } - if query := mpq.withPlayers; query != nil { - ids := make([]uint64, 0, len(nodes)) - nodeids := make(map[uint64][]*MatchPlayer) - for i := range nodes { - fk := nodes[i].PlayerStats - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(player.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := mpq.loadPlayers(ctx, query, nodes, nil, + func(n *MatchPlayer, e *Player) { n.Edges.Players = e }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "player_stats" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Players = n - } - } } - if query := mpq.withWeaponStats; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*MatchPlayer) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.WeaponStats = []*Weapon{} - } - query.withFKs = true - query.Where(predicate.Weapon(func(s *sql.Selector) { - s.Where(sql.InValues(matchplayer.WeaponStatsColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { + if err := mpq.loadWeaponStats(ctx, query, nodes, + func(n *MatchPlayer) { n.Edges.WeaponStats = []*Weapon{} }, + func(n *MatchPlayer, e *Weapon) { n.Edges.WeaponStats = append(n.Edges.WeaponStats, e) }); err != nil { return nil, err } - for _, n := range neighbors { - fk := n.match_player_weapon_stats - if fk == nil { - return nil, fmt.Errorf(`foreign-key "match_player_weapon_stats" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_weapon_stats" returned %v for node %v`, *fk, n.ID) - } - node.Edges.WeaponStats = append(node.Edges.WeaponStats, n) - } } - if query := mpq.withRoundStats; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*MatchPlayer) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.RoundStats = []*RoundStats{} - } - query.withFKs = true - query.Where(predicate.RoundStats(func(s *sql.Selector) { - s.Where(sql.InValues(matchplayer.RoundStatsColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { + if err := mpq.loadRoundStats(ctx, query, nodes, + func(n *MatchPlayer) { n.Edges.RoundStats = []*RoundStats{} }, + func(n *MatchPlayer, e *RoundStats) { n.Edges.RoundStats = append(n.Edges.RoundStats, e) }); err != nil { return nil, err } - for _, n := range neighbors { - fk := n.match_player_round_stats - if fk == nil { - return nil, fmt.Errorf(`foreign-key "match_player_round_stats" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_round_stats" returned %v for node %v`, *fk, n.ID) - } - node.Edges.RoundStats = append(node.Edges.RoundStats, n) - } } - if query := mpq.withSpray; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*MatchPlayer) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Spray = []*Spray{} - } - query.withFKs = true - query.Where(predicate.Spray(func(s *sql.Selector) { - s.Where(sql.InValues(matchplayer.SprayColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { + if err := mpq.loadSpray(ctx, query, nodes, + func(n *MatchPlayer) { n.Edges.Spray = []*Spray{} }, + func(n *MatchPlayer, e *Spray) { n.Edges.Spray = append(n.Edges.Spray, e) }); err != nil { return nil, err } - for _, n := range neighbors { - fk := n.match_player_spray - if fk == nil { - return nil, fmt.Errorf(`foreign-key "match_player_spray" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_spray" returned %v for node %v`, *fk, n.ID) - } - node.Edges.Spray = append(node.Edges.Spray, n) - } } - if query := mpq.withMessages; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[int]*MatchPlayer) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Messages = []*Messages{} - } - query.withFKs = true - query.Where(predicate.Messages(func(s *sql.Selector) { - s.Where(sql.InValues(matchplayer.MessagesColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { + if err := mpq.loadMessages(ctx, query, nodes, + func(n *MatchPlayer) { n.Edges.Messages = []*Messages{} }, + func(n *MatchPlayer, e *Messages) { n.Edges.Messages = append(n.Edges.Messages, e) }); err != nil { return nil, err } - for _, n := range neighbors { - fk := n.match_player_messages - if fk == nil { - return nil, fmt.Errorf(`foreign-key "match_player_messages" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_messages" returned %v for node %v`, *fk, n.ID) - } - node.Edges.Messages = append(node.Edges.Messages, n) + } + return nodes, nil +} + +func (mpq *MatchPlayerQuery) loadMatches(ctx context.Context, query *MatchQuery, nodes []*MatchPlayer, init func(*MatchPlayer), assign func(*MatchPlayer, *Match)) error { + ids := make([]uint64, 0, len(nodes)) + nodeids := make(map[uint64][]*MatchPlayer) + for i := range nodes { + fk := nodes[i].MatchStats + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + query.Where(match.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_stats" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) } } - - return nodes, nil + return nil +} +func (mpq *MatchPlayerQuery) loadPlayers(ctx context.Context, query *PlayerQuery, nodes []*MatchPlayer, init func(*MatchPlayer), assign func(*MatchPlayer, *Player)) error { + ids := make([]uint64, 0, len(nodes)) + nodeids := make(map[uint64][]*MatchPlayer) + for i := range nodes { + fk := nodes[i].PlayerStats + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + query.Where(player.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "player_stats" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (mpq *MatchPlayerQuery) loadWeaponStats(ctx context.Context, query *WeaponQuery, nodes []*MatchPlayer, init func(*MatchPlayer), assign func(*MatchPlayer, *Weapon)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*MatchPlayer) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.Weapon(func(s *sql.Selector) { + s.Where(sql.InValues(matchplayer.WeaponStatsColumn, fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.match_player_weapon_stats + if fk == nil { + return fmt.Errorf(`foreign-key "match_player_weapon_stats" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_weapon_stats" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} +func (mpq *MatchPlayerQuery) loadRoundStats(ctx context.Context, query *RoundStatsQuery, nodes []*MatchPlayer, init func(*MatchPlayer), assign func(*MatchPlayer, *RoundStats)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*MatchPlayer) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.RoundStats(func(s *sql.Selector) { + s.Where(sql.InValues(matchplayer.RoundStatsColumn, fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.match_player_round_stats + if fk == nil { + return fmt.Errorf(`foreign-key "match_player_round_stats" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_round_stats" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} +func (mpq *MatchPlayerQuery) loadSpray(ctx context.Context, query *SprayQuery, nodes []*MatchPlayer, init func(*MatchPlayer), assign func(*MatchPlayer, *Spray)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*MatchPlayer) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.Spray(func(s *sql.Selector) { + s.Where(sql.InValues(matchplayer.SprayColumn, fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.match_player_spray + if fk == nil { + return fmt.Errorf(`foreign-key "match_player_spray" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_spray" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} +func (mpq *MatchPlayerQuery) loadMessages(ctx context.Context, query *MessagesQuery, nodes []*MatchPlayer, init func(*MatchPlayer), assign func(*MatchPlayer, *Messages)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*MatchPlayer) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.Messages(func(s *sql.Selector) { + s.Where(sql.InValues(matchplayer.MessagesColumn, fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.match_player_messages + if fk == nil { + return fmt.Errorf(`foreign-key "match_player_messages" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_messages" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil } func (mpq *MatchPlayerQuery) sqlCount(ctx context.Context) (int, error) { @@ -847,6 +895,7 @@ func (mpq *MatchPlayerQuery) Modify(modifiers ...func(s *sql.Selector)) *MatchPl // MatchPlayerGroupBy is the group-by builder for MatchPlayer entities. type MatchPlayerGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -870,209 +919,6 @@ func (mpgb *MatchPlayerGroupBy) Scan(ctx context.Context, v interface{}) error { return mpgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := mpgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(mpgb.fields) > 1 { - return nil, errors.New("ent: MatchPlayerGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := mpgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) StringsX(ctx context.Context) []string { - v, err := mpgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = mpgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) StringX(ctx context.Context) string { - v, err := mpgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(mpgb.fields) > 1 { - return nil, errors.New("ent: MatchPlayerGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := mpgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) IntsX(ctx context.Context) []int { - v, err := mpgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = mpgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) IntX(ctx context.Context) int { - v, err := mpgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(mpgb.fields) > 1 { - return nil, errors.New("ent: MatchPlayerGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := mpgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := mpgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = mpgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) Float64X(ctx context.Context) float64 { - v, err := mpgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(mpgb.fields) > 1 { - return nil, errors.New("ent: MatchPlayerGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := mpgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) BoolsX(ctx context.Context) []bool { - v, err := mpgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mpgb *MatchPlayerGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = mpgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (mpgb *MatchPlayerGroupBy) BoolX(ctx context.Context) bool { - v, err := mpgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (mpgb *MatchPlayerGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range mpgb.fields { if !matchplayer.ValidColumn(f) { @@ -1114,6 +960,7 @@ func (mpgb *MatchPlayerGroupBy) sqlQuery() *sql.Selector { // MatchPlayerSelect is the builder for selecting fields of MatchPlayer entities. type MatchPlayerSelect struct { *MatchPlayerQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -1127,201 +974,6 @@ func (mps *MatchPlayerSelect) Scan(ctx context.Context, v interface{}) error { return mps.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (mps *MatchPlayerSelect) ScanX(ctx context.Context, v interface{}) { - if err := mps.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) Strings(ctx context.Context) ([]string, error) { - if len(mps.fields) > 1 { - return nil, errors.New("ent: MatchPlayerSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := mps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (mps *MatchPlayerSelect) StringsX(ctx context.Context) []string { - v, err := mps.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = mps.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (mps *MatchPlayerSelect) StringX(ctx context.Context) string { - v, err := mps.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) Ints(ctx context.Context) ([]int, error) { - if len(mps.fields) > 1 { - return nil, errors.New("ent: MatchPlayerSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := mps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (mps *MatchPlayerSelect) IntsX(ctx context.Context) []int { - v, err := mps.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = mps.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (mps *MatchPlayerSelect) IntX(ctx context.Context) int { - v, err := mps.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(mps.fields) > 1 { - return nil, errors.New("ent: MatchPlayerSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := mps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (mps *MatchPlayerSelect) Float64sX(ctx context.Context) []float64 { - v, err := mps.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = mps.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (mps *MatchPlayerSelect) Float64X(ctx context.Context) float64 { - v, err := mps.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) Bools(ctx context.Context) ([]bool, error) { - if len(mps.fields) > 1 { - return nil, errors.New("ent: MatchPlayerSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := mps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (mps *MatchPlayerSelect) BoolsX(ctx context.Context) []bool { - v, err := mps.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (mps *MatchPlayerSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = mps.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{matchplayer.Label} - default: - err = fmt.Errorf("ent: MatchPlayerSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (mps *MatchPlayerSelect) BoolX(ctx context.Context) bool { - v, err := mps.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (mps *MatchPlayerSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} query, args := mps.sql.Query() diff --git a/ent/matchplayer_update.go b/ent/matchplayer_update.go index 30d5873..840ff28 100644 --- a/ent/matchplayer_update.go +++ b/ent/matchplayer_update.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -23,8 +23,9 @@ import ( // MatchPlayerUpdate is the builder for updating MatchPlayer entities. type MatchPlayerUpdate struct { config - hooks []Hook - mutation *MatchPlayerMutation + hooks []Hook + mutation *MatchPlayerMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the MatchPlayerUpdate builder. @@ -1040,6 +1041,12 @@ func (mpu *MatchPlayerUpdate) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (mpu *MatchPlayerUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MatchPlayerUpdate { + mpu.modifiers = append(mpu.modifiers, modifiers...) + return mpu +} + func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -1888,11 +1895,12 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = mpu.modifiers if n, err = sqlgraph.UpdateNodes(ctx, mpu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{matchplayer.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -1902,9 +1910,10 @@ func (mpu *MatchPlayerUpdate) sqlSave(ctx context.Context) (n int, err error) { // MatchPlayerUpdateOne is the builder for updating a single MatchPlayer entity. type MatchPlayerUpdateOne struct { config - fields []string - hooks []Hook - mutation *MatchPlayerMutation + fields []string + hooks []Hook + mutation *MatchPlayerMutation + modifiers []func(*sql.UpdateBuilder) } // SetTeamID sets the "team_id" field. @@ -2882,9 +2891,15 @@ func (mpuo *MatchPlayerUpdateOne) Save(ctx context.Context) (*MatchPlayer, error } mut = mpuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, mpuo.mutation); err != nil { + v, err := mut.Mutate(ctx, mpuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*MatchPlayer) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from MatchPlayerMutation", v) + } + node = nv } return node, err } @@ -2921,6 +2936,12 @@ func (mpuo *MatchPlayerUpdateOne) check() error { return nil } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (mpuo *MatchPlayerUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MatchPlayerUpdateOne { + mpuo.modifiers = append(mpuo.modifiers, modifiers...) + return mpuo +} + func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlayer, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -3786,6 +3807,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = mpuo.modifiers _node = &MatchPlayer{config: mpuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues @@ -3793,7 +3815,7 @@ func (mpuo *MatchPlayerUpdateOne) sqlSave(ctx context.Context) (_node *MatchPlay if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{matchplayer.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/ent/messages.go b/ent/messages.go index 7a2e1fa..87b3930 100644 --- a/ent/messages.go +++ b/ent/messages.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -42,8 +42,7 @@ type MessagesEdges struct { func (e MessagesEdges) MatchPlayerOrErr() (*MatchPlayer, error) { if e.loadedTypes[0] { if e.MatchPlayer == nil { - // The edge match_player was loaded in eager-loading, - // but was not found. + // Edge was loaded but was not found. return nil, &NotFoundError{label: matchplayer.Label} } return e.MatchPlayer, nil @@ -130,11 +129,11 @@ func (m *Messages) Update() *MessagesUpdateOne { // Unwrap unwraps the Messages entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (m *Messages) Unwrap() *Messages { - tx, ok := m.config.driver.(*txDriver) + _tx, ok := m.config.driver.(*txDriver) if !ok { panic("ent: Messages is not a transactional entity") } - m.config.driver = tx.drv + m.config.driver = _tx.drv return m } @@ -142,12 +141,14 @@ func (m *Messages) Unwrap() *Messages { func (m *Messages) String() string { var builder strings.Builder builder.WriteString("Messages(") - builder.WriteString(fmt.Sprintf("id=%v", m.ID)) - builder.WriteString(", message=") + builder.WriteString(fmt.Sprintf("id=%v, ", m.ID)) + builder.WriteString("message=") builder.WriteString(m.Message) - builder.WriteString(", all_chat=") + builder.WriteString(", ") + builder.WriteString("all_chat=") builder.WriteString(fmt.Sprintf("%v", m.AllChat)) - builder.WriteString(", tick=") + builder.WriteString(", ") + builder.WriteString("tick=") builder.WriteString(fmt.Sprintf("%v", m.Tick)) builder.WriteByte(')') return builder.String() diff --git a/ent/messages/messages.go b/ent/messages/messages.go index ac1422b..ee966cd 100644 --- a/ent/messages/messages.go +++ b/ent/messages/messages.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package messages diff --git a/ent/messages/where.go b/ent/messages/where.go index 243663b..598a6c0 100644 --- a/ent/messages/where.go +++ b/ent/messages/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package messages @@ -32,12 +32,6 @@ func IDNEQ(id int) predicate.Messages { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.Messages { return predicate.Messages(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -49,12 +43,6 @@ func IDIn(ids ...int) predicate.Messages { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.Messages { return predicate.Messages(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -133,12 +121,6 @@ func MessageIn(vs ...string) predicate.Messages { v[i] = vs[i] } return predicate.Messages(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldMessage), v...)) }) } @@ -150,12 +132,6 @@ func MessageNotIn(vs ...string) predicate.Messages { v[i] = vs[i] } return predicate.Messages(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldMessage), v...)) }) } @@ -258,12 +234,6 @@ func TickIn(vs ...int) predicate.Messages { v[i] = vs[i] } return predicate.Messages(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldTick), v...)) }) } @@ -275,12 +245,6 @@ func TickNotIn(vs ...int) predicate.Messages { v[i] = vs[i] } return predicate.Messages(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldTick), v...)) }) } diff --git a/ent/messages_create.go b/ent/messages_create.go index cb0d345..0f2b882 100644 --- a/ent/messages_create.go +++ b/ent/messages_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -96,9 +96,15 @@ func (mc *MessagesCreate) Save(ctx context.Context) (*Messages, error) { } mut = mc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, mc.mutation); err != nil { + v, err := mut.Mutate(ctx, mc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Messages) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from MessagesMutation", v) + } + node = nv } return node, err } @@ -143,7 +149,7 @@ func (mc *MessagesCreate) sqlSave(ctx context.Context) (*Messages, error) { _node, _spec := mc.createSpec() if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -242,7 +248,7 @@ func (mcb *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) { // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, mcb.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } } } @@ -250,11 +256,11 @@ func (mcb *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) { return nil, err } mutation.id = &nodes[i].ID - mutation.done = true if specs[i].ID.Value != nil { id := specs[i].ID.Value.(int64) nodes[i].ID = int(id) } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { diff --git a/ent/messages_delete.go b/ent/messages_delete.go index 8596b7a..bfcf44d 100644 --- a/ent/messages_delete.go +++ b/ent/messages_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -84,7 +84,11 @@ func (md *MessagesDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, md.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, md.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // MessagesDeleteOne is the builder for deleting a single Messages entity. diff --git a/ent/messages_query.go b/ent/messages_query.go index f1233e0..7660625 100644 --- a/ent/messages_query.go +++ b/ent/messages_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" - "errors" "fmt" "math" @@ -19,16 +18,15 @@ import ( // MessagesQuery is the builder for querying Messages entities. type MessagesQuery struct { config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Messages - // eager-loading edges. + limit *int + offset *int + unique *bool + order []OrderFunc + fields []string + predicates []predicate.Messages withMatchPlayer *MatchPlayerQuery withFKs bool - modifiers []func(s *sql.Selector) + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -301,17 +299,18 @@ func (mq *MessagesQuery) WithMatchPlayer(opts ...func(*MatchPlayerQuery)) *Messa // GroupBy(messages.FieldMessage). // Aggregate(ent.Count()). // Scan(ctx, &v) -// func (mq *MessagesQuery) GroupBy(field string, fields ...string) *MessagesGroupBy { - group := &MessagesGroupBy{config: mq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &MessagesGroupBy{config: mq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := mq.prepareQuery(ctx); err != nil { return nil, err } return mq.sqlQuery(ctx), nil } - return group + grbuild.label = messages.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -326,10 +325,12 @@ func (mq *MessagesQuery) GroupBy(field string, fields ...string) *MessagesGroupB // client.Messages.Query(). // Select(messages.FieldMessage). // Scan(ctx, &v) -// func (mq *MessagesQuery) Select(fields ...string) *MessagesSelect { mq.fields = append(mq.fields, fields...) - return &MessagesSelect{MessagesQuery: mq} + selbuild := &MessagesSelect{MessagesQuery: mq} + selbuild.label = messages.Label + selbuild.flds, selbuild.scan = &mq.fields, selbuild.Scan + return selbuild } func (mq *MessagesQuery) prepareQuery(ctx context.Context) error { @@ -348,7 +349,7 @@ func (mq *MessagesQuery) prepareQuery(ctx context.Context) error { return nil } -func (mq *MessagesQuery) sqlAll(ctx context.Context) ([]*Messages, error) { +func (mq *MessagesQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Messages, error) { var ( nodes = []*Messages{} withFKs = mq.withFKs @@ -364,58 +365,63 @@ func (mq *MessagesQuery) sqlAll(ctx context.Context) ([]*Messages, error) { _spec.Node.Columns = append(_spec.Node.Columns, messages.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Messages{config: mq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Messages).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Messages{config: mq.config} + nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(mq.modifiers) > 0 { _spec.Modifiers = mq.modifiers } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, mq.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := mq.withMatchPlayer; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*Messages) - for i := range nodes { - if nodes[i].match_player_messages == nil { - continue - } - fk := *nodes[i].match_player_messages - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(matchplayer.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := mq.loadMatchPlayer(ctx, query, nodes, nil, + func(n *Messages, e *MatchPlayer) { n.Edges.MatchPlayer = e }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_messages" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.MatchPlayer = n - } + } + return nodes, nil +} + +func (mq *MessagesQuery) loadMatchPlayer(ctx context.Context, query *MatchPlayerQuery, nodes []*Messages, init func(*Messages), assign func(*Messages, *MatchPlayer)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*Messages) + for i := range nodes { + if nodes[i].match_player_messages == nil { + continue + } + fk := *nodes[i].match_player_messages + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + query.Where(matchplayer.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_messages" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) } } - - return nodes, nil + return nil } func (mq *MessagesQuery) sqlCount(ctx context.Context) (int, error) { @@ -530,6 +536,7 @@ func (mq *MessagesQuery) Modify(modifiers ...func(s *sql.Selector)) *MessagesSel // MessagesGroupBy is the group-by builder for Messages entities. type MessagesGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -553,209 +560,6 @@ func (mgb *MessagesGroupBy) Scan(ctx context.Context, v interface{}) error { return mgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (mgb *MessagesGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := mgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MessagesGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (mgb *MessagesGroupBy) StringsX(ctx context.Context) []string { - v, err := mgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = mgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (mgb *MessagesGroupBy) StringX(ctx context.Context) string { - v, err := mgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MessagesGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (mgb *MessagesGroupBy) IntsX(ctx context.Context) []int { - v, err := mgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = mgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (mgb *MessagesGroupBy) IntX(ctx context.Context) int { - v, err := mgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MessagesGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (mgb *MessagesGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := mgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = mgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (mgb *MessagesGroupBy) Float64X(ctx context.Context) float64 { - v, err := mgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(mgb.fields) > 1 { - return nil, errors.New("ent: MessagesGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := mgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (mgb *MessagesGroupBy) BoolsX(ctx context.Context) []bool { - v, err := mgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (mgb *MessagesGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = mgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (mgb *MessagesGroupBy) BoolX(ctx context.Context) bool { - v, err := mgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (mgb *MessagesGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range mgb.fields { if !messages.ValidColumn(f) { @@ -797,6 +601,7 @@ func (mgb *MessagesGroupBy) sqlQuery() *sql.Selector { // MessagesSelect is the builder for selecting fields of Messages entities. type MessagesSelect struct { *MessagesQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -810,201 +615,6 @@ func (ms *MessagesSelect) Scan(ctx context.Context, v interface{}) error { return ms.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ms *MessagesSelect) ScanX(ctx context.Context, v interface{}) { - if err := ms.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) Strings(ctx context.Context) ([]string, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MessagesSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ms *MessagesSelect) StringsX(ctx context.Context) []string { - v, err := ms.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ms.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ms *MessagesSelect) StringX(ctx context.Context) string { - v, err := ms.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) Ints(ctx context.Context) ([]int, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MessagesSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ms *MessagesSelect) IntsX(ctx context.Context) []int { - v, err := ms.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ms.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ms *MessagesSelect) IntX(ctx context.Context) int { - v, err := ms.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MessagesSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ms *MessagesSelect) Float64sX(ctx context.Context) []float64 { - v, err := ms.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ms.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ms *MessagesSelect) Float64X(ctx context.Context) float64 { - v, err := ms.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ms.fields) > 1 { - return nil, errors.New("ent: MessagesSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ms.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ms *MessagesSelect) BoolsX(ctx context.Context) []bool { - v, err := ms.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ms *MessagesSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ms.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{messages.Label} - default: - err = fmt.Errorf("ent: MessagesSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ms *MessagesSelect) BoolX(ctx context.Context) bool { - v, err := ms.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ms *MessagesSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} query, args := ms.sql.Query() diff --git a/ent/messages_update.go b/ent/messages_update.go index 815d2be..d37ffca 100644 --- a/ent/messages_update.go +++ b/ent/messages_update.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -18,8 +18,9 @@ import ( // MessagesUpdate is the builder for updating Messages entities. type MessagesUpdate struct { config - hooks []Hook - mutation *MessagesMutation + hooks []Hook + mutation *MessagesMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the MessagesUpdate builder. @@ -137,6 +138,12 @@ func (mu *MessagesUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (mu *MessagesUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MessagesUpdate { + mu.modifiers = append(mu.modifiers, modifiers...) + return mu +} + func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -218,11 +225,12 @@ func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = mu.modifiers if n, err = sqlgraph.UpdateNodes(ctx, mu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{messages.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -232,9 +240,10 @@ func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) { // MessagesUpdateOne is the builder for updating a single Messages entity. type MessagesUpdateOne struct { config - fields []string - hooks []Hook - mutation *MessagesMutation + fields []string + hooks []Hook + mutation *MessagesMutation + modifiers []func(*sql.UpdateBuilder) } // SetMessage sets the "message" field. @@ -324,9 +333,15 @@ func (muo *MessagesUpdateOne) Save(ctx context.Context) (*Messages, error) { } mut = muo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, muo.mutation); err != nil { + v, err := mut.Mutate(ctx, muo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Messages) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from MessagesMutation", v) + } + node = nv } return node, err } @@ -353,6 +368,12 @@ func (muo *MessagesUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (muo *MessagesUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MessagesUpdateOne { + muo.modifiers = append(muo.modifiers, modifiers...) + return muo +} + func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -451,6 +472,7 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = muo.modifiers _node = &Messages{config: muo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues @@ -458,7 +480,7 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{messages.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/ent/migrate/migrate.go b/ent/migrate/migrate.go index 9bdaf52..1956a6b 100644 --- a/ent/migrate/migrate.go +++ b/ent/migrate/migrate.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package migrate @@ -28,9 +28,6 @@ var ( // and therefore, it's recommended to enable this option to get more // flexibility in the schema changes. WithDropIndex = schema.WithDropIndex - // WithFixture sets the foreign-key renaming option to the migration when upgrading - // ent from v0.1.0 (issue-#285). Defaults to false. - WithFixture = schema.WithFixture // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true. WithForeignKeys = schema.WithForeignKeys ) @@ -45,27 +42,23 @@ func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} } // Create creates all schema resources. func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error { + return Create(ctx, s, Tables, opts...) +} + +// Create creates all table resources using the given schema driver. +func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error { migrate, err := schema.NewMigrate(s.drv, opts...) if err != nil { return fmt.Errorf("ent/migrate: %w", err) } - return migrate.Create(ctx, Tables...) + return migrate.Create(ctx, tables...) } // WriteTo writes the schema changes to w instead of running them against the database. // -// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil { +// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil { // log.Fatal(err) -// } -// +// } func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error { - drv := &schema.WriteDriver{ - Writer: w, - Driver: s.drv, - } - migrate, err := schema.NewMigrate(drv, opts...) - if err != nil { - return fmt.Errorf("ent/migrate: %w", err) - } - return migrate.Create(ctx, Tables...) + return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...) } diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 68ddfb3..9e6a200 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package migrate diff --git a/ent/mutation.go b/ent/mutation.go index 6e0f935..c052ed6 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent diff --git a/ent/player.go b/ent/player.go index 4171a46..73e8d58 100644 --- a/ent/player.go +++ b/ent/player.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -235,11 +235,11 @@ func (pl *Player) Update() *PlayerUpdateOne { // Unwrap unwraps the Player entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (pl *Player) Unwrap() *Player { - tx, ok := pl.config.driver.(*txDriver) + _tx, ok := pl.config.driver.(*txDriver) if !ok { panic("ent: Player is not a transactional entity") } - pl.config.driver = tx.drv + pl.config.driver = _tx.drv return pl } @@ -247,37 +247,52 @@ func (pl *Player) Unwrap() *Player { func (pl *Player) String() string { var builder strings.Builder builder.WriteString("Player(") - builder.WriteString(fmt.Sprintf("id=%v", pl.ID)) - builder.WriteString(", name=") + builder.WriteString(fmt.Sprintf("id=%v, ", pl.ID)) + builder.WriteString("name=") builder.WriteString(pl.Name) - builder.WriteString(", avatar=") + builder.WriteString(", ") + builder.WriteString("avatar=") builder.WriteString(pl.Avatar) - builder.WriteString(", vanity_url=") + builder.WriteString(", ") + builder.WriteString("vanity_url=") builder.WriteString(pl.VanityURL) - builder.WriteString(", vanity_url_real=") + builder.WriteString(", ") + builder.WriteString("vanity_url_real=") builder.WriteString(pl.VanityURLReal) - builder.WriteString(", vac_date=") + builder.WriteString(", ") + builder.WriteString("vac_date=") builder.WriteString(pl.VacDate.Format(time.ANSIC)) - builder.WriteString(", vac_count=") + builder.WriteString(", ") + builder.WriteString("vac_count=") builder.WriteString(fmt.Sprintf("%v", pl.VacCount)) - builder.WriteString(", game_ban_date=") + builder.WriteString(", ") + builder.WriteString("game_ban_date=") builder.WriteString(pl.GameBanDate.Format(time.ANSIC)) - builder.WriteString(", game_ban_count=") + builder.WriteString(", ") + builder.WriteString("game_ban_count=") builder.WriteString(fmt.Sprintf("%v", pl.GameBanCount)) - builder.WriteString(", steam_updated=") + builder.WriteString(", ") + builder.WriteString("steam_updated=") builder.WriteString(pl.SteamUpdated.Format(time.ANSIC)) - builder.WriteString(", sharecode_updated=") + builder.WriteString(", ") + builder.WriteString("sharecode_updated=") builder.WriteString(pl.SharecodeUpdated.Format(time.ANSIC)) - builder.WriteString(", auth_code=") - builder.WriteString(", profile_created=") + builder.WriteString(", ") + builder.WriteString("auth_code=") + builder.WriteString(", ") + builder.WriteString("profile_created=") builder.WriteString(pl.ProfileCreated.Format(time.ANSIC)) - builder.WriteString(", oldest_sharecode_seen=") + builder.WriteString(", ") + builder.WriteString("oldest_sharecode_seen=") builder.WriteString(pl.OldestSharecodeSeen) - builder.WriteString(", wins=") + builder.WriteString(", ") + builder.WriteString("wins=") builder.WriteString(fmt.Sprintf("%v", pl.Wins)) - builder.WriteString(", looses=") + builder.WriteString(", ") + builder.WriteString("looses=") builder.WriteString(fmt.Sprintf("%v", pl.Looses)) - builder.WriteString(", ties=") + builder.WriteString(", ") + builder.WriteString("ties=") builder.WriteString(fmt.Sprintf("%v", pl.Ties)) builder.WriteByte(')') return builder.String() diff --git a/ent/player/player.go b/ent/player/player.go index 624c149..5cc19fb 100644 --- a/ent/player/player.go +++ b/ent/player/player.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package player diff --git a/ent/player/where.go b/ent/player/where.go index 328afd1..b935329 100644 --- a/ent/player/where.go +++ b/ent/player/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package player @@ -34,12 +34,6 @@ func IDNEQ(id uint64) predicate.Player { // IDIn applies the In predicate on the ID field. func IDIn(ids ...uint64) predicate.Player { return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -51,12 +45,6 @@ func IDIn(ids ...uint64) predicate.Player { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...uint64) predicate.Player { return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -226,12 +214,6 @@ func NameIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldName), v...)) }) } @@ -243,12 +225,6 @@ func NameNotIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldName), v...)) }) } @@ -351,12 +327,6 @@ func AvatarIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldAvatar), v...)) }) } @@ -368,12 +338,6 @@ func AvatarNotIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldAvatar), v...)) }) } @@ -476,12 +440,6 @@ func VanityURLIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldVanityURL), v...)) }) } @@ -493,12 +451,6 @@ func VanityURLNotIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldVanityURL), v...)) }) } @@ -601,12 +553,6 @@ func VanityURLRealIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldVanityURLReal), v...)) }) } @@ -618,12 +564,6 @@ func VanityURLRealNotIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldVanityURLReal), v...)) }) } @@ -726,12 +666,6 @@ func VacDateIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldVacDate), v...)) }) } @@ -743,12 +677,6 @@ func VacDateNotIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldVacDate), v...)) }) } @@ -816,12 +744,6 @@ func VacCountIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldVacCount), v...)) }) } @@ -833,12 +755,6 @@ func VacCountNotIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldVacCount), v...)) }) } @@ -906,12 +822,6 @@ func GameBanDateIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldGameBanDate), v...)) }) } @@ -923,12 +833,6 @@ func GameBanDateNotIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldGameBanDate), v...)) }) } @@ -996,12 +900,6 @@ func GameBanCountIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldGameBanCount), v...)) }) } @@ -1013,12 +911,6 @@ func GameBanCountNotIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldGameBanCount), v...)) }) } @@ -1086,12 +978,6 @@ func SteamUpdatedIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldSteamUpdated), v...)) }) } @@ -1103,12 +989,6 @@ func SteamUpdatedNotIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldSteamUpdated), v...)) }) } @@ -1162,12 +1042,6 @@ func SharecodeUpdatedIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldSharecodeUpdated), v...)) }) } @@ -1179,12 +1053,6 @@ func SharecodeUpdatedNotIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldSharecodeUpdated), v...)) }) } @@ -1252,12 +1120,6 @@ func AuthCodeIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldAuthCode), v...)) }) } @@ -1269,12 +1131,6 @@ func AuthCodeNotIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldAuthCode), v...)) }) } @@ -1377,12 +1233,6 @@ func ProfileCreatedIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldProfileCreated), v...)) }) } @@ -1394,12 +1244,6 @@ func ProfileCreatedNotIn(vs ...time.Time) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldProfileCreated), v...)) }) } @@ -1467,12 +1311,6 @@ func OldestSharecodeSeenIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldOldestSharecodeSeen), v...)) }) } @@ -1484,12 +1322,6 @@ func OldestSharecodeSeenNotIn(vs ...string) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldOldestSharecodeSeen), v...)) }) } @@ -1592,12 +1424,6 @@ func WinsIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldWins), v...)) }) } @@ -1609,12 +1435,6 @@ func WinsNotIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldWins), v...)) }) } @@ -1682,12 +1502,6 @@ func LoosesIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldLooses), v...)) }) } @@ -1699,12 +1513,6 @@ func LoosesNotIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldLooses), v...)) }) } @@ -1772,12 +1580,6 @@ func TiesIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldTies), v...)) }) } @@ -1789,12 +1591,6 @@ func TiesNotIn(vs ...int) predicate.Player { v[i] = vs[i] } return predicate.Player(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldTies), v...)) }) } diff --git a/ent/player_create.go b/ent/player_create.go index a0338a9..9416b7a 100644 --- a/ent/player_create.go +++ b/ent/player_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -322,9 +322,15 @@ func (pc *PlayerCreate) Save(ctx context.Context) (*Player, error) { } mut = pc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, pc.mutation); err != nil { + v, err := mut.Mutate(ctx, pc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Player) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from PlayerMutation", v) + } + node = nv } return node, err } @@ -371,7 +377,7 @@ func (pc *PlayerCreate) sqlSave(ctx context.Context) (*Player, error) { _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -599,7 +605,7 @@ func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) { // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, pcb.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } } } @@ -607,11 +613,11 @@ func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) { return nil, err } mutation.id = &nodes[i].ID - mutation.done = true if specs[i].ID.Value != nil && nodes[i].ID == 0 { id := specs[i].ID.Value.(int64) nodes[i].ID = uint64(id) } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { diff --git a/ent/player_delete.go b/ent/player_delete.go index fd25156..0b371e6 100644 --- a/ent/player_delete.go +++ b/ent/player_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -84,7 +84,11 @@ func (pd *PlayerDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, pd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, pd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // PlayerDeleteOne is the builder for deleting a single Player entity. diff --git a/ent/player_query.go b/ent/player_query.go index b985da9..380ad4f 100644 --- a/ent/player_query.go +++ b/ent/player_query.go @@ -1,11 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" "database/sql/driver" - "errors" "fmt" "math" @@ -21,16 +20,15 @@ import ( // PlayerQuery is the builder for querying Player entities. type PlayerQuery struct { config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Player - // eager-loading edges. + limit *int + offset *int + unique *bool + order []OrderFunc + fields []string + predicates []predicate.Player withStats *MatchPlayerQuery withMatches *MatchQuery - modifiers []func(s *sql.Selector) + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -337,17 +335,18 @@ func (pq *PlayerQuery) WithMatches(opts ...func(*MatchQuery)) *PlayerQuery { // GroupBy(player.FieldName). // Aggregate(ent.Count()). // Scan(ctx, &v) -// func (pq *PlayerQuery) GroupBy(field string, fields ...string) *PlayerGroupBy { - group := &PlayerGroupBy{config: pq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &PlayerGroupBy{config: pq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := pq.prepareQuery(ctx); err != nil { return nil, err } return pq.sqlQuery(ctx), nil } - return group + grbuild.label = player.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -362,10 +361,12 @@ func (pq *PlayerQuery) GroupBy(field string, fields ...string) *PlayerGroupBy { // client.Player.Query(). // Select(player.FieldName). // Scan(ctx, &v) -// func (pq *PlayerQuery) Select(fields ...string) *PlayerSelect { pq.fields = append(pq.fields, fields...) - return &PlayerSelect{PlayerQuery: pq} + selbuild := &PlayerSelect{PlayerQuery: pq} + selbuild.label = player.Label + selbuild.flds, selbuild.scan = &pq.fields, selbuild.Scan + return selbuild } func (pq *PlayerQuery) prepareQuery(ctx context.Context) error { @@ -384,7 +385,7 @@ func (pq *PlayerQuery) prepareQuery(ctx context.Context) error { return nil } -func (pq *PlayerQuery) sqlAll(ctx context.Context) ([]*Player, error) { +func (pq *PlayerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Player, error) { var ( nodes = []*Player{} _spec = pq.querySpec() @@ -394,119 +395,127 @@ func (pq *PlayerQuery) sqlAll(ctx context.Context) ([]*Player, error) { } ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Player{config: pq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Player).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Player{config: pq.config} + nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(pq.modifiers) > 0 { _spec.Modifiers = pq.modifiers } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, pq.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := pq.withStats; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - nodeids := make(map[uint64]*Player) - for i := range nodes { - fks = append(fks, nodes[i].ID) - nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Stats = []*MatchPlayer{} - } - query.Where(predicate.MatchPlayer(func(s *sql.Selector) { - s.Where(sql.InValues(player.StatsColumn, fks...)) - })) - neighbors, err := query.All(ctx) - if err != nil { + if err := pq.loadStats(ctx, query, nodes, + func(n *Player) { n.Edges.Stats = []*MatchPlayer{} }, + func(n *Player, e *MatchPlayer) { n.Edges.Stats = append(n.Edges.Stats, e) }); err != nil { return nil, err } - for _, n := range neighbors { - fk := n.PlayerStats - node, ok := nodeids[fk] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "player_stats" returned %v for node %v`, fk, n.ID) - } - node.Edges.Stats = append(node.Edges.Stats, n) - } } - if query := pq.withMatches; query != nil { - fks := make([]driver.Value, 0, len(nodes)) - ids := make(map[uint64]*Player, len(nodes)) - for _, node := range nodes { - ids[node.ID] = node - fks = append(fks, node.ID) - node.Edges.Matches = []*Match{} - } - var ( - edgeids []uint64 - edges = make(map[uint64][]*Player) - ) - _spec := &sqlgraph.EdgeQuerySpec{ - Edge: &sqlgraph.EdgeSpec{ - Inverse: false, - Table: player.MatchesTable, - Columns: player.MatchesPrimaryKey, - }, - Predicate: func(s *sql.Selector) { - s.Where(sql.InValues(player.MatchesPrimaryKey[0], fks...)) - }, - ScanValues: func() [2]interface{} { - return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} - }, - Assign: func(out, in interface{}) error { - eout, ok := out.(*sql.NullInt64) - if !ok || eout == nil { - return fmt.Errorf("unexpected id value for edge-out") - } - ein, ok := in.(*sql.NullInt64) - if !ok || ein == nil { - return fmt.Errorf("unexpected id value for edge-in") - } - outValue := uint64(eout.Int64) - inValue := uint64(ein.Int64) - node, ok := ids[outValue] - if !ok { - return fmt.Errorf("unexpected node id in edges: %v", outValue) - } - if _, ok := edges[inValue]; !ok { - edgeids = append(edgeids, inValue) - } - edges[inValue] = append(edges[inValue], node) - return nil - }, - } - if err := sqlgraph.QueryEdges(ctx, pq.driver, _spec); err != nil { - return nil, fmt.Errorf(`query edges "matches": %w`, err) - } - query.Where(match.IDIn(edgeids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := pq.loadMatches(ctx, query, nodes, + func(n *Player) { n.Edges.Matches = []*Match{} }, + func(n *Player, e *Match) { n.Edges.Matches = append(n.Edges.Matches, e) }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := edges[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected "matches" node returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Matches = append(nodes[i].Edges.Matches, n) - } + } + return nodes, nil +} + +func (pq *PlayerQuery) loadStats(ctx context.Context, query *MatchPlayerQuery, nodes []*Player, init func(*Player), assign func(*Player, *MatchPlayer)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[uint64]*Player) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) } } - - return nodes, nil + query.Where(predicate.MatchPlayer(func(s *sql.Selector) { + s.Where(sql.InValues(player.StatsColumn, fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + 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) + } + assign(node, n) + } + return nil +} +func (pq *PlayerQuery) loadMatches(ctx context.Context, query *MatchQuery, nodes []*Player, init func(*Player), assign func(*Player, *Match)) error { + edgeIDs := make([]driver.Value, len(nodes)) + byID := make(map[uint64]*Player) + nids := make(map[uint64]map[*Player]struct{}) + for i, node := range nodes { + edgeIDs[i] = node.ID + byID[node.ID] = node + if init != nil { + init(node) + } + } + query.Where(func(s *sql.Selector) { + joinT := sql.Table(player.MatchesTable) + s.Join(joinT).On(s.C(match.FieldID), joinT.C(player.MatchesPrimaryKey[1])) + s.Where(sql.InValues(joinT.C(player.MatchesPrimaryKey[0]), edgeIDs...)) + columns := s.SelectedColumns() + s.Select(joinT.C(player.MatchesPrimaryKey[0])) + s.AppendSelect(columns...) + s.SetDistinct(false) + }) + if err := query.prepareQuery(ctx); err != nil { + return err + } + neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) { + assign := spec.Assign + values := spec.ScanValues + spec.ScanValues = func(columns []string) ([]interface{}, error) { + values, err := values(columns[1:]) + if err != nil { + return nil, err + } + return append([]interface{}{new(sql.NullInt64)}, values...), nil + } + spec.Assign = func(columns []string, values []interface{}) error { + outValue := uint64(values[0].(*sql.NullInt64).Int64) + inValue := uint64(values[1].(*sql.NullInt64).Int64) + if nids[inValue] == nil { + nids[inValue] = map[*Player]struct{}{byID[outValue]: struct{}{}} + return assign(columns[1:], values[1:]) + } + nids[inValue][byID[outValue]] = struct{}{} + return nil + } + }) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nids[n.ID] + if !ok { + return fmt.Errorf(`unexpected "matches" node returned %v`, n.ID) + } + for kn := range nodes { + assign(kn, n) + } + } + return nil } func (pq *PlayerQuery) sqlCount(ctx context.Context) (int, error) { @@ -621,6 +630,7 @@ func (pq *PlayerQuery) Modify(modifiers ...func(s *sql.Selector)) *PlayerSelect // PlayerGroupBy is the group-by builder for Player entities. type PlayerGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -644,209 +654,6 @@ func (pgb *PlayerGroupBy) Scan(ctx context.Context, v interface{}) error { return pgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (pgb *PlayerGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := pgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("ent: PlayerGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (pgb *PlayerGroupBy) StringsX(ctx context.Context) []string { - v, err := pgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = pgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (pgb *PlayerGroupBy) StringX(ctx context.Context) string { - v, err := pgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("ent: PlayerGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (pgb *PlayerGroupBy) IntsX(ctx context.Context) []int { - v, err := pgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = pgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (pgb *PlayerGroupBy) IntX(ctx context.Context) int { - v, err := pgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("ent: PlayerGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (pgb *PlayerGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := pgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = pgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (pgb *PlayerGroupBy) Float64X(ctx context.Context) float64 { - v, err := pgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(pgb.fields) > 1 { - return nil, errors.New("ent: PlayerGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := pgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (pgb *PlayerGroupBy) BoolsX(ctx context.Context) []bool { - v, err := pgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (pgb *PlayerGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = pgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (pgb *PlayerGroupBy) BoolX(ctx context.Context) bool { - v, err := pgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (pgb *PlayerGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range pgb.fields { if !player.ValidColumn(f) { @@ -888,6 +695,7 @@ func (pgb *PlayerGroupBy) sqlQuery() *sql.Selector { // PlayerSelect is the builder for selecting fields of Player entities. type PlayerSelect struct { *PlayerQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -901,201 +709,6 @@ func (ps *PlayerSelect) Scan(ctx context.Context, v interface{}) error { return ps.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ps *PlayerSelect) ScanX(ctx context.Context, v interface{}) { - if err := ps.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) Strings(ctx context.Context) ([]string, error) { - if len(ps.fields) > 1 { - return nil, errors.New("ent: PlayerSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ps *PlayerSelect) StringsX(ctx context.Context) []string { - v, err := ps.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ps.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ps *PlayerSelect) StringX(ctx context.Context) string { - v, err := ps.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) Ints(ctx context.Context) ([]int, error) { - if len(ps.fields) > 1 { - return nil, errors.New("ent: PlayerSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ps *PlayerSelect) IntsX(ctx context.Context) []int { - v, err := ps.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ps.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ps *PlayerSelect) IntX(ctx context.Context) int { - v, err := ps.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ps.fields) > 1 { - return nil, errors.New("ent: PlayerSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ps *PlayerSelect) Float64sX(ctx context.Context) []float64 { - v, err := ps.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ps.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ps *PlayerSelect) Float64X(ctx context.Context) float64 { - v, err := ps.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ps.fields) > 1 { - return nil, errors.New("ent: PlayerSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ps.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ps *PlayerSelect) BoolsX(ctx context.Context) []bool { - v, err := ps.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ps *PlayerSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ps.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{player.Label} - default: - err = fmt.Errorf("ent: PlayerSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ps *PlayerSelect) BoolX(ctx context.Context) bool { - v, err := ps.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ps *PlayerSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} query, args := ps.sql.Query() diff --git a/ent/player_update.go b/ent/player_update.go index dc28bae..9ee1fea 100644 --- a/ent/player_update.go +++ b/ent/player_update.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -20,8 +20,9 @@ import ( // PlayerUpdate is the builder for updating Player entities. type PlayerUpdate struct { config - hooks []Hook - mutation *PlayerMutation + hooks []Hook + mutation *PlayerMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the PlayerUpdate builder. @@ -510,6 +511,12 @@ func (pu *PlayerUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (pu *PlayerUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PlayerUpdate { + pu.modifiers = append(pu.modifiers, modifiers...) + return pu +} + func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -873,11 +880,12 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = pu.modifiers if n, err = sqlgraph.UpdateNodes(ctx, pu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{player.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -887,9 +895,10 @@ func (pu *PlayerUpdate) sqlSave(ctx context.Context) (n int, err error) { // PlayerUpdateOne is the builder for updating a single Player entity. type PlayerUpdateOne struct { config - fields []string - hooks []Hook - mutation *PlayerMutation + fields []string + hooks []Hook + mutation *PlayerMutation + modifiers []func(*sql.UpdateBuilder) } // SetName sets the "name" field. @@ -1350,9 +1359,15 @@ func (puo *PlayerUpdateOne) Save(ctx context.Context) (*Player, error) { } mut = puo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, puo.mutation); err != nil { + v, err := mut.Mutate(ctx, puo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Player) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from PlayerMutation", v) + } + node = nv } return node, err } @@ -1379,6 +1394,12 @@ func (puo *PlayerUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (puo *PlayerUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *PlayerUpdateOne { + puo.modifiers = append(puo.modifiers, modifiers...) + return puo +} + func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -1759,6 +1780,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = puo.modifiers _node = &Player{config: puo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues @@ -1766,7 +1788,7 @@ func (puo *PlayerUpdateOne) sqlSave(ctx context.Context) (_node *Player, err err if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{player.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/ent/predicate/predicate.go b/ent/predicate/predicate.go index 614f3f4..8d84856 100644 --- a/ent/predicate/predicate.go +++ b/ent/predicate/predicate.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package predicate diff --git a/ent/roundstats.go b/ent/roundstats.go index fe61eec..9be4280 100644 --- a/ent/roundstats.go +++ b/ent/roundstats.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -44,8 +44,7 @@ type RoundStatsEdges struct { func (e RoundStatsEdges) MatchPlayerOrErr() (*MatchPlayer, error) { if e.loadedTypes[0] { if e.MatchPlayer == nil { - // The edge match_player was loaded in eager-loading, - // but was not found. + // Edge was loaded but was not found. return nil, &NotFoundError{label: matchplayer.Label} } return e.MatchPlayer, nil @@ -134,11 +133,11 @@ func (rs *RoundStats) Update() *RoundStatsUpdateOne { // Unwrap unwraps the RoundStats entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (rs *RoundStats) Unwrap() *RoundStats { - tx, ok := rs.config.driver.(*txDriver) + _tx, ok := rs.config.driver.(*txDriver) if !ok { panic("ent: RoundStats is not a transactional entity") } - rs.config.driver = tx.drv + rs.config.driver = _tx.drv return rs } @@ -146,14 +145,17 @@ func (rs *RoundStats) Unwrap() *RoundStats { func (rs *RoundStats) String() string { var builder strings.Builder builder.WriteString("RoundStats(") - builder.WriteString(fmt.Sprintf("id=%v", rs.ID)) - builder.WriteString(", round=") + builder.WriteString(fmt.Sprintf("id=%v, ", rs.ID)) + builder.WriteString("round=") builder.WriteString(fmt.Sprintf("%v", rs.Round)) - builder.WriteString(", bank=") + builder.WriteString(", ") + builder.WriteString("bank=") builder.WriteString(fmt.Sprintf("%v", rs.Bank)) - builder.WriteString(", equipment=") + builder.WriteString(", ") + builder.WriteString("equipment=") builder.WriteString(fmt.Sprintf("%v", rs.Equipment)) - builder.WriteString(", spent=") + builder.WriteString(", ") + builder.WriteString("spent=") builder.WriteString(fmt.Sprintf("%v", rs.Spent)) builder.WriteByte(')') return builder.String() diff --git a/ent/roundstats/roundstats.go b/ent/roundstats/roundstats.go index ef71737..85f892a 100644 --- a/ent/roundstats/roundstats.go +++ b/ent/roundstats/roundstats.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package roundstats diff --git a/ent/roundstats/where.go b/ent/roundstats/where.go index 0ca17f4..4177c7f 100644 --- a/ent/roundstats/where.go +++ b/ent/roundstats/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package roundstats @@ -32,12 +32,6 @@ func IDNEQ(id int) predicate.RoundStats { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.RoundStats { return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -49,12 +43,6 @@ func IDIn(ids ...int) predicate.RoundStats { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.RoundStats { return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -140,12 +128,6 @@ func RoundIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldRound), v...)) }) } @@ -157,12 +139,6 @@ func RoundNotIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldRound), v...)) }) } @@ -216,12 +192,6 @@ func BankIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldBank), v...)) }) } @@ -233,12 +203,6 @@ func BankNotIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldBank), v...)) }) } @@ -292,12 +256,6 @@ func EquipmentIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldEquipment), v...)) }) } @@ -309,12 +267,6 @@ func EquipmentNotIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldEquipment), v...)) }) } @@ -368,12 +320,6 @@ func SpentIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldSpent), v...)) }) } @@ -385,12 +331,6 @@ func SpentNotIn(vs ...uint) predicate.RoundStats { v[i] = vs[i] } return predicate.RoundStats(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldSpent), v...)) }) } diff --git a/ent/roundstats_create.go b/ent/roundstats_create.go index 1603294..4e40675 100644 --- a/ent/roundstats_create.go +++ b/ent/roundstats_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -102,9 +102,15 @@ func (rsc *RoundStatsCreate) Save(ctx context.Context) (*RoundStats, error) { } mut = rsc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, rsc.mutation); err != nil { + v, err := mut.Mutate(ctx, rsc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*RoundStats) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from RoundStatsMutation", v) + } + node = nv } return node, err } @@ -152,7 +158,7 @@ func (rsc *RoundStatsCreate) sqlSave(ctx context.Context) (*RoundStats, error) { _node, _spec := rsc.createSpec() if err := sqlgraph.CreateNode(ctx, rsc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -259,7 +265,7 @@ func (rscb *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, erro // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, rscb.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } } } @@ -267,11 +273,11 @@ func (rscb *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, erro return nil, err } mutation.id = &nodes[i].ID - mutation.done = true if specs[i].ID.Value != nil { id := specs[i].ID.Value.(int64) nodes[i].ID = int(id) } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { diff --git a/ent/roundstats_delete.go b/ent/roundstats_delete.go index 0b0db72..4094fa6 100644 --- a/ent/roundstats_delete.go +++ b/ent/roundstats_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -84,7 +84,11 @@ func (rsd *RoundStatsDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, rsd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, rsd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // RoundStatsDeleteOne is the builder for deleting a single RoundStats entity. diff --git a/ent/roundstats_query.go b/ent/roundstats_query.go index dad732e..33d4bc9 100644 --- a/ent/roundstats_query.go +++ b/ent/roundstats_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" - "errors" "fmt" "math" @@ -19,16 +18,15 @@ import ( // RoundStatsQuery is the builder for querying RoundStats entities. type RoundStatsQuery struct { config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.RoundStats - // eager-loading edges. + limit *int + offset *int + unique *bool + order []OrderFunc + fields []string + predicates []predicate.RoundStats withMatchPlayer *MatchPlayerQuery withFKs bool - modifiers []func(s *sql.Selector) + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -301,17 +299,18 @@ func (rsq *RoundStatsQuery) WithMatchPlayer(opts ...func(*MatchPlayerQuery)) *Ro // GroupBy(roundstats.FieldRound). // Aggregate(ent.Count()). // Scan(ctx, &v) -// func (rsq *RoundStatsQuery) GroupBy(field string, fields ...string) *RoundStatsGroupBy { - group := &RoundStatsGroupBy{config: rsq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &RoundStatsGroupBy{config: rsq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := rsq.prepareQuery(ctx); err != nil { return nil, err } return rsq.sqlQuery(ctx), nil } - return group + grbuild.label = roundstats.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -326,10 +325,12 @@ func (rsq *RoundStatsQuery) GroupBy(field string, fields ...string) *RoundStatsG // client.RoundStats.Query(). // Select(roundstats.FieldRound). // Scan(ctx, &v) -// func (rsq *RoundStatsQuery) Select(fields ...string) *RoundStatsSelect { rsq.fields = append(rsq.fields, fields...) - return &RoundStatsSelect{RoundStatsQuery: rsq} + selbuild := &RoundStatsSelect{RoundStatsQuery: rsq} + selbuild.label = roundstats.Label + selbuild.flds, selbuild.scan = &rsq.fields, selbuild.Scan + return selbuild } func (rsq *RoundStatsQuery) prepareQuery(ctx context.Context) error { @@ -348,7 +349,7 @@ func (rsq *RoundStatsQuery) prepareQuery(ctx context.Context) error { return nil } -func (rsq *RoundStatsQuery) sqlAll(ctx context.Context) ([]*RoundStats, error) { +func (rsq *RoundStatsQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*RoundStats, error) { var ( nodes = []*RoundStats{} withFKs = rsq.withFKs @@ -364,58 +365,63 @@ func (rsq *RoundStatsQuery) sqlAll(ctx context.Context) ([]*RoundStats, error) { _spec.Node.Columns = append(_spec.Node.Columns, roundstats.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &RoundStats{config: rsq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*RoundStats).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &RoundStats{config: rsq.config} + nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(rsq.modifiers) > 0 { _spec.Modifiers = rsq.modifiers } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, rsq.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := rsq.withMatchPlayer; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*RoundStats) - for i := range nodes { - if nodes[i].match_player_round_stats == nil { - continue - } - fk := *nodes[i].match_player_round_stats - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(matchplayer.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := rsq.loadMatchPlayer(ctx, query, nodes, nil, + func(n *RoundStats, e *MatchPlayer) { n.Edges.MatchPlayer = e }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_round_stats" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.MatchPlayer = n - } + } + return nodes, nil +} + +func (rsq *RoundStatsQuery) loadMatchPlayer(ctx context.Context, query *MatchPlayerQuery, nodes []*RoundStats, init func(*RoundStats), assign func(*RoundStats, *MatchPlayer)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*RoundStats) + for i := range nodes { + if nodes[i].match_player_round_stats == nil { + continue + } + fk := *nodes[i].match_player_round_stats + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + query.Where(matchplayer.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_round_stats" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) } } - - return nodes, nil + return nil } func (rsq *RoundStatsQuery) sqlCount(ctx context.Context) (int, error) { @@ -530,6 +536,7 @@ func (rsq *RoundStatsQuery) Modify(modifiers ...func(s *sql.Selector)) *RoundSta // RoundStatsGroupBy is the group-by builder for RoundStats entities. type RoundStatsGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -553,209 +560,6 @@ func (rsgb *RoundStatsGroupBy) Scan(ctx context.Context, v interface{}) error { return rsgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := rsgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(rsgb.fields) > 1 { - return nil, errors.New("ent: RoundStatsGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := rsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) StringsX(ctx context.Context) []string { - v, err := rsgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rsgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) StringX(ctx context.Context) string { - v, err := rsgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(rsgb.fields) > 1 { - return nil, errors.New("ent: RoundStatsGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := rsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) IntsX(ctx context.Context) []int { - v, err := rsgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rsgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) IntX(ctx context.Context) int { - v, err := rsgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(rsgb.fields) > 1 { - return nil, errors.New("ent: RoundStatsGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := rsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := rsgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rsgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) Float64X(ctx context.Context) float64 { - v, err := rsgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(rsgb.fields) > 1 { - return nil, errors.New("ent: RoundStatsGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := rsgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) BoolsX(ctx context.Context) []bool { - v, err := rsgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (rsgb *RoundStatsGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rsgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rsgb *RoundStatsGroupBy) BoolX(ctx context.Context) bool { - v, err := rsgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (rsgb *RoundStatsGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range rsgb.fields { if !roundstats.ValidColumn(f) { @@ -797,6 +601,7 @@ func (rsgb *RoundStatsGroupBy) sqlQuery() *sql.Selector { // RoundStatsSelect is the builder for selecting fields of RoundStats entities. type RoundStatsSelect struct { *RoundStatsQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -810,201 +615,6 @@ func (rss *RoundStatsSelect) Scan(ctx context.Context, v interface{}) error { return rss.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (rss *RoundStatsSelect) ScanX(ctx context.Context, v interface{}) { - if err := rss.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) Strings(ctx context.Context) ([]string, error) { - if len(rss.fields) > 1 { - return nil, errors.New("ent: RoundStatsSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := rss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (rss *RoundStatsSelect) StringsX(ctx context.Context) []string { - v, err := rss.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = rss.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (rss *RoundStatsSelect) StringX(ctx context.Context) string { - v, err := rss.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) Ints(ctx context.Context) ([]int, error) { - if len(rss.fields) > 1 { - return nil, errors.New("ent: RoundStatsSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := rss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (rss *RoundStatsSelect) IntsX(ctx context.Context) []int { - v, err := rss.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = rss.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (rss *RoundStatsSelect) IntX(ctx context.Context) int { - v, err := rss.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(rss.fields) > 1 { - return nil, errors.New("ent: RoundStatsSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := rss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (rss *RoundStatsSelect) Float64sX(ctx context.Context) []float64 { - v, err := rss.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = rss.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (rss *RoundStatsSelect) Float64X(ctx context.Context) float64 { - v, err := rss.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) Bools(ctx context.Context) ([]bool, error) { - if len(rss.fields) > 1 { - return nil, errors.New("ent: RoundStatsSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := rss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (rss *RoundStatsSelect) BoolsX(ctx context.Context) []bool { - v, err := rss.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (rss *RoundStatsSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = rss.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{roundstats.Label} - default: - err = fmt.Errorf("ent: RoundStatsSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (rss *RoundStatsSelect) BoolX(ctx context.Context) bool { - v, err := rss.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (rss *RoundStatsSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} query, args := rss.sql.Query() diff --git a/ent/roundstats_update.go b/ent/roundstats_update.go index f4a21a6..ff77c4c 100644 --- a/ent/roundstats_update.go +++ b/ent/roundstats_update.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -18,8 +18,9 @@ import ( // RoundStatsUpdate is the builder for updating RoundStats entities. type RoundStatsUpdate struct { config - hooks []Hook - mutation *RoundStatsMutation + hooks []Hook + mutation *RoundStatsMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the RoundStatsUpdate builder. @@ -164,6 +165,12 @@ func (rsu *RoundStatsUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (rsu *RoundStatsUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdate { + rsu.modifiers = append(rsu.modifiers, modifiers...) + return rsu +} + func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -273,11 +280,12 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = rsu.modifiers if n, err = sqlgraph.UpdateNodes(ctx, rsu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{roundstats.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -287,9 +295,10 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) { // RoundStatsUpdateOne is the builder for updating a single RoundStats entity. type RoundStatsUpdateOne struct { config - fields []string - hooks []Hook - mutation *RoundStatsMutation + fields []string + hooks []Hook + mutation *RoundStatsMutation + modifiers []func(*sql.UpdateBuilder) } // SetRound sets the "round" field. @@ -406,9 +415,15 @@ func (rsuo *RoundStatsUpdateOne) Save(ctx context.Context) (*RoundStats, error) } mut = rsuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, rsuo.mutation); err != nil { + v, err := mut.Mutate(ctx, rsuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*RoundStats) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from RoundStatsMutation", v) + } + node = nv } return node, err } @@ -435,6 +450,12 @@ func (rsuo *RoundStatsUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (rsuo *RoundStatsUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdateOne { + rsuo.modifiers = append(rsuo.modifiers, modifiers...) + return rsuo +} + func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -561,6 +582,7 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = rsuo.modifiers _node = &RoundStats{config: rsuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues @@ -568,7 +590,7 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{roundstats.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/ent/runtime.go b/ent/runtime.go index 6881139..f99d81e 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent diff --git a/ent/runtime/runtime.go b/ent/runtime/runtime.go index 7f27e35..a3fd1c1 100644 --- a/ent/runtime/runtime.go +++ b/ent/runtime/runtime.go @@ -1,10 +1,10 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package runtime // The schema-stitching logic is generated in git.harting.dev/csgowtf/csgowtfd/ent/runtime.go const ( - Version = "v0.10.1" // Version of ent codegen. - Sum = "h1:dM5h4Zk6yHGIgw4dCqVzGw3nWgpGYJiV4/kyHEF6PFo=" // Sum of ent codegen. + Version = "v0.11.2" // Version of ent codegen. + Sum = "h1:UM2/BUhF2FfsxPHRxLjQbhqJNaDdVlOwNIAMLs2jyto=" // Sum of ent codegen. ) diff --git a/ent/spray.go b/ent/spray.go index bd93c3c..cd0040e 100644 --- a/ent/spray.go +++ b/ent/spray.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -40,8 +40,7 @@ type SprayEdges struct { func (e SprayEdges) MatchPlayersOrErr() (*MatchPlayer, error) { if e.loadedTypes[0] { if e.MatchPlayers == nil { - // The edge match_players was loaded in eager-loading, - // but was not found. + // Edge was loaded but was not found. return nil, &NotFoundError{label: matchplayer.Label} } return e.MatchPlayers, nil @@ -120,11 +119,11 @@ func (s *Spray) Update() *SprayUpdateOne { // Unwrap unwraps the Spray entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (s *Spray) Unwrap() *Spray { - tx, ok := s.config.driver.(*txDriver) + _tx, ok := s.config.driver.(*txDriver) if !ok { panic("ent: Spray is not a transactional entity") } - s.config.driver = tx.drv + s.config.driver = _tx.drv return s } @@ -132,10 +131,11 @@ func (s *Spray) Unwrap() *Spray { func (s *Spray) String() string { var builder strings.Builder builder.WriteString("Spray(") - builder.WriteString(fmt.Sprintf("id=%v", s.ID)) - builder.WriteString(", weapon=") + builder.WriteString(fmt.Sprintf("id=%v, ", s.ID)) + builder.WriteString("weapon=") builder.WriteString(fmt.Sprintf("%v", s.Weapon)) - builder.WriteString(", spray=") + builder.WriteString(", ") + builder.WriteString("spray=") builder.WriteString(fmt.Sprintf("%v", s.Spray)) builder.WriteByte(')') return builder.String() diff --git a/ent/spray/spray.go b/ent/spray/spray.go index 86c4a0f..c0eef89 100644 --- a/ent/spray/spray.go +++ b/ent/spray/spray.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package spray diff --git a/ent/spray/where.go b/ent/spray/where.go index 1066896..fc0909e 100644 --- a/ent/spray/where.go +++ b/ent/spray/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package spray @@ -32,12 +32,6 @@ func IDNEQ(id int) predicate.Spray { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.Spray { return predicate.Spray(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -49,12 +43,6 @@ func IDIn(ids ...int) predicate.Spray { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.Spray { return predicate.Spray(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -126,12 +114,6 @@ func WeaponIn(vs ...int) predicate.Spray { v[i] = vs[i] } return predicate.Spray(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldWeapon), v...)) }) } @@ -143,12 +125,6 @@ func WeaponNotIn(vs ...int) predicate.Spray { v[i] = vs[i] } return predicate.Spray(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldWeapon), v...)) }) } @@ -202,12 +178,6 @@ func SprayIn(vs ...[]byte) predicate.Spray { v[i] = vs[i] } return predicate.Spray(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldSpray), v...)) }) } @@ -219,12 +189,6 @@ func SprayNotIn(vs ...[]byte) predicate.Spray { v[i] = vs[i] } return predicate.Spray(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldSpray), v...)) }) } diff --git a/ent/spray_create.go b/ent/spray_create.go index 2124dc3..6b8bad4 100644 --- a/ent/spray_create.go +++ b/ent/spray_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -90,9 +90,15 @@ func (sc *SprayCreate) Save(ctx context.Context) (*Spray, error) { } mut = sc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, sc.mutation); err != nil { + v, err := mut.Mutate(ctx, sc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Spray) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from SprayMutation", v) + } + node = nv } return node, err } @@ -134,7 +140,7 @@ func (sc *SprayCreate) sqlSave(ctx context.Context) (*Spray, error) { _node, _spec := sc.createSpec() if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -225,7 +231,7 @@ func (scb *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) { // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, scb.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } } } @@ -233,11 +239,11 @@ func (scb *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) { return nil, err } mutation.id = &nodes[i].ID - mutation.done = true if specs[i].ID.Value != nil { id := specs[i].ID.Value.(int64) nodes[i].ID = int(id) } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { diff --git a/ent/spray_delete.go b/ent/spray_delete.go index d52bb4b..08ddf87 100644 --- a/ent/spray_delete.go +++ b/ent/spray_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -84,7 +84,11 @@ func (sd *SprayDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, sd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, sd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // SprayDeleteOne is the builder for deleting a single Spray entity. diff --git a/ent/spray_query.go b/ent/spray_query.go index fe6509b..4ce1ff3 100644 --- a/ent/spray_query.go +++ b/ent/spray_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" - "errors" "fmt" "math" @@ -19,16 +18,15 @@ import ( // SprayQuery is the builder for querying Spray entities. type SprayQuery struct { config - limit *int - offset *int - unique *bool - order []OrderFunc - fields []string - predicates []predicate.Spray - // eager-loading edges. + limit *int + offset *int + unique *bool + order []OrderFunc + fields []string + predicates []predicate.Spray withMatchPlayers *MatchPlayerQuery withFKs bool - modifiers []func(s *sql.Selector) + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -301,17 +299,18 @@ func (sq *SprayQuery) WithMatchPlayers(opts ...func(*MatchPlayerQuery)) *SprayQu // GroupBy(spray.FieldWeapon). // Aggregate(ent.Count()). // Scan(ctx, &v) -// func (sq *SprayQuery) GroupBy(field string, fields ...string) *SprayGroupBy { - group := &SprayGroupBy{config: sq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &SprayGroupBy{config: sq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := sq.prepareQuery(ctx); err != nil { return nil, err } return sq.sqlQuery(ctx), nil } - return group + grbuild.label = spray.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -326,10 +325,12 @@ func (sq *SprayQuery) GroupBy(field string, fields ...string) *SprayGroupBy { // client.Spray.Query(). // Select(spray.FieldWeapon). // Scan(ctx, &v) -// func (sq *SprayQuery) Select(fields ...string) *SpraySelect { sq.fields = append(sq.fields, fields...) - return &SpraySelect{SprayQuery: sq} + selbuild := &SpraySelect{SprayQuery: sq} + selbuild.label = spray.Label + selbuild.flds, selbuild.scan = &sq.fields, selbuild.Scan + return selbuild } func (sq *SprayQuery) prepareQuery(ctx context.Context) error { @@ -348,7 +349,7 @@ func (sq *SprayQuery) prepareQuery(ctx context.Context) error { return nil } -func (sq *SprayQuery) sqlAll(ctx context.Context) ([]*Spray, error) { +func (sq *SprayQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Spray, error) { var ( nodes = []*Spray{} withFKs = sq.withFKs @@ -364,58 +365,63 @@ func (sq *SprayQuery) sqlAll(ctx context.Context) ([]*Spray, error) { _spec.Node.Columns = append(_spec.Node.Columns, spray.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Spray{config: sq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Spray).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Spray{config: sq.config} + nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(sq.modifiers) > 0 { _spec.Modifiers = sq.modifiers } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, sq.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := sq.withMatchPlayers; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*Spray) - for i := range nodes { - if nodes[i].match_player_spray == nil { - continue - } - fk := *nodes[i].match_player_spray - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(matchplayer.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := sq.loadMatchPlayers(ctx, query, nodes, nil, + func(n *Spray, e *MatchPlayer) { n.Edges.MatchPlayers = e }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_spray" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.MatchPlayers = n - } + } + return nodes, nil +} + +func (sq *SprayQuery) loadMatchPlayers(ctx context.Context, query *MatchPlayerQuery, nodes []*Spray, init func(*Spray), assign func(*Spray, *MatchPlayer)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*Spray) + for i := range nodes { + if nodes[i].match_player_spray == nil { + continue + } + fk := *nodes[i].match_player_spray + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + query.Where(matchplayer.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_spray" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) } } - - return nodes, nil + return nil } func (sq *SprayQuery) sqlCount(ctx context.Context) (int, error) { @@ -530,6 +536,7 @@ func (sq *SprayQuery) Modify(modifiers ...func(s *sql.Selector)) *SpraySelect { // SprayGroupBy is the group-by builder for Spray entities. type SprayGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -553,209 +560,6 @@ func (sgb *SprayGroupBy) Scan(ctx context.Context, v interface{}) error { return sgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (sgb *SprayGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := sgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SprayGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (sgb *SprayGroupBy) StringsX(ctx context.Context) []string { - v, err := sgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = sgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SprayGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (sgb *SprayGroupBy) StringX(ctx context.Context) string { - v, err := sgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SprayGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (sgb *SprayGroupBy) IntsX(ctx context.Context) []int { - v, err := sgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = sgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SprayGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (sgb *SprayGroupBy) IntX(ctx context.Context) int { - v, err := sgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SprayGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (sgb *SprayGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := sgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = sgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SprayGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (sgb *SprayGroupBy) Float64X(ctx context.Context) float64 { - v, err := sgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(sgb.fields) > 1 { - return nil, errors.New("ent: SprayGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := sgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (sgb *SprayGroupBy) BoolsX(ctx context.Context) []bool { - v, err := sgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (sgb *SprayGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = sgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SprayGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (sgb *SprayGroupBy) BoolX(ctx context.Context) bool { - v, err := sgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (sgb *SprayGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range sgb.fields { if !spray.ValidColumn(f) { @@ -797,6 +601,7 @@ func (sgb *SprayGroupBy) sqlQuery() *sql.Selector { // SpraySelect is the builder for selecting fields of Spray entities. type SpraySelect struct { *SprayQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -810,201 +615,6 @@ func (ss *SpraySelect) Scan(ctx context.Context, v interface{}) error { return ss.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ss *SpraySelect) ScanX(ctx context.Context, v interface{}) { - if err := ss.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) Strings(ctx context.Context) ([]string, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SpraySelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ss *SpraySelect) StringsX(ctx context.Context) []string { - v, err := ss.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ss.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SpraySelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ss *SpraySelect) StringX(ctx context.Context) string { - v, err := ss.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) Ints(ctx context.Context) ([]int, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SpraySelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ss *SpraySelect) IntsX(ctx context.Context) []int { - v, err := ss.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ss.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SpraySelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ss *SpraySelect) IntX(ctx context.Context) int { - v, err := ss.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SpraySelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ss *SpraySelect) Float64sX(ctx context.Context) []float64 { - v, err := ss.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ss.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SpraySelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ss *SpraySelect) Float64X(ctx context.Context) float64 { - v, err := ss.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) Bools(ctx context.Context) ([]bool, error) { - if len(ss.fields) > 1 { - return nil, errors.New("ent: SpraySelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ss.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ss *SpraySelect) BoolsX(ctx context.Context) []bool { - v, err := ss.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ss *SpraySelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ss.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{spray.Label} - default: - err = fmt.Errorf("ent: SpraySelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ss *SpraySelect) BoolX(ctx context.Context) bool { - v, err := ss.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ss *SpraySelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} query, args := ss.sql.Query() diff --git a/ent/spray_update.go b/ent/spray_update.go index 0bdd913..2c205b7 100644 --- a/ent/spray_update.go +++ b/ent/spray_update.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -18,8 +18,9 @@ import ( // SprayUpdate is the builder for updating Spray entities. type SprayUpdate struct { config - hooks []Hook - mutation *SprayMutation + hooks []Hook + mutation *SprayMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the SprayUpdate builder. @@ -131,6 +132,12 @@ func (su *SprayUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (su *SprayUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SprayUpdate { + su.modifiers = append(su.modifiers, modifiers...) + return su +} + func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -205,11 +212,12 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = su.modifiers if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{spray.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -219,9 +227,10 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) { // SprayUpdateOne is the builder for updating a single Spray entity. type SprayUpdateOne struct { config - fields []string - hooks []Hook - mutation *SprayMutation + fields []string + hooks []Hook + mutation *SprayMutation + modifiers []func(*sql.UpdateBuilder) } // SetWeapon sets the "weapon" field. @@ -305,9 +314,15 @@ func (suo *SprayUpdateOne) Save(ctx context.Context) (*Spray, error) { } mut = suo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, suo.mutation); err != nil { + v, err := mut.Mutate(ctx, suo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Spray) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from SprayMutation", v) + } + node = nv } return node, err } @@ -334,6 +349,12 @@ func (suo *SprayUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (suo *SprayUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SprayUpdateOne { + suo.modifiers = append(suo.modifiers, modifiers...) + return suo +} + func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -425,6 +446,7 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = suo.modifiers _node = &Spray{config: suo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues @@ -432,7 +454,7 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{spray.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/ent/tx.go b/ent/tx.go index 455b1a9..30bea34 100644 --- a/ent/tx.go +++ b/ent/tx.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent diff --git a/ent/weapon.go b/ent/weapon.go index 7641a18..e806b02 100644 --- a/ent/weapon.go +++ b/ent/weapon.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -44,8 +44,7 @@ type WeaponEdges struct { func (e WeaponEdges) StatOrErr() (*MatchPlayer, error) { if e.loadedTypes[0] { if e.Stat == nil { - // The edge stat was loaded in eager-loading, - // but was not found. + // Edge was loaded but was not found. return nil, &NotFoundError{label: matchplayer.Label} } return e.Stat, nil @@ -134,11 +133,11 @@ func (w *Weapon) Update() *WeaponUpdateOne { // Unwrap unwraps the Weapon entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (w *Weapon) Unwrap() *Weapon { - tx, ok := w.config.driver.(*txDriver) + _tx, ok := w.config.driver.(*txDriver) if !ok { panic("ent: Weapon is not a transactional entity") } - w.config.driver = tx.drv + w.config.driver = _tx.drv return w } @@ -146,14 +145,17 @@ func (w *Weapon) Unwrap() *Weapon { func (w *Weapon) String() string { var builder strings.Builder builder.WriteString("Weapon(") - builder.WriteString(fmt.Sprintf("id=%v", w.ID)) - builder.WriteString(", victim=") + builder.WriteString(fmt.Sprintf("id=%v, ", w.ID)) + builder.WriteString("victim=") builder.WriteString(fmt.Sprintf("%v", w.Victim)) - builder.WriteString(", dmg=") + builder.WriteString(", ") + builder.WriteString("dmg=") builder.WriteString(fmt.Sprintf("%v", w.Dmg)) - builder.WriteString(", eq_type=") + builder.WriteString(", ") + builder.WriteString("eq_type=") builder.WriteString(fmt.Sprintf("%v", w.EqType)) - builder.WriteString(", hit_group=") + builder.WriteString(", ") + builder.WriteString("hit_group=") builder.WriteString(fmt.Sprintf("%v", w.HitGroup)) builder.WriteByte(')') return builder.String() diff --git a/ent/weapon/weapon.go b/ent/weapon/weapon.go index 4643f8b..946ec31 100644 --- a/ent/weapon/weapon.go +++ b/ent/weapon/weapon.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package weapon diff --git a/ent/weapon/where.go b/ent/weapon/where.go index a679911..317e9b5 100644 --- a/ent/weapon/where.go +++ b/ent/weapon/where.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package weapon @@ -32,12 +32,6 @@ func IDNEQ(id int) predicate.Weapon { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.Weapon { return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -49,12 +43,6 @@ func IDIn(ids ...int) predicate.Weapon { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.Weapon { return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(ids) == 0 { - s.Where(sql.False()) - return - } v := make([]interface{}, len(ids)) for i := range v { v[i] = ids[i] @@ -140,12 +128,6 @@ func VictimIn(vs ...uint64) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldVictim), v...)) }) } @@ -157,12 +139,6 @@ func VictimNotIn(vs ...uint64) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldVictim), v...)) }) } @@ -216,12 +192,6 @@ func DmgIn(vs ...uint) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldDmg), v...)) }) } @@ -233,12 +203,6 @@ func DmgNotIn(vs ...uint) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldDmg), v...)) }) } @@ -292,12 +256,6 @@ func EqTypeIn(vs ...int) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldEqType), v...)) }) } @@ -309,12 +267,6 @@ func EqTypeNotIn(vs ...int) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldEqType), v...)) }) } @@ -368,12 +320,6 @@ func HitGroupIn(vs ...int) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.In(s.C(FieldHitGroup), v...)) }) } @@ -385,12 +331,6 @@ func HitGroupNotIn(vs ...int) predicate.Weapon { v[i] = vs[i] } return predicate.Weapon(func(s *sql.Selector) { - // if not arguments were provided, append the FALSE constants, - // since we can't apply "IN ()". This will make this predicate falsy. - if len(v) == 0 { - s.Where(sql.False()) - return - } s.Where(sql.NotIn(s.C(FieldHitGroup), v...)) }) } diff --git a/ent/weapon_create.go b/ent/weapon_create.go index 967dfc6..8bf8636 100644 --- a/ent/weapon_create.go +++ b/ent/weapon_create.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -102,9 +102,15 @@ func (wc *WeaponCreate) Save(ctx context.Context) (*Weapon, error) { } mut = wc.hooks[i](mut) } - if _, err := mut.Mutate(ctx, wc.mutation); err != nil { + v, err := mut.Mutate(ctx, wc.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Weapon) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from WeaponMutation", v) + } + node = nv } return node, err } @@ -152,7 +158,7 @@ func (wc *WeaponCreate) sqlSave(ctx context.Context) (*Weapon, error) { _node, _spec := wc.createSpec() if err := sqlgraph.CreateNode(ctx, wc.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } @@ -259,7 +265,7 @@ func (wcb *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) { // Invoke the actual operation on the latest mutation in the chain. if err = sqlgraph.BatchCreate(ctx, wcb.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } } } @@ -267,11 +273,11 @@ func (wcb *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) { return nil, err } mutation.id = &nodes[i].ID - mutation.done = true if specs[i].ID.Value != nil { id := specs[i].ID.Value.(int64) nodes[i].ID = int(id) } + mutation.done = true return nodes[i], nil }) for i := len(builder.hooks) - 1; i >= 0; i-- { diff --git a/ent/weapon_delete.go b/ent/weapon_delete.go index a9d0c39..512097e 100644 --- a/ent/weapon_delete.go +++ b/ent/weapon_delete.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -84,7 +84,11 @@ func (wd *WeaponDelete) sqlExec(ctx context.Context) (int, error) { } } } - return sqlgraph.DeleteNodes(ctx, wd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, wd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return affected, err } // WeaponDeleteOne is the builder for deleting a single Weapon entity. diff --git a/ent/weapon_query.go b/ent/weapon_query.go index 55692ea..e3a059f 100644 --- a/ent/weapon_query.go +++ b/ent/weapon_query.go @@ -1,10 +1,9 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent import ( "context" - "errors" "fmt" "math" @@ -25,10 +24,9 @@ type WeaponQuery struct { order []OrderFunc fields []string predicates []predicate.Weapon - // eager-loading edges. - withStat *MatchPlayerQuery - withFKs bool - modifiers []func(s *sql.Selector) + withStat *MatchPlayerQuery + withFKs bool + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -301,17 +299,18 @@ func (wq *WeaponQuery) WithStat(opts ...func(*MatchPlayerQuery)) *WeaponQuery { // GroupBy(weapon.FieldVictim). // Aggregate(ent.Count()). // Scan(ctx, &v) -// func (wq *WeaponQuery) GroupBy(field string, fields ...string) *WeaponGroupBy { - group := &WeaponGroupBy{config: wq.config} - group.fields = append([]string{field}, fields...) - group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + grbuild := &WeaponGroupBy{config: wq.config} + grbuild.fields = append([]string{field}, fields...) + grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) { if err := wq.prepareQuery(ctx); err != nil { return nil, err } return wq.sqlQuery(ctx), nil } - return group + grbuild.label = weapon.Label + grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan + return grbuild } // Select allows the selection one or more fields/columns for the given query, @@ -326,10 +325,12 @@ func (wq *WeaponQuery) GroupBy(field string, fields ...string) *WeaponGroupBy { // client.Weapon.Query(). // Select(weapon.FieldVictim). // Scan(ctx, &v) -// func (wq *WeaponQuery) Select(fields ...string) *WeaponSelect { wq.fields = append(wq.fields, fields...) - return &WeaponSelect{WeaponQuery: wq} + selbuild := &WeaponSelect{WeaponQuery: wq} + selbuild.label = weapon.Label + selbuild.flds, selbuild.scan = &wq.fields, selbuild.Scan + return selbuild } func (wq *WeaponQuery) prepareQuery(ctx context.Context) error { @@ -348,7 +349,7 @@ func (wq *WeaponQuery) prepareQuery(ctx context.Context) error { return nil } -func (wq *WeaponQuery) sqlAll(ctx context.Context) ([]*Weapon, error) { +func (wq *WeaponQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Weapon, error) { var ( nodes = []*Weapon{} withFKs = wq.withFKs @@ -364,58 +365,63 @@ func (wq *WeaponQuery) sqlAll(ctx context.Context) ([]*Weapon, error) { _spec.Node.Columns = append(_spec.Node.Columns, weapon.ForeignKeys...) } _spec.ScanValues = func(columns []string) ([]interface{}, error) { - node := &Weapon{config: wq.config} - nodes = append(nodes, node) - return node.scanValues(columns) + return (*Weapon).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []interface{}) error { - if len(nodes) == 0 { - return fmt.Errorf("ent: Assign called without calling ScanValues") - } - node := nodes[len(nodes)-1] + node := &Weapon{config: wq.config} + nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) } if len(wq.modifiers) > 0 { _spec.Modifiers = wq.modifiers } + for i := range hooks { + hooks[i](ctx, _spec) + } if err := sqlgraph.QueryNodes(ctx, wq.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := wq.withStat; query != nil { - ids := make([]int, 0, len(nodes)) - nodeids := make(map[int][]*Weapon) - for i := range nodes { - if nodes[i].match_player_weapon_stats == nil { - continue - } - fk := *nodes[i].match_player_weapon_stats - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - query.Where(matchplayer.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { + if err := wq.loadStat(ctx, query, nodes, nil, + func(n *Weapon, e *MatchPlayer) { n.Edges.Stat = e }); err != nil { return nil, err } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return nil, fmt.Errorf(`unexpected foreign-key "match_player_weapon_stats" returned %v`, n.ID) - } - for i := range nodes { - nodes[i].Edges.Stat = n - } + } + return nodes, nil +} + +func (wq *WeaponQuery) loadStat(ctx context.Context, query *MatchPlayerQuery, nodes []*Weapon, init func(*Weapon), assign func(*Weapon, *MatchPlayer)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*Weapon) + for i := range nodes { + if nodes[i].match_player_weapon_stats == nil { + continue + } + fk := *nodes[i].match_player_weapon_stats + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + query.Where(matchplayer.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "match_player_weapon_stats" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) } } - - return nodes, nil + return nil } func (wq *WeaponQuery) sqlCount(ctx context.Context) (int, error) { @@ -530,6 +536,7 @@ func (wq *WeaponQuery) Modify(modifiers ...func(s *sql.Selector)) *WeaponSelect // WeaponGroupBy is the group-by builder for Weapon entities. type WeaponGroupBy struct { config + selector fields []string fns []AggregateFunc // intermediate query (i.e. traversal path). @@ -553,209 +560,6 @@ func (wgb *WeaponGroupBy) Scan(ctx context.Context, v interface{}) error { return wgb.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (wgb *WeaponGroupBy) ScanX(ctx context.Context, v interface{}) { - if err := wgb.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from group-by. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) Strings(ctx context.Context) ([]string, error) { - if len(wgb.fields) > 1 { - return nil, errors.New("ent: WeaponGroupBy.Strings is not achievable when grouping more than 1 field") - } - var v []string - if err := wgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (wgb *WeaponGroupBy) StringsX(ctx context.Context) []string { - v, err := wgb.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = wgb.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponGroupBy.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (wgb *WeaponGroupBy) StringX(ctx context.Context) string { - v, err := wgb.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from group-by. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) Ints(ctx context.Context) ([]int, error) { - if len(wgb.fields) > 1 { - return nil, errors.New("ent: WeaponGroupBy.Ints is not achievable when grouping more than 1 field") - } - var v []int - if err := wgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (wgb *WeaponGroupBy) IntsX(ctx context.Context) []int { - v, err := wgb.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = wgb.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponGroupBy.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (wgb *WeaponGroupBy) IntX(ctx context.Context) int { - v, err := wgb.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from group-by. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) Float64s(ctx context.Context) ([]float64, error) { - if len(wgb.fields) > 1 { - return nil, errors.New("ent: WeaponGroupBy.Float64s is not achievable when grouping more than 1 field") - } - var v []float64 - if err := wgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (wgb *WeaponGroupBy) Float64sX(ctx context.Context) []float64 { - v, err := wgb.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = wgb.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponGroupBy.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (wgb *WeaponGroupBy) Float64X(ctx context.Context) float64 { - v, err := wgb.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from group-by. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) Bools(ctx context.Context) ([]bool, error) { - if len(wgb.fields) > 1 { - return nil, errors.New("ent: WeaponGroupBy.Bools is not achievable when grouping more than 1 field") - } - var v []bool - if err := wgb.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (wgb *WeaponGroupBy) BoolsX(ctx context.Context) []bool { - v, err := wgb.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a group-by query. -// It is only allowed when executing a group-by query with one field. -func (wgb *WeaponGroupBy) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = wgb.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponGroupBy.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (wgb *WeaponGroupBy) BoolX(ctx context.Context) bool { - v, err := wgb.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (wgb *WeaponGroupBy) sqlScan(ctx context.Context, v interface{}) error { for _, f := range wgb.fields { if !weapon.ValidColumn(f) { @@ -797,6 +601,7 @@ func (wgb *WeaponGroupBy) sqlQuery() *sql.Selector { // WeaponSelect is the builder for selecting fields of Weapon entities. type WeaponSelect struct { *WeaponQuery + selector // intermediate query (i.e. traversal path). sql *sql.Selector } @@ -810,201 +615,6 @@ func (ws *WeaponSelect) Scan(ctx context.Context, v interface{}) error { return ws.sqlScan(ctx, v) } -// ScanX is like Scan, but panics if an error occurs. -func (ws *WeaponSelect) ScanX(ctx context.Context, v interface{}) { - if err := ws.Scan(ctx, v); err != nil { - panic(err) - } -} - -// Strings returns list of strings from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) Strings(ctx context.Context) ([]string, error) { - if len(ws.fields) > 1 { - return nil, errors.New("ent: WeaponSelect.Strings is not achievable when selecting more than 1 field") - } - var v []string - if err := ws.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// StringsX is like Strings, but panics if an error occurs. -func (ws *WeaponSelect) StringsX(ctx context.Context) []string { - v, err := ws.Strings(ctx) - if err != nil { - panic(err) - } - return v -} - -// String returns a single string from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) String(ctx context.Context) (_ string, err error) { - var v []string - if v, err = ws.Strings(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponSelect.Strings returned %d results when one was expected", len(v)) - } - return -} - -// StringX is like String, but panics if an error occurs. -func (ws *WeaponSelect) StringX(ctx context.Context) string { - v, err := ws.String(ctx) - if err != nil { - panic(err) - } - return v -} - -// Ints returns list of ints from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) Ints(ctx context.Context) ([]int, error) { - if len(ws.fields) > 1 { - return nil, errors.New("ent: WeaponSelect.Ints is not achievable when selecting more than 1 field") - } - var v []int - if err := ws.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// IntsX is like Ints, but panics if an error occurs. -func (ws *WeaponSelect) IntsX(ctx context.Context) []int { - v, err := ws.Ints(ctx) - if err != nil { - panic(err) - } - return v -} - -// Int returns a single int from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) Int(ctx context.Context) (_ int, err error) { - var v []int - if v, err = ws.Ints(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponSelect.Ints returned %d results when one was expected", len(v)) - } - return -} - -// IntX is like Int, but panics if an error occurs. -func (ws *WeaponSelect) IntX(ctx context.Context) int { - v, err := ws.Int(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64s returns list of float64s from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) Float64s(ctx context.Context) ([]float64, error) { - if len(ws.fields) > 1 { - return nil, errors.New("ent: WeaponSelect.Float64s is not achievable when selecting more than 1 field") - } - var v []float64 - if err := ws.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// Float64sX is like Float64s, but panics if an error occurs. -func (ws *WeaponSelect) Float64sX(ctx context.Context) []float64 { - v, err := ws.Float64s(ctx) - if err != nil { - panic(err) - } - return v -} - -// Float64 returns a single float64 from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) Float64(ctx context.Context) (_ float64, err error) { - var v []float64 - if v, err = ws.Float64s(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponSelect.Float64s returned %d results when one was expected", len(v)) - } - return -} - -// Float64X is like Float64, but panics if an error occurs. -func (ws *WeaponSelect) Float64X(ctx context.Context) float64 { - v, err := ws.Float64(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bools returns list of bools from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) Bools(ctx context.Context) ([]bool, error) { - if len(ws.fields) > 1 { - return nil, errors.New("ent: WeaponSelect.Bools is not achievable when selecting more than 1 field") - } - var v []bool - if err := ws.Scan(ctx, &v); err != nil { - return nil, err - } - return v, nil -} - -// BoolsX is like Bools, but panics if an error occurs. -func (ws *WeaponSelect) BoolsX(ctx context.Context) []bool { - v, err := ws.Bools(ctx) - if err != nil { - panic(err) - } - return v -} - -// Bool returns a single bool from a selector. It is only allowed when selecting one field. -func (ws *WeaponSelect) Bool(ctx context.Context) (_ bool, err error) { - var v []bool - if v, err = ws.Bools(ctx); err != nil { - return - } - switch len(v) { - case 1: - return v[0], nil - case 0: - err = &NotFoundError{weapon.Label} - default: - err = fmt.Errorf("ent: WeaponSelect.Bools returned %d results when one was expected", len(v)) - } - return -} - -// BoolX is like Bool, but panics if an error occurs. -func (ws *WeaponSelect) BoolX(ctx context.Context) bool { - v, err := ws.Bool(ctx) - if err != nil { - panic(err) - } - return v -} - func (ws *WeaponSelect) sqlScan(ctx context.Context, v interface{}) error { rows := &sql.Rows{} query, args := ws.sql.Query() diff --git a/ent/weapon_update.go b/ent/weapon_update.go index 2621741..7e919a5 100644 --- a/ent/weapon_update.go +++ b/ent/weapon_update.go @@ -1,4 +1,4 @@ -// Code generated by entc, DO NOT EDIT. +// Code generated by ent, DO NOT EDIT. package ent @@ -18,8 +18,9 @@ import ( // WeaponUpdate is the builder for updating Weapon entities. type WeaponUpdate struct { config - hooks []Hook - mutation *WeaponMutation + hooks []Hook + mutation *WeaponMutation + modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the WeaponUpdate builder. @@ -164,6 +165,12 @@ func (wu *WeaponUpdate) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (wu *WeaponUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdate { + wu.modifiers = append(wu.modifiers, modifiers...) + return wu +} + func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -273,11 +280,12 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = wu.modifiers if n, err = sqlgraph.UpdateNodes(ctx, wu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{weapon.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } @@ -287,9 +295,10 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) { // WeaponUpdateOne is the builder for updating a single Weapon entity. type WeaponUpdateOne struct { config - fields []string - hooks []Hook - mutation *WeaponMutation + fields []string + hooks []Hook + mutation *WeaponMutation + modifiers []func(*sql.UpdateBuilder) } // SetVictim sets the "victim" field. @@ -406,9 +415,15 @@ func (wuo *WeaponUpdateOne) Save(ctx context.Context) (*Weapon, error) { } mut = wuo.hooks[i](mut) } - if _, err := mut.Mutate(ctx, wuo.mutation); err != nil { + v, err := mut.Mutate(ctx, wuo.mutation) + if err != nil { return nil, err } + nv, ok := v.(*Weapon) + if !ok { + return nil, fmt.Errorf("unexpected node type %T returned from WeaponMutation", v) + } + node = nv } return node, err } @@ -435,6 +450,12 @@ func (wuo *WeaponUpdateOne) ExecX(ctx context.Context) { } } +// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. +func (wuo *WeaponUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdateOne { + wuo.modifiers = append(wuo.modifiers, modifiers...) + return wuo +} + func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ @@ -561,6 +582,7 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + _spec.Modifiers = wuo.modifiers _node = &Weapon{config: wuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues @@ -568,7 +590,7 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{weapon.Label} } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{err.Error(), err} + err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } diff --git a/go.mod b/go.mod index 34a6d44..774c868 100644 --- a/go.mod +++ b/go.mod @@ -3,27 +3,27 @@ module git.harting.dev/csgowtf/csgowtfd go 1.18 require ( - entgo.io/ent v0.10.1 + entgo.io/ent v0.11.2 github.com/an0nfunc/go-steam/v3 v3.0.6 github.com/an0nfunc/go-steamapi v1.1.0 - github.com/gin-contrib/cors v1.3.1 - github.com/gin-gonic/gin v1.7.7 + github.com/gin-contrib/cors v1.4.0 + github.com/gin-gonic/gin v1.8.1 github.com/go-redis/cache/v8 v8.4.3 github.com/go-redis/redis/v8 v8.11.5 github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 github.com/gorilla/mux v1.8.0 - github.com/jackc/pgx/v4 v4.15.0 - github.com/markus-wa/demoinfocs-golang/v2 v2.13.2 - github.com/sirupsen/logrus v1.8.1 + github.com/jackc/pgx/v4 v4.17.0 + github.com/markus-wa/demoinfocs-golang/v3 v3.0.0 + github.com/sirupsen/logrus v1.9.0 github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3 golang.org/x/text v0.3.7 - golang.org/x/time v0.0.0-20220411224347-583f2d630306 - google.golang.org/protobuf v1.28.0 - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b + golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 + google.golang.org/protobuf v1.28.1 + gopkg.in/yaml.v3 v3.0.1 ) require ( - ariga.io/atlas v0.3.7 // indirect + ariga.io/atlas v0.6.0 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect @@ -34,41 +34,42 @@ require ( github.com/go-openapi/inflect v0.19.0 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect - github.com/go-playground/validator/v10 v10.10.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.7 // indirect + github.com/go-playground/validator/v10 v10.11.0 // indirect + github.com/goccy/go-json v0.9.10 // indirect + github.com/google/go-cmp v0.5.8 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/hashicorp/hcl/v2 v2.11.1 // indirect + github.com/hashicorp/hcl/v2 v2.13.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect - github.com/jackc/pgconn v1.11.0 // indirect + github.com/jackc/pgconn v1.13.0 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.2.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.1 // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect - github.com/jackc/pgtype v1.10.0 // indirect + github.com/jackc/pgtype v1.12.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.15.1 // indirect + github.com/klauspost/compress v1.15.9 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/markus-wa/go-unassert v0.1.2 // indirect github.com/markus-wa/gobitread v0.2.3 // indirect github.com/markus-wa/godispatch v1.4.1 // indirect github.com/markus-wa/ice-cipher-go v0.0.0-20220126215401-a6adadccc817 // indirect github.com/markus-wa/quickhull-go/v2 v2.1.0 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.0.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/vmihailenco/go-tinylfu v0.2.2 // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.10.0 // indirect - golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect - golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd // indirect - golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 // indirect - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect + golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect + golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 4f4b618..ab97b01 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,10 @@ -ariga.io/atlas v0.3.7 h1:lAISv2cc69QWzrvhlAc22Em1cbBMhJ0Xlcd8p3p3tHM= -ariga.io/atlas v0.3.7/go.mod h1:yWGf4VPiD4SW83+kAqzD624txN9VKoJC+bpVXr2pKJA= +ariga.io/atlas v0.6.0 h1:LjDa3zfm4J44uhTPboUmkGLhjuALMwHHTvrHZf2V+/s= +ariga.io/atlas v0.6.0/go.mod h1:ft47uSh5hWGDCmQC9DsztZg6Xk+KagM5Ts/mZYKb9JE= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -entgo.io/ent v0.10.1 h1:dM5h4Zk6yHGIgw4dCqVzGw3nWgpGYJiV4/kyHEF6PFo= -entgo.io/ent v0.10.1/go.mod h1:YPgxeLnoQ/YdpVORRtqjBF+wCy9NX9IR7veTv3Bffus= +entgo.io/ent v0.11.2 h1:UM2/BUhF2FfsxPHRxLjQbhqJNaDdVlOwNIAMLs2jyto= +entgo.io/ent v0.11.2/go.mod h1:YGHEQnmmIUgtD5b1ICD5vg74dS3npkNnmC5K+0J+IHU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= @@ -15,7 +15,6 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -28,8 +27,6 @@ github.com/an0nfunc/go-steamapi v1.1.0 h1:sBOSAKO0zEmzKrkMX2bVhoFiErA+Gyx9hRl+7B github.com/an0nfunc/go-steamapi v1.1.0/go.mod h1:tInHdrGkh0gaXuPnvhMG4BoW9S5gVcWOY9gJ9gCBKOI= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -71,7 +68,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/dustin/go-heatmap v0.0.0-20180603032536-b89dbd73785a/go.mod h1:VBmwC4U3p2SMEKr+/m5j0eby7rmUtSoA5TGLwe6P+3A= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -88,15 +84,12 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4 github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA= -github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk= +github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g= +github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= -github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= -github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= -github.com/go-gl/gl v0.0.0-20180407155706-68e253793080/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk= -github.com/go-gl/glfw v0.0.0-20180426074136-46a8d530c326/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -110,17 +103,13 @@ github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNP github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= -github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.10.1 h1:uA0+amWMiglNZKZ9FJRKUAe9U3RX91eVn1JYXMWt7ig= -github.com/go-playground/validator/v10 v10.10.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= +github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw= +github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-redis/cache/v8 v8.4.3 h1:+RZ0pQM+zOd6h/oWCsOl3+nsCgii9rn26oCYmU87kN8= github.com/go-redis/cache/v8 v8.4.3/go.mod h1:5lQPQ63uyBt4aZuRmdvUJOJRRjPxfLtJtlcJ/z8o1jA= github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc= @@ -130,16 +119,15 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.9.10 h1:hCeNmprSNLB8B8vQKWl6DpuH0t60oEs+TAk9a7CScKc= +github.com/goccy/go-json v0.9.10/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20180826223333-635502111454/go.mod h1:vgWZ7cu0fq0KY3PpEHsocXOWJpRtkcbKemU4IUw0M60= github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo= github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= @@ -147,11 +135,9 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -160,7 +146,6 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -171,8 +156,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -204,8 +189,8 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl/v2 v2.11.1 h1:yTyWcXcm9XB0TEkyU/JCRU6rYy4K+mgLtzn2wlrJbcc= -github.com/hashicorp/hcl/v2 v2.11.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= +github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc= +github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= @@ -224,8 +209,8 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.11.0 h1:HiHArx4yFbwl91X3qqIHtUFoiIfLNJXCQRsnzkiwwaQ= -github.com/jackc/pgconn v1.11.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.13.0 h1:3L1XMNV2Zvca/8BYhzcRFS70Lr0WlDg16Di6SFGAbys= +github.com/jackc/pgconn v1.13.0/go.mod h1:AnowpAqO4CMIIJNZl2VJp+KrkAZciAkhEl0W0JIobpI= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= @@ -241,22 +226,22 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvW github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.2.0 h1:r7JypeP2D3onoQTCxWdTpCtJ4D+qpKr0TxvoyMhZ5ns= -github.com/jackc/pgproto3/v2 v2.2.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.1 h1:nwj7qwf0S+Q7ISFfBndqeLwSwxs+4DPsbRFjECT1Y4Y= +github.com/jackc/pgproto3/v2 v2.3.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.10.0 h1:ILnBWrRMSXGczYvmkYD6PsYyVFUNLTnIUJHHDLmqk38= -github.com/jackc/pgtype v1.10.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.12.0 h1:Dlq8Qvcch7kiehm8wPGIW0W3KsCCHJnRacKW0UM8n5w= +github.com/jackc/pgtype v1.12.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.15.0 h1:B7dTkXsdILD3MF987WGGCcg+tvLW6bZJdEcqVFeU//w= -github.com/jackc/pgx/v4 v4.15.0/go.mod h1:D/zyOyXiaM1TmVWnOM18p0xdDtdakRBa0RsVGI3U3bw= +github.com/jackc/pgx/v4 v4.17.0 h1:Hsx+baY8/zU2WtPLQyZi8WbecgcsWEeyoK1jvg/WgIo= +github.com/jackc/pgx/v4 v4.17.0/go.mod h1:Gd6RmOhtFLTu8cp/Fhq4kP195KrshxYJH3oW8AWJ1pw= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= @@ -266,18 +251,15 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= -github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -291,23 +273,18 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= +github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/llgcode/draw2d v0.0.0-20200930101115-bfaf5d914d1e/go.mod h1:mVa0dA29Db2S4LVqDYLlsePDzRJLDfdhVZiI15uY0FA= -github.com/llgcode/ps v0.0.0-20150911083025-f1443b32eedb/go.mod h1:1l8ky+Ew27CMX29uG+a2hNOKpeNYEQjjtiALiBlFQbY= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/markus-wa/demoinfocs-golang/v2 v2.13.2 h1:MaxqfOiDL3hvzIYeTqauJjn1fG9JrQ0Ne+sHMEuVRow= -github.com/markus-wa/demoinfocs-golang/v2 v2.13.2/go.mod h1:2mL3quPmFnXa8WkrsQTEFUm/iDBuzq5I3AeJ6SsMIn4= +github.com/markus-wa/demoinfocs-golang/v3 v3.0.0 h1:Rto2f1C4wON/wuDEUezglM7ED/8awzJO/Z30yLIML0c= +github.com/markus-wa/demoinfocs-golang/v3 v3.0.0/go.mod h1:a7IY3cRyFmfoTnTz8S6W+BuvuF5OioCmHlvznz4MaKU= github.com/markus-wa/go-unassert v0.1.2 h1:uXWlMDa8JVtc4RgNq4XJIjyRejv9MOVuy/E0VECPxxo= github.com/markus-wa/go-unassert v0.1.2/go.mod h1:XEvrxR+trvZeMDfXcZPvzqGo6eumEtdk5VjNRuvvzxQ= github.com/markus-wa/gobitread v0.2.3 h1:COx7dtYQ7Q+77hgUmD+O4MvOcqG7y17RP3Z7BbjRvPs= @@ -325,18 +302,17 @@ github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-sqlite3 v1.14.13 h1:1tj15ngiFfcZzii7yd82foL+ks+ouQcj8j/TPq3fk1I= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= @@ -364,7 +340,6 @@ github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+ github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -387,6 +362,9 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= +github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -431,7 +409,6 @@ github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0 github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -439,42 +416,41 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 h1:t0lM6y/M5IiUZyvbBTcngso8SZEZICH7is9B6g/obVU= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vmihailenco/go-tinylfu v0.2.2 h1:H1eiG6HM36iniK6+21n9LLpzx1G9R3DJa2UjUjbynsI= github.com/vmihailenco/go-tinylfu v0.2.2/go.mod h1:CutYi2Q9puTxfcolkliPq4npPuofg9N9t8JVrjzwa3Q= -github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= @@ -485,13 +461,9 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3 h1:shC1HB1UogxN5Ech3Yqaaxj1X/P656PPCB4RbojIJqc= github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0= github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= @@ -521,7 +493,6 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -531,14 +502,13 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/exp v0.0.0-20210916165020-5cb4fee858ee/go.mod h1:a3o/VtDNHN+dCVLEpzjjUHOzR+Ln3DHX056ZPzoZGGA= -golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd h1:zVFyTKZN/Q7mNRWSs1GOYnHM9NiFSJ54YVRsD0rNWT4= -golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -552,13 +522,11 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1-0.20210830214625-1b1db11ec8f4/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 h1:LQmS1nU0twXLA96Kt7U9qtHJEbBk3z6Q0V4UXjZkpr4= -golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -574,14 +542,14 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220812174116-3211cb980234 h1:RDqmgfe7SvlMWoqC3xwQ2blLO3fcWcxMa3eBLRdRW7E= +golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -591,8 +559,9 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -607,7 +576,6 @@ golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -627,8 +595,9 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -641,8 +610,8 @@ golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220411224347-583f2d630306 h1:+gHMid33q6pen7kv9xvT+JRinntgeXO2AeZVd0AWD3w= -golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 h1:ftMN5LMiBFjbzleLqtoBZk7KdJwhuybIU+FckUHgoyQ= +golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -661,17 +630,13 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7 h1:M1gcVrIb2lSn2FIL19DG0+/b8nNVKJ7W7b4WcAGZAYM= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -701,8 +666,9 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -713,8 +679,6 @@ gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= @@ -724,13 +688,13 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/main.go b/main.go index f50a879..c02d5c4 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ import ( "github.com/go-redis/redis/v8" "github.com/gorilla/mux" _ "github.com/jackc/pgx/v4/stdlib" - "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/common" + "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/common" log "github.com/sirupsen/logrus" "github.com/wercker/journalhook" "golang.org/x/text/language"