Compare commits
116 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2deefd3b81 | |||
| e7e068d4d5 | |||
| d9e6402c03 | |||
| 7641427068 | |||
| d98946377e | |||
| 87c55d685d | |||
| df22705679 | |||
| ab8b0b983c | |||
| 5358d9dd0f | |||
| 1c14817e5e | |||
| a2a9c8d391 | |||
| dacc86dd83 | |||
| 3fd0a4204b | |||
| e9e3e02a39 | |||
| 0e126df3db | |||
| 7a5acb5fc3 | |||
| 1cae00e85d | |||
| 05b6f17136 | |||
| 8f11a3586a | |||
| 2f1c5d0d83 | |||
| 4a46e43ce7 | |||
| 5c3abbe463 | |||
| c5b8d90f3c | |||
| 793032ffd7 | |||
| 84f8f866b0 | |||
| 762c137de1 | |||
| ea8a91c0d3 | |||
| 2b0384e3a8 | |||
| ed283c92f3 | |||
| f7903d1781 | |||
| 83834c3f34 | |||
| 727d530378 | |||
| e9a5daa9e3 | |||
| 0060e82aff | |||
| f6f73096e0 | |||
| cb8185e5bb | |||
| ba1a1cf31f | |||
| b6407514da | |||
| 97cf95185b | |||
| eb8487d0c4 | |||
| 56059d2cd0 | |||
| e99dfd320d | |||
| ca914ea42b | |||
| d856b32139 | |||
| c6ddf14a26 | |||
| 1ac07c2f5a | |||
| 43c91b694e | |||
| 4304a5a1d6 | |||
| 4b2c948a9f | |||
| 741fe4c4dd | |||
| 64fd38709b | |||
| 5b938f4d06 | |||
| d10a134a34 | |||
| 6543226526 | |||
| 40f95cfb6e | |||
| cd58741188 | |||
| 984cc51ead | |||
| 7fda18a182 | |||
| 3e4b90a1bd | |||
| 4d36ce8899 | |||
| 8e9fc43e4c | |||
| 6db43ad5f0 | |||
| abd8b74c08 | |||
| ff3bbe0037 | |||
| 4b256dd594 | |||
| 20289eb01f | |||
| 64cba30917 | |||
| 25965cdde7 | |||
| 657ca32bb3 | |||
| b8b9f82067 | |||
| 2300d740d2 | |||
| 2887db2d4b | |||
| e3ee2a5e08 | |||
| 49344e0a04 | |||
| 04b42d47ab | |||
| 6ffefa3616 | |||
| 9ae02cf593 | |||
| 39aea94a59 | |||
| caf173eb1c | |||
| 0cf73c2aab | |||
| 8a3385bdc4 | |||
| bb13027b93 | |||
| acbfb97014 | |||
| ac512aec2f | |||
| cecdbc7a00 | |||
| 9834095806 | |||
| 95c92d44f8 | |||
| e350f940c8 | |||
| 0d2a5ef084 | |||
| 126e96a4a9 | |||
| d0679bd3b7 | |||
| 7260bedfa4 | |||
| 8aaf60005d | |||
| fd5a065de2 | |||
| 11b08e42a3 | |||
| a80d8af91b | |||
| 442add4a29 | |||
| 47fce4fc1a | |||
| ede3b58f7e | |||
| 1e2541c76b | |||
| 8c672f7186 | |||
| 8fe8ec5233 | |||
| 5d299dfa17 | |||
| f2a859d084 | |||
| 440aa41396 | |||
| cc2c40dc56 | |||
| 466a000c86 | |||
| 6a4e2f3ee3 | |||
| 182c7d8fc1 | |||
| ff0ea43cea | |||
| ede713c3df | |||
| f6b28cb4d2 | |||
| 1aa7cc260a | |||
| 4b3b8d8053 | |||
| c822ce9396 | |||
| 26c5e0558c |
95
.golangci.yaml
Normal file
95
.golangci.yaml
Normal file
@@ -0,0 +1,95 @@
|
||||
linters-settings:
|
||||
dupl:
|
||||
threshold: 100
|
||||
goconst:
|
||||
min-len: 3
|
||||
min-occurrences: 4
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- experimental
|
||||
- opinionated
|
||||
- performance
|
||||
- style
|
||||
disabled-checks:
|
||||
- whyNoLint
|
||||
- filepathJoin
|
||||
gomnd:
|
||||
checks:
|
||||
- argument
|
||||
- case
|
||||
- condition
|
||||
- return
|
||||
ignored-numbers:
|
||||
- '0'
|
||||
- '0.5'
|
||||
- '1'
|
||||
- '2'
|
||||
- '3'
|
||||
- '4'
|
||||
- '5'
|
||||
- '6'
|
||||
- '7'
|
||||
- '8'
|
||||
- '9'
|
||||
- '10'
|
||||
- '20'
|
||||
- '100'
|
||||
- '1000'
|
||||
ignored-functions:
|
||||
- strings.SplitN
|
||||
- os.OpenFile
|
||||
- os.MkdirAll
|
||||
- os.WriteFile
|
||||
govet:
|
||||
check-shadowing: false
|
||||
lll:
|
||||
line-length: 140
|
||||
misspell:
|
||||
locale: US
|
||||
nolintlint:
|
||||
allow-unused: false # report any unused nolint directives
|
||||
require-explanation: false # don't require an explanation for nolint directives
|
||||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
|
||||
tagliatelle:
|
||||
case:
|
||||
use-field-name: true
|
||||
rules:
|
||||
# Any struct tag type can be used.
|
||||
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`.
|
||||
json: snake
|
||||
yaml: snake
|
||||
xml: camel
|
||||
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- gochecknoglobals
|
||||
- depguard
|
||||
- gci
|
||||
- gofumpt
|
||||
- goimports
|
||||
- varnamelen
|
||||
- funlen
|
||||
- cyclop
|
||||
- wsl
|
||||
- nosnakecase
|
||||
- nlreturn
|
||||
- godot
|
||||
- nestif
|
||||
- wrapcheck
|
||||
- gocognit
|
||||
- gocyclo
|
||||
- maintidx
|
||||
- nonamedreturns
|
||||
- exhaustivestruct
|
||||
- exhaustruct
|
||||
- forcetypeassert
|
||||
- godox
|
||||
- nakedret
|
||||
- tagalign
|
||||
- maligned
|
||||
# remove for new projects
|
||||
- errname
|
||||
- goerr113
|
||||
- tagliatelle
|
||||
@@ -17,6 +17,8 @@ steam:
|
||||
rate_per_sec: 1
|
||||
sentry: ".sentry"
|
||||
login_key: ".login_key"
|
||||
# maximum amount of time (in minutes) to wait before trying to reconnect to steam
|
||||
max_retry_wait: 30
|
||||
|
||||
redis:
|
||||
address: "localhost:6379"
|
||||
@@ -42,4 +44,19 @@ csgowtfd:
|
||||
# days in which demos expire
|
||||
demos_expire: 30
|
||||
# ms between shots to count as spray
|
||||
spray_timeout: 500
|
||||
spray_timeout: 500
|
||||
# timeouts
|
||||
timeout:
|
||||
# seconds before incoming request with no data send timeout
|
||||
read: 5
|
||||
# seconds to write a response before timeout
|
||||
write: 30
|
||||
# seconds before closing idle connections
|
||||
idle: 120
|
||||
|
||||
deepl:
|
||||
base_url: api-free.deepl.com
|
||||
# get your API key on deepl.com
|
||||
api_key: <api_key>
|
||||
# timeout in sec to wait for deepl response
|
||||
timeout: 15
|
||||
@@ -2,28 +2,30 @@ package csgo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent"
|
||||
"csgowtfd/utils"
|
||||
"fmt"
|
||||
"github.com/an0nfunc/go-steam/v3"
|
||||
"github.com/an0nfunc/go-steam/v3/csgo/protocol/protobuf"
|
||||
"github.com/an0nfunc/go-steam/v3/netutil"
|
||||
"github.com/an0nfunc/go-steam/v3/protocol/gamecoordinator"
|
||||
"github.com/an0nfunc/go-steam/v3/protocol/steamlang"
|
||||
"github.com/go-redis/cache/v8"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"go.uber.org/ratelimit"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/an0nfunc/go-steam/v3"
|
||||
"github.com/an0nfunc/go-steam/v3/csgo/protocol/protobuf"
|
||||
"github.com/an0nfunc/go-steam/v3/protocol/gamecoordinator"
|
||||
"github.com/an0nfunc/go-steam/v3/protocol/steamlang"
|
||||
"github.com/go-redis/cache/v8"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sethvargo/go-retry"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/time/rate"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent"
|
||||
"somegit.dev/csgowtf/csgowtfd/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
APPID = 730
|
||||
APPID = 730
|
||||
LoginFailed = iota
|
||||
LoginSuccess
|
||||
)
|
||||
|
||||
type DemoMatchLoaderConfig struct {
|
||||
@@ -32,50 +34,90 @@ type DemoMatchLoaderConfig struct {
|
||||
AuthCode string
|
||||
Sentry string
|
||||
LoginKey string
|
||||
Db *ent.Client
|
||||
DB *ent.Client
|
||||
Worker int
|
||||
ApiKey string
|
||||
RateLimit ratelimit.Limiter
|
||||
APIKey string
|
||||
RateLimit *rate.Limiter
|
||||
Cache *cache.Cache
|
||||
SprayTimeout int
|
||||
RetryTimeout int
|
||||
}
|
||||
|
||||
type DemoMatchLoader struct {
|
||||
client *steam.Client
|
||||
GCReady bool
|
||||
steamLogin *steam.LogOnDetails
|
||||
matchRecv chan *protobuf.CMsgGCCStrike15V2_MatchList
|
||||
cmList []*netutil.PortAddr
|
||||
sentryFile string
|
||||
loginKey string
|
||||
db *ent.Client
|
||||
dp *DemoParser
|
||||
parseDemo chan *Demo
|
||||
parseMap map[string]bool
|
||||
parseMapL *sync.Mutex
|
||||
cache *cache.Cache
|
||||
connecting bool
|
||||
client *steam.Client
|
||||
GCReady bool
|
||||
steamLogin *steam.LogOnDetails
|
||||
matchRecv chan *protobuf.CMsgGCCStrike15V2_MatchList
|
||||
sentryFile string
|
||||
loginKey string
|
||||
db *ent.Client
|
||||
dp *DemoParser
|
||||
parseDemo chan *Demo
|
||||
parseMap map[string]bool
|
||||
parseMapL *sync.RWMutex
|
||||
cache *cache.Cache
|
||||
connectionWait retry.Backoff
|
||||
connectionWaitTmpl retry.Backoff
|
||||
connectFeedback chan int
|
||||
LoggedIn bool
|
||||
}
|
||||
|
||||
func AccountId2SteamId(accId uint32) uint64 {
|
||||
return uint64(accId) + 76561197960265728
|
||||
type PlayerRoundStats struct {
|
||||
Kills int32
|
||||
Deaths int32
|
||||
Assists int32
|
||||
Headshots int32
|
||||
Score int32
|
||||
MPVs int32
|
||||
}
|
||||
|
||||
func SteamId2AccountId(steamId uint64) uint32 {
|
||||
return uint32(steamId - 76561197960265728)
|
||||
func AccountID2SteamID(accID uint32) uint64 {
|
||||
return uint64(accID) + 76561197960265728 //nolint:gomnd
|
||||
}
|
||||
|
||||
func playerStatsFromRound(round *protobuf.CMsgGCCStrike15V2_MatchmakingServerRoundStats, p *ent.Player) (kills int32, deaths int32, assists int32, headshots int32, score int32, mvps int32) {
|
||||
func SteamID2AccountID(steamID uint64) uint32 {
|
||||
return uint32(steamID - 76561197960265728) //nolint:gosec,gomnd
|
||||
}
|
||||
|
||||
func playerStatsFromRound(round *protobuf.CMsgGCCStrike15V2_MatchmakingServerRoundStats, p *ent.Player) PlayerRoundStats {
|
||||
for i, acc := range round.GetReservation().GetAccountIds() {
|
||||
if AccountId2SteamId(acc) == p.ID {
|
||||
return round.GetKills()[i], round.GetDeaths()[i], round.GetAssists()[i], round.GetEnemyHeadshots()[i], round.GetScores()[i], round.GetMvps()[i]
|
||||
if AccountID2SteamID(acc) == p.ID {
|
||||
return PlayerRoundStats{
|
||||
Kills: round.GetKills()[i],
|
||||
Deaths: round.GetDeaths()[i],
|
||||
Assists: round.GetAssists()[i],
|
||||
Headshots: round.GetEnemyHeadshots()[i],
|
||||
Score: round.GetScores()[i],
|
||||
MPVs: round.GetMvps()[i],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0, 0, 0, 0, 0, 0
|
||||
return PlayerRoundStats{}
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) HandleGCPacket(pkg *gamecoordinator.GCPacket) {
|
||||
func (dml *DemoMatchLoader) IsLoading(demo *Demo) bool {
|
||||
dml.parseMapL.RLock()
|
||||
defer dml.parseMapL.RUnlock()
|
||||
if _, ok := dml.parseMap[demo.ShareCode]; ok {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (dml *DemoMatchLoader) unlockDemo(demo *Demo) {
|
||||
dml.parseMapL.Lock()
|
||||
defer dml.parseMapL.Unlock()
|
||||
delete(dml.parseMap, demo.ShareCode)
|
||||
}
|
||||
|
||||
func (dml *DemoMatchLoader) lockDemo(demo *Demo) {
|
||||
dml.parseMapL.Lock()
|
||||
defer dml.parseMapL.Unlock()
|
||||
dml.parseMap[demo.ShareCode] = true
|
||||
}
|
||||
|
||||
func (dml *DemoMatchLoader) HandleGCPacket(pkg *gamecoordinator.GCPacket) {
|
||||
switch pkg.MsgType {
|
||||
case uint32(protobuf.EGCBaseClientMsg_k_EMsgGCClientWelcome):
|
||||
msg := &protobuf.CMsgClientWelcome{}
|
||||
@@ -84,423 +126,453 @@ func (d *DemoMatchLoader) HandleGCPacket(pkg *gamecoordinator.GCPacket) {
|
||||
log.Errorf("[DL] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
}
|
||||
log.Debugf("[GC] Welcome: %+v", msg)
|
||||
d.GCReady = true
|
||||
dml.GCReady = true
|
||||
case uint32(protobuf.EGCBaseClientMsg_k_EMsgGCClientConnectionStatus):
|
||||
msg := &protobuf.CMsgConnectionStatus{}
|
||||
err := proto.Unmarshal(pkg.Body, msg)
|
||||
if err != nil {
|
||||
log.Errorf("[DL] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
log.Errorf("[GC] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
}
|
||||
|
||||
log.Debugf("[GC] Status: %+v", msg)
|
||||
if msg.GetStatus() != protobuf.GCConnectionStatus_GCConnectionStatus_HAVE_SESSION {
|
||||
d.GCReady = false
|
||||
go d.greetGC()
|
||||
dml.GCReady = false
|
||||
go dml.greetGC()
|
||||
}
|
||||
case uint32(protobuf.ECsgoGCMsg_k_EMsgGCCStrike15_v2_GC2ClientGlobalStats):
|
||||
msg := &protobuf.GlobalStatistics{}
|
||||
err := proto.Unmarshal(pkg.Body, msg)
|
||||
if err != nil {
|
||||
log.Errorf("[DL] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
log.Errorf("[GC] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
}
|
||||
log.Debugf("[GC] Stats: %+v", msg)
|
||||
d.GCReady = true
|
||||
dml.GCReady = true
|
||||
case uint32(protobuf.ECsgoGCMsg_k_EMsgGCCStrike15_v2_MatchList):
|
||||
msg := &protobuf.CMsgGCCStrike15V2_MatchList{}
|
||||
err := proto.Unmarshal(pkg.Body, msg)
|
||||
if err != nil {
|
||||
log.Errorf("[DL] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
log.Errorf("[GC] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
}
|
||||
d.matchRecv <- msg
|
||||
dml.matchRecv <- msg
|
||||
case uint32(protobuf.ECsgoGCMsg_k_EMsgGCCStrike15_v2_ClientLogonFatalError):
|
||||
msg := &protobuf.CMsgGCCStrike15V2_ClientLogonFatalError{}
|
||||
err := proto.Unmarshal(pkg.Body, msg)
|
||||
if err != nil {
|
||||
log.Errorf("[GC] Unable to unmarshal event %v: %v", pkg.MsgType, err)
|
||||
}
|
||||
log.Warningf("[GC] Logon fatal error: %+v", msg)
|
||||
default:
|
||||
log.Debugf("[GC] Unhandled GC message: %+v", pkg)
|
||||
log.Debugf("[GC] Unhandled message: %+v", pkg)
|
||||
}
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) getMatchDetails(sharecode string) (*protobuf.CMsgGCCStrike15V2_MatchList, error) {
|
||||
if !d.GCReady {
|
||||
return nil, fmt.Errorf("gc not ready")
|
||||
func (dml *DemoMatchLoader) getMatchDetails(sharecode string) (*protobuf.CMsgGCCStrike15V2_MatchList, error) {
|
||||
if !dml.GCReady {
|
||||
return nil, errors.New("gc not ready")
|
||||
}
|
||||
|
||||
matchId, outcomeId, tokenId, err := DecodeSharecode(sharecode)
|
||||
matchID, outcomeID, tokenID, err := DecodeSharecode(sharecode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = d.requestDemoInfo(matchId, outcomeId, uint32(tokenId))
|
||||
err = dml.requestDemoInfo(matchID, outcomeID, uint32(tokenID))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case matchDetails := <-d.matchRecv:
|
||||
if *matchDetails.Matches[0].Matchid == matchId {
|
||||
return matchDetails, nil
|
||||
} else {
|
||||
d.matchRecv <- matchDetails
|
||||
}
|
||||
for matchDetails := range dml.matchRecv {
|
||||
if matchDetails.GetMatches()[0].GetMatchid() == matchID {
|
||||
return matchDetails, nil
|
||||
}
|
||||
dml.matchRecv <- matchDetails
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) connectToSteam() error {
|
||||
if d.client.Connected() {
|
||||
func (dml *DemoMatchLoader) connectToSteam() error {
|
||||
if dml.client.Connected() {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := d.client.Connect()
|
||||
if err != nil {
|
||||
if _, err := dml.client.Connect(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) Setup(config *DemoMatchLoaderConfig) error {
|
||||
d.loginKey = config.LoginKey
|
||||
d.sentryFile = config.Sentry
|
||||
d.db = config.Db
|
||||
d.dp = &DemoParser{}
|
||||
d.parseMap = map[string]bool{}
|
||||
d.parseMapL = new(sync.Mutex)
|
||||
d.cache = config.Cache
|
||||
err := d.dp.Setup(config.Db, config.Worker, config.SprayTimeout)
|
||||
func (dml *DemoMatchLoader) Setup(config *DemoMatchLoaderConfig) error {
|
||||
dml.loginKey = config.LoginKey
|
||||
dml.sentryFile = config.Sentry
|
||||
dml.db = config.DB
|
||||
dml.dp = &DemoParser{}
|
||||
dml.parseMap = map[string]bool{}
|
||||
dml.parseMapL = new(sync.RWMutex)
|
||||
dml.cache = config.Cache
|
||||
dml.connectFeedback = make(chan int, 10)
|
||||
dml.connectionWait = retry.WithCappedDuration(time.Minute*time.Duration(config.RetryTimeout), retry.NewExponential(time.Minute))
|
||||
dml.connectionWaitTmpl = retry.WithCappedDuration(time.Minute*time.Duration(config.RetryTimeout), retry.NewExponential(time.Minute))
|
||||
err := dml.dp.Setup(config.DB, config.Worker, config.SprayTimeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.steamLogin = new(steam.LogOnDetails)
|
||||
d.steamLogin.Username = config.Username
|
||||
d.steamLogin.Password = config.Password
|
||||
d.steamLogin.AuthCode = config.AuthCode
|
||||
d.steamLogin.ShouldRememberPassword = true
|
||||
dml.steamLogin = new(steam.LogOnDetails)
|
||||
dml.steamLogin.Username = config.Username
|
||||
dml.steamLogin.Password = config.Password
|
||||
dml.steamLogin.AuthCode = config.AuthCode
|
||||
dml.steamLogin.ShouldRememberPassword = true
|
||||
|
||||
if _, err := os.Stat(d.sentryFile); err == nil {
|
||||
hash, err := ioutil.ReadFile(d.sentryFile)
|
||||
if _, err := os.Stat(dml.sentryFile); err == nil {
|
||||
hash, err := os.ReadFile(dml.sentryFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.steamLogin.SentryFileHash = hash
|
||||
dml.steamLogin.SentryFileHash = hash
|
||||
}
|
||||
|
||||
if _, err := os.Stat(d.loginKey); err == nil {
|
||||
hash, err := ioutil.ReadFile(d.loginKey)
|
||||
if _, err := os.Stat(dml.loginKey); err == nil {
|
||||
hash, err := os.ReadFile(dml.loginKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.steamLogin.LoginKey = string(hash)
|
||||
dml.steamLogin.LoginKey = string(hash)
|
||||
}
|
||||
|
||||
d.client = steam.NewClient()
|
||||
dml.client = steam.NewClient()
|
||||
err = steam.InitializeSteamDirectory()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d.matchRecv = make(chan *protobuf.CMsgGCCStrike15V2_MatchList, 1000)
|
||||
d.parseDemo = make(chan *Demo, 1000)
|
||||
dml.matchRecv = make(chan *protobuf.CMsgGCCStrike15V2_MatchList, 1000)
|
||||
dml.parseDemo = make(chan *Demo, 1000)
|
||||
|
||||
go d.connectLoop()
|
||||
go d.steamEventHandler()
|
||||
go dml.connectLoop()
|
||||
go dml.steamEventHandler()
|
||||
go dml.demoWorker()
|
||||
|
||||
for i := 0; i < config.Worker; i++ {
|
||||
go d.gcWorker(config.ApiKey, config.RateLimit)
|
||||
for range config.Worker {
|
||||
go dml.gcWorker(config.APIKey, config.RateLimit)
|
||||
}
|
||||
|
||||
dml.connectFeedback <- LoginFailed
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d DemoMatchLoader) LoadDemo(demo *Demo) error {
|
||||
func (dml *DemoMatchLoader) LoadDemo(demo *Demo) error {
|
||||
if dml.IsLoading(demo) {
|
||||
log.Infof("[DL] Skipping %s: parsing in progress", demo.ShareCode)
|
||||
return nil
|
||||
}
|
||||
dml.lockDemo(demo)
|
||||
|
||||
select {
|
||||
case d.parseDemo <- demo:
|
||||
case dml.parseDemo <- demo:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("queue full")
|
||||
dml.unlockDemo(demo)
|
||||
return errors.New("queue full")
|
||||
}
|
||||
}
|
||||
|
||||
func (d DemoMatchLoader) connectLoop() {
|
||||
if !d.connecting {
|
||||
d.connecting = true
|
||||
for d.connectToSteam() != nil {
|
||||
log.Infof("[DL] Retrying connecting to steam...")
|
||||
time.Sleep(time.Minute * 10)
|
||||
func (dml *DemoMatchLoader) connectLoop() {
|
||||
for res := range dml.connectFeedback {
|
||||
switch res {
|
||||
case LoginFailed:
|
||||
if sleep, ok := dml.connectionWait.Next(); !ok {
|
||||
time.Sleep(sleep)
|
||||
} else {
|
||||
panic("retry should never stop")
|
||||
}
|
||||
if !dml.LoggedIn {
|
||||
log.Infof("[DL] Connecting to steam...")
|
||||
|
||||
err := dml.connectToSteam()
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Error connecting to steam: %v", err)
|
||||
}
|
||||
}
|
||||
case LoginSuccess:
|
||||
log.Info("[DL] Steam login successfully restored")
|
||||
dml.connectionWait = dml.connectionWaitTmpl
|
||||
default:
|
||||
panic("unhandled default case")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) steamEventHandler() {
|
||||
for event := range d.client.Events() {
|
||||
func (dml *DemoMatchLoader) steamEventHandler() {
|
||||
for event := range dml.client.Events() {
|
||||
switch e := event.(type) {
|
||||
case *steam.ConnectedEvent:
|
||||
log.Debug("[DL] Connected!")
|
||||
d.client.Auth.LogOn(d.steamLogin)
|
||||
dml.client.Auth.LogOn(dml.steamLogin)
|
||||
case *steam.MachineAuthUpdateEvent:
|
||||
log.Debug("[DL] Got sentry!")
|
||||
err := ioutil.WriteFile(d.sentryFile, e.Hash, os.ModePerm)
|
||||
err := os.WriteFile(dml.sentryFile, e.Hash, os.ModePerm) //nolint:gosec
|
||||
if err != nil {
|
||||
log.Errorf("[DL] Unable write sentry file: %v", err)
|
||||
}
|
||||
case *steam.LoggedOnEvent:
|
||||
log.Debug("[DL] Login successfully!")
|
||||
d.client.Social.SetPersonaState(steamlang.EPersonaState_Online)
|
||||
go d.setPlaying()
|
||||
log.Debug("[DL] Steam login success!")
|
||||
dml.LoggedIn = true
|
||||
dml.connectFeedback <- LoginSuccess
|
||||
dml.client.Social.SetPersonaState(steamlang.EPersonaState_Online)
|
||||
go dml.setPlaying()
|
||||
case *steam.LogOnFailedEvent:
|
||||
log.Warningf("[DL] Steam login denied: %+v", e)
|
||||
switch e.Result {
|
||||
log.Debugf("[DL] Steam login denied: %+v", e)
|
||||
switch e.Result { //nolint:exhaustive
|
||||
case steamlang.EResult_AccountLogonDenied:
|
||||
log.Fatalf("[DL] Please provide AuthCode in config")
|
||||
case steamlang.EResult_InvalidPassword:
|
||||
_ = os.Remove(d.sentryFile)
|
||||
_ = os.Remove(d.loginKey)
|
||||
log.Warningf("[DL] Steam login wrong")
|
||||
go d.connectLoop()
|
||||
_ = os.Remove(dml.sentryFile)
|
||||
_ = os.Remove(dml.loginKey)
|
||||
log.Warningf("[DL] Steam login failed: InvalidPassword")
|
||||
case steamlang.EResult_InvalidLoginAuthCode:
|
||||
log.Fatalf("[DL] Steam auth code wrong")
|
||||
default:
|
||||
log.Warningf("[DL] Unhandled login failed event %+v", e)
|
||||
}
|
||||
case *steam.DisconnectedEvent:
|
||||
log.Warningf("Steam disconnected, trying to reconnect...")
|
||||
go d.connectLoop()
|
||||
log.Warningf("[DL] Steam disconnected, trying to reconnect...")
|
||||
dml.GCReady = false
|
||||
dml.LoggedIn = false
|
||||
dml.connectFeedback <- LoginFailed
|
||||
case *steam.LoginKeyEvent:
|
||||
log.Debug("Got login_key!")
|
||||
err := ioutil.WriteFile(d.loginKey, []byte(e.LoginKey), os.ModePerm)
|
||||
err := os.WriteFile(dml.loginKey, []byte(e.LoginKey), os.ModePerm) //nolint:gosec
|
||||
if err != nil {
|
||||
log.Errorf("[DL] Unable write login_key: %v", err)
|
||||
}
|
||||
case steam.FatalErrorEvent:
|
||||
case *steam.FatalErrorEvent:
|
||||
log.Debugf("[DL] Got FatalError %+v", e)
|
||||
case error:
|
||||
log.Fatalf("[DL] Got error %+v", e)
|
||||
log.Warningf("[DL] Error: %+v", e)
|
||||
dml.GCReady = false
|
||||
dml.LoggedIn = false
|
||||
dml.connectFeedback <- LoginFailed
|
||||
default:
|
||||
log.Debugf("[DL] %T: %v", e, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) setPlaying() {
|
||||
d.client.GC.SetGamesPlayed(APPID)
|
||||
d.client.GC.RegisterPacketHandler(d)
|
||||
go d.greetGC()
|
||||
func (dml *DemoMatchLoader) setPlaying() {
|
||||
dml.client.GC.SetGamesPlayed(APPID)
|
||||
dml.client.GC.RegisterPacketHandler(dml)
|
||||
go dml.greetGC()
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) greetGC() {
|
||||
for !d.GCReady {
|
||||
func (dml *DemoMatchLoader) greetGC() {
|
||||
for !dml.GCReady {
|
||||
var cs2Version uint32 = 2000202
|
||||
log.Debugf("[DL] Sending GC greeting")
|
||||
msg := protobuf.CMsgClientHello{}
|
||||
d.client.GC.Write(gamecoordinator.NewGCMsgProtobuf(APPID, uint32(protobuf.EGCBaseClientMsg_k_EMsgGCClientHello), &msg))
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
pVersion := steamlang.MsgClientLogon_CurrentProtocol
|
||||
msg.Version = &pVersion
|
||||
msg.Version = &cs2Version
|
||||
dml.client.GC.Write(gamecoordinator.NewGCMsgProtobuf(APPID, uint32(protobuf.EGCBaseClientMsg_k_EMsgGCClientHello), &msg))
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) requestDemoInfo(matchId uint64, conclusionId uint64, tokenId uint32) error {
|
||||
if !d.GCReady {
|
||||
return fmt.Errorf("gc not ready")
|
||||
func (dml *DemoMatchLoader) requestDemoInfo(matchID, conclusionID uint64, tokenID uint32) error {
|
||||
if !dml.GCReady {
|
||||
return errors.New("gc not ready")
|
||||
}
|
||||
|
||||
msg := protobuf.CMsgGCCStrike15V2_MatchListRequestFullGameInfo{Matchid: &matchId,
|
||||
Outcomeid: &conclusionId,
|
||||
Token: &tokenId}
|
||||
msg := protobuf.CMsgGCCStrike15V2_MatchListRequestFullGameInfo{
|
||||
Matchid: &matchID,
|
||||
Outcomeid: &conclusionID,
|
||||
Token: &tokenID,
|
||||
}
|
||||
|
||||
d.client.GC.Write(gamecoordinator.NewGCMsgProtobuf(APPID, uint32(protobuf.ECsgoGCMsg_k_EMsgGCCStrike15_v2_MatchListRequestFullGameInfo), &msg))
|
||||
dml.client.GC.Write(gamecoordinator.NewGCMsgProtobuf(APPID,
|
||||
uint32(protobuf.ECsgoGCMsg_k_EMsgGCCStrike15_v2_MatchListRequestFullGameInfo), &msg))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DemoMatchLoader) gcWorker(apiKey string, rl ratelimit.Limiter) {
|
||||
for demo := range d.parseDemo {
|
||||
d.parseMapL.Lock()
|
||||
if _, ok := d.parseMap[demo.ShareCode]; ok {
|
||||
log.Infof("[DL] Skipping %s: parsing in progress", demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
continue
|
||||
} else {
|
||||
d.parseMap[demo.ShareCode] = true
|
||||
}
|
||||
d.parseMapL.Unlock()
|
||||
|
||||
if !d.GCReady {
|
||||
log.Infof("[DL] Postponing match %d (%s): GC not ready", demo.MatchId, demo.ShareCode)
|
||||
time.Sleep(5 * time.Second)
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
d.parseDemo <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
matchId, _, _, err := DecodeSharecode(demo.ShareCode)
|
||||
if err != nil || matchId == 0 {
|
||||
log.Warningf("[DL] Can't parse match with sharecode %s: %v", demo.ShareCode, err)
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
continue
|
||||
}
|
||||
|
||||
iMatch, err := d.db.Match.Get(context.Background(), matchId)
|
||||
if err != nil {
|
||||
switch e := err.(type) {
|
||||
case *ent.NotFoundError:
|
||||
break
|
||||
default:
|
||||
log.Errorf("[DL] Failure trying to lookup match %d in db: %v", matchId, e)
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if iMatch.DemoParsed == false && iMatch.Date.After(time.Now().UTC().AddDate(0, 0, -30)) {
|
||||
log.Infof("[DL] Match %d is loaded, but not parsed. Try parsing.", iMatch.ID)
|
||||
demo.MatchId = matchId
|
||||
demo.Url = iMatch.ReplayURL
|
||||
demo.DecryptionKey = iMatch.DecryptionKey
|
||||
err := d.dp.ParseDemo(demo)
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Parsing demo from match %d failed: %v", demo.MatchId, err)
|
||||
}
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
continue
|
||||
}
|
||||
|
||||
log.Infof("[DL] Skipped match %d: already loaded", matchId)
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
continue
|
||||
}
|
||||
|
||||
log.Infof("[DL] Requesting match %d from GC", matchId)
|
||||
t := time.Now()
|
||||
|
||||
matchDetails, err := d.getMatchDetails(demo.ShareCode)
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Failure to get match-details for %d from GC: %v", demo.MatchId, err)
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
continue
|
||||
}
|
||||
|
||||
log.Infof("[DL] Recieved matchdetails for match %d (%s)", matchId, time.Since(t))
|
||||
|
||||
matchZero := matchDetails.GetMatches()[0]
|
||||
lastRound := matchZero.GetRoundstatsall()[len(matchZero.Roundstatsall)-1]
|
||||
var players []*ent.Player
|
||||
|
||||
for _, accountId := range lastRound.GetReservation().GetAccountIds() {
|
||||
tPlayer, err := utils.Player(d.db, AccountId2SteamId(accountId), apiKey, rl)
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Unable to get player for steamid %d: %v", AccountId2SteamId(accountId), err)
|
||||
continue
|
||||
}
|
||||
players = append(players, tPlayer)
|
||||
}
|
||||
|
||||
demo.Url = lastRound.GetMap()
|
||||
demo.MatchId = matchZero.GetMatchid()
|
||||
demo.DecryptionKey = []byte(strings.ToUpper(strconv.FormatUint(matchZero.GetWatchablematchinfo().GetClDecryptdataKeyPub(), 16)))
|
||||
|
||||
tMatch, err := d.db.Match.Create().
|
||||
SetID(matchZero.GetMatchid()).
|
||||
AddPlayers(players...).
|
||||
SetDate(time.Unix(int64(matchZero.GetMatchtime()), 0).UTC()).
|
||||
SetMaxRounds(int(lastRound.GetMaxRounds())).
|
||||
SetDuration(int(lastRound.GetMatchDuration())).
|
||||
SetShareCode(demo.ShareCode).
|
||||
SetReplayURL(lastRound.GetMap()).
|
||||
SetScoreTeamA(int(lastRound.GetTeamScores()[0])).
|
||||
SetScoreTeamB(int(lastRound.GetTeamScores()[1])).
|
||||
SetMatchResult(int(lastRound.GetMatchResult())).
|
||||
SetDecryptionKey(demo.DecryptionKey).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Unable to create match %d: %v", matchZero.GetMatchid(), err)
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
continue
|
||||
}
|
||||
|
||||
for i, mPlayer := range players {
|
||||
var (
|
||||
teamId int
|
||||
mk2 uint
|
||||
mk3 uint
|
||||
mk4 uint
|
||||
mk5 uint
|
||||
)
|
||||
|
||||
if i > 4 {
|
||||
teamId = 2
|
||||
} else {
|
||||
teamId = 1
|
||||
}
|
||||
|
||||
var oldKills int32
|
||||
for _, round := range matchZero.GetRoundstatsall() {
|
||||
kills, _, _, _, _, _ := playerStatsFromRound(round, mPlayer)
|
||||
|
||||
killDiff := kills - oldKills
|
||||
|
||||
switch killDiff {
|
||||
case 2:
|
||||
mk2++
|
||||
case 3:
|
||||
mk3++
|
||||
case 4:
|
||||
mk4++
|
||||
case 5:
|
||||
mk5++
|
||||
}
|
||||
oldKills = kills
|
||||
}
|
||||
|
||||
kills, deaths, assists, hs, score, mvp := playerStatsFromRound(lastRound, mPlayer)
|
||||
err := d.db.MatchPlayer.Create().
|
||||
SetMatches(tMatch).
|
||||
SetPlayers(mPlayer).
|
||||
SetTeamID(teamId).
|
||||
SetKills(int(kills)).
|
||||
SetDeaths(int(deaths)).
|
||||
SetAssists(int(assists)).
|
||||
SetMvp(uint(mvp)).
|
||||
SetScore(int(score)).
|
||||
SetHeadshot(int(hs)).
|
||||
SetMk2(mk2).
|
||||
SetMk3(mk3).
|
||||
SetMk4(mk4).
|
||||
SetMk5(mk5).
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Unable to create stats for player %d in match %d: %v", mPlayer.ID, tMatch.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
// clear cache or regen values player
|
||||
for _, p := range players {
|
||||
err = d.cache.Delete(context.Background(), fmt.Sprintf(utils.SideMetaCacheKey, p.ID))
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Unable to delete cache key %s: %v", fmt.Sprintf(utils.SideMetaCacheKey, p.ID), err)
|
||||
}
|
||||
|
||||
w, l, t, err := utils.GetWinLossTieForPlayer(p)
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Failure to calculate WinLossTie for player %d: %v", p.ID, err)
|
||||
continue
|
||||
}
|
||||
err = p.Update().SetWins(w).SetTies(t).SetLooses(l).Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Failure to save WinLossTie for player %d: %v", p.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
err = d.dp.ParseDemo(demo)
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Can't queue demo %d for parsing: %v", demo.MatchId, err)
|
||||
}
|
||||
d.parseMapL.Lock()
|
||||
delete(d.parseMap, demo.ShareCode)
|
||||
d.parseMapL.Unlock()
|
||||
func (dml *DemoMatchLoader) demoWorker() {
|
||||
for demo := range dml.dp.Done {
|
||||
dml.unlockDemo(demo)
|
||||
}
|
||||
}
|
||||
|
||||
func (dml *DemoMatchLoader) handleDemo(demo *Demo, apiKey string, rl *rate.Limiter) error {
|
||||
defer dml.unlockDemo(demo)
|
||||
|
||||
if !dml.GCReady {
|
||||
log.Infof("[DL] Postponing match %d (%s): GC not ready", demo.MatchID, demo.ShareCode)
|
||||
time.Sleep(5 * time.Second)
|
||||
dml.parseDemo <- demo
|
||||
return nil
|
||||
}
|
||||
|
||||
matchID, _, _, err := DecodeSharecode(demo.ShareCode)
|
||||
if err != nil || matchID == 0 {
|
||||
return fmt.Errorf("error decoding sharecode %s: %w", demo.ShareCode, err)
|
||||
}
|
||||
|
||||
iMatch, err := dml.db.Match.Get(context.Background(), matchID)
|
||||
if err != nil && !ent.IsNotFound(err) {
|
||||
return fmt.Errorf("error looking up match: %w", err)
|
||||
} else if err == nil {
|
||||
if !iMatch.DemoParsed && iMatch.Date.After(time.Now().UTC().AddDate(0, 0, -30)) {
|
||||
log.Infof("[DL] Match %d is loaded, but not parsed. Try parsing.", iMatch.ID)
|
||||
demo.MatchID = matchID
|
||||
demo.URL = iMatch.ReplayURL
|
||||
demo.DecryptionKey = iMatch.DecryptionKey
|
||||
err := dml.dp.ParseDemo(demo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing match %d: %w", demo.MatchID, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Infof("[DL] Skipped match %d: already loaded", matchID)
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Infof("[DL] Requesting match %d from GC", matchID)
|
||||
t := time.Now()
|
||||
|
||||
matchDetails, err := dml.getMatchDetails(demo.ShareCode)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting match-details for %d: %w", demo.MatchID, err)
|
||||
}
|
||||
|
||||
log.Infof("[DL] Received matchdetails for match %d (%s)", matchID, time.Since(t))
|
||||
|
||||
// init tx
|
||||
tx, err := dml.db.Tx(context.Background())
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error creating transaction")
|
||||
}
|
||||
|
||||
matchZero := matchDetails.GetMatches()[0]
|
||||
lastRound := matchZero.GetRoundstatsall()[len(matchZero.GetRoundstatsall())-1]
|
||||
var players []*ent.Player //nolint:prealloc
|
||||
|
||||
for _, accountID := range lastRound.GetReservation().GetAccountIds() {
|
||||
tPlayer, err := utils.Player(tx.Client(), AccountID2SteamID(accountID), apiKey, rl)
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
return fmt.Errorf("error getting player for steamid %d: %w", AccountID2SteamID(accountID), err)
|
||||
}
|
||||
players = append(players, tPlayer)
|
||||
}
|
||||
|
||||
demo.URL = lastRound.GetMap()
|
||||
demo.MatchID = matchZero.GetMatchid()
|
||||
demo.DecryptionKey = []byte(strings.ToUpper(fmt.Sprintf("%016x", matchZero.GetWatchablematchinfo().GetClDecryptdataKeyPub())))
|
||||
|
||||
tMatch, err := tx.Match.Create().
|
||||
SetID(matchZero.GetMatchid()).
|
||||
AddPlayers(players...).
|
||||
SetDate(time.Unix(int64(matchZero.GetMatchtime()), 0).UTC()).
|
||||
SetMaxRounds(int(lastRound.GetMaxRounds())).
|
||||
SetDuration(int(lastRound.GetMatchDuration())).
|
||||
SetShareCode(demo.ShareCode).
|
||||
SetReplayURL(lastRound.GetMap()).
|
||||
SetScoreTeamA(int(lastRound.GetTeamScores()[0])).
|
||||
SetScoreTeamB(int(lastRound.GetTeamScores()[1])).
|
||||
SetMatchResult(int(lastRound.GetMatchResult())).
|
||||
SetDecryptionKey(demo.DecryptionKey).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
return fmt.Errorf("error creating match %d: %w", matchZero.GetMatchid(), err)
|
||||
}
|
||||
|
||||
for i, mPlayer := range players {
|
||||
var (
|
||||
teamID int
|
||||
mk2, mk3, mk4, mk5 uint
|
||||
)
|
||||
|
||||
if i > 4 {
|
||||
teamID = 2
|
||||
} else {
|
||||
teamID = 1
|
||||
}
|
||||
|
||||
var oldKills int32
|
||||
for _, round := range matchZero.GetRoundstatsall() {
|
||||
roundStats := playerStatsFromRound(round, mPlayer)
|
||||
|
||||
switch roundStats.Kills - oldKills {
|
||||
case 2:
|
||||
mk2++
|
||||
case 3:
|
||||
mk3++
|
||||
case 4:
|
||||
mk4++
|
||||
case 5:
|
||||
mk5++
|
||||
}
|
||||
oldKills = roundStats.Kills
|
||||
}
|
||||
|
||||
roundStats := playerStatsFromRound(lastRound, mPlayer)
|
||||
err = tx.MatchPlayer.Create().
|
||||
SetMatches(tMatch).
|
||||
SetPlayers(mPlayer).
|
||||
SetTeamID(teamID).
|
||||
SetKills(int(roundStats.Kills)).
|
||||
SetDeaths(int(roundStats.Deaths)).
|
||||
SetAssists(int(roundStats.Assists)).
|
||||
SetMvp(uint(roundStats.MPVs)). //nolint:gosec
|
||||
SetScore(int(roundStats.Score)).
|
||||
SetHeadshot(int(roundStats.Headshots)).
|
||||
SetMk2(mk2).
|
||||
SetMk3(mk3).
|
||||
SetMk4(mk4).
|
||||
SetMk5(mk5).
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
return fmt.Errorf("error creating stats for player %d in match %d: %w", mPlayer.ID, tMatch.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
// clear cache or regen values player
|
||||
for _, p := range players {
|
||||
err = dml.cache.Delete(context.Background(), fmt.Sprintf(utils.SideMetaCacheKey, p.ID))
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
return fmt.Errorf("error deleting cache key %s: %w", fmt.Sprintf(utils.SideMetaCacheKey, p.ID), err)
|
||||
}
|
||||
|
||||
w, l, t, err := utils.GetWinLossTieForPlayer(p)
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
return fmt.Errorf("error calculating WinLossTie for player %d: %w", p.ID, err)
|
||||
}
|
||||
err = p.Update().SetWins(w).SetTies(t).SetLooses(l).Exec(context.Background())
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
return fmt.Errorf("error saving WinLossTie for player %d: %w", p.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "[DP] error committing to db")
|
||||
}
|
||||
|
||||
err = dml.dp.ParseDemo(demo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error queueing demo %d for parsing: %w", demo.MatchID, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dml *DemoMatchLoader) gcWorker(apiKey string, rl *rate.Limiter) {
|
||||
for demo := range dml.parseDemo {
|
||||
err := dml.handleDemo(demo, apiKey, rl)
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Error handling demo: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,34 +4,38 @@ import (
|
||||
"bytes"
|
||||
"compress/bzip2"
|
||||
"context"
|
||||
"csgowtfd/ent"
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/player"
|
||||
"encoding/gob"
|
||||
"errors"
|
||||
"fmt"
|
||||
"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"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aclements/go-moremath/stats"
|
||||
"github.com/golang/geo/r2"
|
||||
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs"
|
||||
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/common"
|
||||
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/events"
|
||||
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/msg"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/utils"
|
||||
)
|
||||
|
||||
type Demo struct {
|
||||
ShareCode string
|
||||
MatchId uint64
|
||||
Url string
|
||||
MatchID uint64
|
||||
URL string
|
||||
DecryptionKey []byte
|
||||
}
|
||||
|
||||
type DemoParser struct {
|
||||
demoQueue chan *Demo
|
||||
tempDir string
|
||||
db *ent.Client
|
||||
sprayTimeout int
|
||||
Done chan *Demo
|
||||
}
|
||||
|
||||
type Encounter struct {
|
||||
@@ -54,9 +58,9 @@ type Spray struct {
|
||||
Spray [][]float32
|
||||
}
|
||||
|
||||
type DemoNotFoundError struct {
|
||||
error
|
||||
}
|
||||
var (
|
||||
ErrorDemoNotFound = errors.New("demo not found")
|
||||
)
|
||||
|
||||
func (s *Sprays) Add(currentTime time.Duration, sprayPoint []float32, timeout int) {
|
||||
sprayFound := false
|
||||
@@ -105,64 +109,52 @@ func (s *Sprays) Avg() (avg [][]float32) {
|
||||
return
|
||||
}
|
||||
|
||||
func (p *DemoParser) Setup(db *ent.Client, worker int, sprayTimeout int) error {
|
||||
p.demoQueue = make(chan *Demo, 1000)
|
||||
p.db = db
|
||||
p.sprayTimeout = sprayTimeout
|
||||
for i := 0; i < worker; i++ {
|
||||
go p.parseWorker()
|
||||
func (dp *DemoParser) Setup(db *ent.Client, worker, sprayTimeout int) error {
|
||||
dp.demoQueue = make(chan *Demo, 1000)
|
||||
dp.db = db
|
||||
dp.sprayTimeout = sprayTimeout
|
||||
dp.Done = make(chan *Demo, worker)
|
||||
for range worker {
|
||||
go dp.parseWorker()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DemoParser) ParseDemo(demo *Demo) error {
|
||||
func (dp *DemoParser) ParseDemo(demo *Demo) error {
|
||||
select {
|
||||
case p.demoQueue <- demo:
|
||||
case dp.demoQueue <- demo:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("queue full")
|
||||
return errors.New("queue full")
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Demo) download() (io.Reader, error) {
|
||||
log.Debugf("[DP] Downloading replay for %d", d.MatchId)
|
||||
log.Debugf("[DP] Downloading replay for %d", d.MatchID)
|
||||
|
||||
r, err := http.Get(d.Url)
|
||||
r, err := http.Get(d.URL) //nolint:bodyclose
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if r.StatusCode != http.StatusOK {
|
||||
return nil, DemoNotFoundError{fmt.Errorf("demo not found")}
|
||||
return nil, ErrorDemoNotFound
|
||||
}
|
||||
return bzip2.NewReader(r.Body), nil
|
||||
}
|
||||
|
||||
func (p *DemoParser) getDBPlayer(demo *Demo, demoPlayer *common.Player) (*ent.MatchPlayer, error) {
|
||||
tMatchPlayer, err := p.db.MatchPlayer.Query().WithMatches(func(q *ent.MatchQuery) {
|
||||
q.Where(match.ID(demo.MatchId))
|
||||
}).WithPlayers(func(q *ent.PlayerQuery) {
|
||||
q.Where(player.ID(demoPlayer.SteamID64))
|
||||
}).Only(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return tMatchPlayer, nil
|
||||
}
|
||||
|
||||
func (p *DemoParser) MatchPlayerBySteamID(stats []*ent.MatchPlayer, steamId uint64) (*ent.MatchPlayer, error) {
|
||||
for _, tStats := range stats {
|
||||
func (dp *DemoParser) MatchPlayerBySteamID(mStats []*ent.MatchPlayer, steamID uint64) (*ent.MatchPlayer, error) {
|
||||
for _, tStats := range mStats {
|
||||
tPLayer, err := tStats.Edges.PlayersOrErr()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unbale to get Stats from statList: %v", err)
|
||||
return nil, fmt.Errorf("unable to get stats from statList: %w", err)
|
||||
}
|
||||
if tPLayer.ID == steamId {
|
||||
if tPLayer.ID == steamID {
|
||||
return tStats, nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("player not found")
|
||||
return nil, errors.New("player not found")
|
||||
}
|
||||
|
||||
func setMatchPlayerColor(matchPlayer *ent.MatchPlayer, demoPlayer *common.Player) {
|
||||
@@ -171,63 +163,80 @@ func setMatchPlayerColor(matchPlayer *ent.MatchPlayer, demoPlayer *common.Player
|
||||
}
|
||||
|
||||
matchPlayer.Crosshair = demoPlayer.CrosshairCode()
|
||||
switch demoPlayer.Color() {
|
||||
color, _ := demoPlayer.ColorOrErr()
|
||||
switch color {
|
||||
case common.Yellow:
|
||||
matchPlayer.Color = matchplayer.ColorYellow
|
||||
break
|
||||
case common.Green:
|
||||
matchPlayer.Color = matchplayer.ColorGreen
|
||||
break
|
||||
case common.Purple:
|
||||
matchPlayer.Color = matchplayer.ColorPurple
|
||||
break
|
||||
case common.Blue:
|
||||
matchPlayer.Color = matchplayer.ColorBlue
|
||||
break
|
||||
case common.Orange:
|
||||
matchPlayer.Color = matchplayer.ColorOrange
|
||||
break
|
||||
case common.Grey:
|
||||
matchPlayer.Color = matchplayer.ColorGrey
|
||||
}
|
||||
}
|
||||
|
||||
func (p *DemoParser) parseWorker() {
|
||||
for demo := range p.demoQueue {
|
||||
if demo.MatchId == 0 {
|
||||
func (dp *DemoParser) parseWorker() {
|
||||
workloop:
|
||||
for demo := range dp.demoQueue {
|
||||
if demo.MatchID == 0 {
|
||||
log.Warningf("[DP] can't parse match %s: no matchid found", demo.ShareCode)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
tMatch, err := p.db.Match.Get(context.Background(), demo.MatchId)
|
||||
// init tx
|
||||
tx, err := dp.db.Tx(context.Background())
|
||||
if err != nil {
|
||||
log.Errorf("[DP] Unable to get match %d: %v", demo.MatchId, err)
|
||||
log.Errorf("[DP] error creating transaction: %v", err)
|
||||
dp.Done <- demo
|
||||
return
|
||||
}
|
||||
|
||||
tMatch, err := tx.Match.Get(context.Background(), demo.MatchID)
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to get match %d: %v", demo.MatchID, err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
if tMatch.DemoParsed {
|
||||
log.Infof("[DP] skipped already parsed %d", demo.MatchId)
|
||||
_ = utils.Rollback(tx, err)
|
||||
log.Infof("[DP] skipped already parsed %d", demo.MatchID)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
startTime := time.Now()
|
||||
fDemo, err := demo.download()
|
||||
if err != nil {
|
||||
if _, ok := err.(DemoNotFoundError); ok {
|
||||
if errors.Is(err, ErrorDemoNotFound) {
|
||||
_ = utils.Rollback(tx, err)
|
||||
if tMatch.Date.Before(time.Now().UTC().AddDate(0, 0, -30)) {
|
||||
log.Infof("[DP] demo expired for match %d", tMatch.ID)
|
||||
} else {
|
||||
log.Infof("[DP] demo 404 not found for match %d. Trying again later.", demo.MatchId)
|
||||
log.Infof("[DP] demo 404 not found for match %d. Retrying later.", demo.MatchID)
|
||||
}
|
||||
continue
|
||||
} else {
|
||||
log.Errorf("[DP] Unable to download demo for %d: %v", demo.MatchId, err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to download demo for %d: %v", demo.MatchID, err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
downloadTime := time.Since(startTime)
|
||||
|
||||
tStats, err := tMatch.QueryStats().WithPlayers().All(context.Background())
|
||||
if err != nil {
|
||||
log.Errorf("[DP] Failed to find players for match %d: %v", demo.MatchId, err)
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Failed to find players for match %d: %v", demo.MatchID, err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -242,30 +251,30 @@ func (p *DemoParser) parseWorker() {
|
||||
EqV int
|
||||
Bank int
|
||||
Spent int
|
||||
}, 0)
|
||||
})
|
||||
encounters := make([]*Encounter, 0)
|
||||
spays := make([]*Sprays, 0)
|
||||
pingMap := make(map[uint64][]float64)
|
||||
|
||||
cfg := demoinfocs.DefaultParserConfig
|
||||
if len(demo.DecryptionKey) >= 16 {
|
||||
cfg.NetMessageDecryptionKey = demo.DecryptionKey
|
||||
}
|
||||
demoParser := demoinfocs.NewParserWithConfig(fDemo, cfg)
|
||||
|
||||
// onChatMessage
|
||||
demoParser.RegisterEventHandler(func(e events.ChatMessage) {
|
||||
gs := demoParser.GameState()
|
||||
tAttacker, err := p.MatchPlayerBySteamID(tStats, e.Sender.SteamID64)
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Unable to get player for id %d: %v", e.Sender.SteamID64, err)
|
||||
return
|
||||
}
|
||||
if e.Sender != nil {
|
||||
gs := demoParser.GameState()
|
||||
tAttacker, err := dp.MatchPlayerBySteamID(tStats, e.Sender.SteamID64)
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Unable to get player for id %d: %v", e.Sender.SteamID64, err)
|
||||
return
|
||||
}
|
||||
|
||||
tAttacker.Edges.Messages = append(tAttacker.Edges.Messages, &ent.Messages{
|
||||
Message: e.Text,
|
||||
AllChat: e.IsChatAll,
|
||||
Tick: gs.IngameTick(),
|
||||
})
|
||||
tAttacker.Edges.Messages = append(tAttacker.Edges.Messages, &ent.Messages{
|
||||
Message: e.Text,
|
||||
AllChat: e.IsChatAll,
|
||||
Tick: gs.IngameTick(),
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// onPlayerSpotted
|
||||
@@ -292,7 +301,7 @@ func (p *DemoParser) parseWorker() {
|
||||
for _, spray := range spays {
|
||||
if e.Shooter.SteamID64 == spray.Sprayer && int(e.Weapon.Type) == spray.Weapon {
|
||||
playerWeaponFound = true
|
||||
spray.Add(demoParser.CurrentTime(), []float32{e.Shooter.ViewDirectionX(), e.Shooter.ViewDirectionY()}, p.sprayTimeout)
|
||||
spray.Add(demoParser.CurrentTime(), []float32{e.Shooter.ViewDirectionX(), e.Shooter.ViewDirectionY()}, dp.sprayTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,15 +320,15 @@ func (p *DemoParser) parseWorker() {
|
||||
return
|
||||
}
|
||||
|
||||
tAttacker, err := p.MatchPlayerBySteamID(tStats, e.Attacker.SteamID64)
|
||||
tAttacker, err := dp.MatchPlayerBySteamID(tStats, e.Attacker.SteamID64)
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Unable to get player for id %d: %v", e.Attacker.SteamID64, err)
|
||||
return
|
||||
}
|
||||
if e.Attacker.Team == e.Player.Team {
|
||||
tAttacker.DmgTeam += uint(e.HealthDamageTaken)
|
||||
tAttacker.DmgTeam += uint(e.HealthDamageTaken) //nolint:gosec
|
||||
} else {
|
||||
tAttacker.DmgEnemy += uint(e.HealthDamageTaken)
|
||||
tAttacker.DmgEnemy += uint(e.HealthDamageTaken) //nolint:gosec
|
||||
}
|
||||
|
||||
if _, ok := eqMap[e.Attacker.SteamID64]; !ok {
|
||||
@@ -334,7 +343,7 @@ func (p *DemoParser) parseWorker() {
|
||||
found := false
|
||||
for _, di := range eqMap[e.Attacker.SteamID64] {
|
||||
if di.Eq == int(e.Weapon.Type) && di.HitGroup == int(e.HitGroup) {
|
||||
di.Dmg += uint(e.HealthDamageTaken)
|
||||
di.Dmg += uint(e.HealthDamageTaken) //nolint:gosec
|
||||
found = true
|
||||
}
|
||||
}
|
||||
@@ -345,18 +354,18 @@ func (p *DemoParser) parseWorker() {
|
||||
HitGroup int
|
||||
Dmg uint
|
||||
To uint64
|
||||
}{Eq: int(e.Weapon.Type), HitGroup: int(e.HitGroup), Dmg: uint(e.HealthDamageTaken), To: e.Player.SteamID64})
|
||||
}{Eq: int(e.Weapon.Type), HitGroup: int(e.HitGroup), Dmg: uint(e.HealthDamageTaken), To: e.Player.SteamID64}) //nolint:gosec
|
||||
}
|
||||
})
|
||||
|
||||
// onRoundEnd
|
||||
demoParser.RegisterEventHandler(func(e events.RoundEnd) {
|
||||
demoParser.RegisterEventHandler(func(_ events.RoundEnd) {
|
||||
gs := demoParser.GameState()
|
||||
if !gs.IsMatchStarted() {
|
||||
return
|
||||
}
|
||||
|
||||
// track eco
|
||||
// track eco & ping
|
||||
for _, p := range gs.Participants().Playing() {
|
||||
ecoMap[p.SteamID64] = append(ecoMap[p.SteamID64], &struct {
|
||||
Round int
|
||||
@@ -364,6 +373,8 @@ func (p *DemoParser) parseWorker() {
|
||||
Bank int
|
||||
Spent int
|
||||
}{Round: gs.TotalRoundsPlayed(), EqV: p.EquipmentValueCurrent(), Bank: p.Money(), Spent: p.MoneySpentThisRound()})
|
||||
|
||||
pingMap[p.SteamID64] = append(pingMap[p.SteamID64], float64(p.Ping()))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -373,7 +384,7 @@ func (p *DemoParser) parseWorker() {
|
||||
return
|
||||
}
|
||||
|
||||
tAttacker, err := p.MatchPlayerBySteamID(tStats, e.Attacker.SteamID64)
|
||||
tAttacker, err := dp.MatchPlayerBySteamID(tStats, e.Attacker.SteamID64)
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Unable to get player for id %d: %v", e.Attacker.SteamID64, err)
|
||||
return
|
||||
@@ -401,7 +412,7 @@ func (p *DemoParser) parseWorker() {
|
||||
// onPlayerConnected
|
||||
demoParser.RegisterEventHandler(func(e events.PlayerTeamChange) {
|
||||
if e.Player != nil && e.Player.SteamID64 != 0 {
|
||||
tMatchPlayer, err := p.MatchPlayerBySteamID(tStats, e.Player.SteamID64)
|
||||
tMatchPlayer, err := dp.MatchPlayerBySteamID(tStats, e.Player.SteamID64)
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Unable to get player for id %d: %v", e.Player.SteamID64, err)
|
||||
return
|
||||
@@ -411,12 +422,12 @@ func (p *DemoParser) parseWorker() {
|
||||
})
|
||||
|
||||
// onMatchStart
|
||||
demoParser.RegisterEventHandler(func(e events.MatchStart) {
|
||||
demoParser.RegisterEventHandler(func(_ events.MatchStart) {
|
||||
gs := demoParser.GameState()
|
||||
|
||||
for _, demoPlayer := range gs.Participants().Playing() {
|
||||
if demoPlayer != nil && demoPlayer.SteamID64 != 0 {
|
||||
tMatchPlayer, err := p.MatchPlayerBySteamID(tStats, demoPlayer.SteamID64)
|
||||
tMatchPlayer, err := dp.MatchPlayerBySteamID(tStats, demoPlayer.SteamID64)
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Unable to get player for id %d: %v", demoPlayer.SteamID64, err)
|
||||
return
|
||||
@@ -429,7 +440,7 @@ func (p *DemoParser) parseWorker() {
|
||||
// onRankUpdate
|
||||
demoParser.RegisterEventHandler(func(e events.RankUpdate) {
|
||||
if e.SteamID64() != 0 {
|
||||
tMatchPlayer, err := p.MatchPlayerBySteamID(tStats, e.SteamID64())
|
||||
tMatchPlayer, err := dp.MatchPlayerBySteamID(tStats, e.SteamID64())
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Unable to get player for id %d: %v", e.SteamID64(), err)
|
||||
return
|
||||
@@ -442,13 +453,26 @@ func (p *DemoParser) parseWorker() {
|
||||
|
||||
err = demoParser.ParseToEnd()
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Error parsing replay: %v", err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
err = tMatch.Update().SetMap(demoParser.Header().MapName).SetDemoParsed(true).Exec(context.Background())
|
||||
var mapName string
|
||||
demoParser.RegisterNetMessageHandler(func(m *msg.CDemoFileHeader) {
|
||||
mapName = m.GetMapName()
|
||||
})
|
||||
|
||||
err = tMatch.Update().
|
||||
SetMap(mapName).
|
||||
SetDemoParsed(true).
|
||||
SetTickRate(demoParser.TickRate()).
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Errorf("[DP] Unable to update match %d in database: %v", demo.MatchId, err)
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to update match %d in database: %v", demo.MatchID, err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -457,6 +481,8 @@ func (p *DemoParser) parseWorker() {
|
||||
tMatchPlayer.Color = matchplayer.ColorGrey
|
||||
}
|
||||
|
||||
avgPing := stats.GeoMean(pingMap[tMatchPlayer.PlayerStats])
|
||||
|
||||
nMatchPLayer, err := tMatchPlayer.Update().
|
||||
SetDmgTeam(tMatchPlayer.DmgTeam).
|
||||
SetDmgEnemy(tMatchPlayer.DmgEnemy).
|
||||
@@ -467,6 +493,7 @@ func (p *DemoParser) parseWorker() {
|
||||
SetRankOld(tMatchPlayer.RankOld).
|
||||
SetRankNew(tMatchPlayer.RankNew).
|
||||
SetColor(tMatchPlayer.Color).
|
||||
SetAvgPing(avgPing).
|
||||
SetCrosshair(tMatchPlayer.Crosshair).
|
||||
SetFlashDurationTeam(tMatchPlayer.FlashDurationTeam).
|
||||
SetFlashDurationSelf(tMatchPlayer.FlashDurationSelf).
|
||||
@@ -478,21 +505,41 @@ func (p *DemoParser) parseWorker() {
|
||||
SetDmgEnemy(tMatchPlayer.DmgEnemy).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to update stats %d in database: %v", tMatchPlayer.PlayerStats, err)
|
||||
continue
|
||||
dp.Done <- demo
|
||||
continue workloop
|
||||
}
|
||||
|
||||
for _, eqDmg := range eqMap[tMatchPlayer.PlayerStats] {
|
||||
err := p.db.Weapon.Create().SetStat(nMatchPLayer).SetDmg(eqDmg.Dmg).SetVictim(eqDmg.To).SetHitGroup(eqDmg.HitGroup).SetEqType(eqDmg.Eq).Exec(context.Background())
|
||||
err = tx.Weapon.Create().
|
||||
SetStat(nMatchPLayer).
|
||||
SetDmg(eqDmg.Dmg).
|
||||
SetVictim(eqDmg.To).
|
||||
SetHitGroup(eqDmg.HitGroup).
|
||||
SetEqType(eqDmg.Eq).
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to create WeaponStat: %v", err)
|
||||
dp.Done <- demo
|
||||
continue workloop
|
||||
}
|
||||
}
|
||||
|
||||
for _, eco := range ecoMap[tMatchPlayer.PlayerStats] {
|
||||
err := p.db.RoundStats.Create().SetMatchPlayer(nMatchPLayer).SetRound(uint(eco.Round)).SetBank(uint(eco.Bank)).SetEquipment(uint(eco.EqV)).SetSpent(uint(eco.Spent)).Exec(context.Background())
|
||||
err := tx.RoundStats.Create().
|
||||
SetMatchPlayer(nMatchPLayer).
|
||||
SetRound(uint(eco.Round)). //nolint:gosec
|
||||
SetBank(uint(eco.Bank)). //nolint:gosec
|
||||
SetEquipment(uint(eco.EqV)). //nolint:gosec
|
||||
SetSpent(uint(eco.Spent)). //nolint:gosec
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to create RoundStat: %v", err)
|
||||
dp.Done <- demo
|
||||
continue workloop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,35 +550,59 @@ func (p *DemoParser) parseWorker() {
|
||||
enc := gob.NewEncoder(sprayBuf)
|
||||
err = enc.Encode(sprayAvg)
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Warningf("[DP] Failure to encode spray %v as bytes: %v", spray, err)
|
||||
continue
|
||||
dp.Done <- demo
|
||||
continue workloop
|
||||
}
|
||||
|
||||
err = p.db.Spray.Create().SetMatchPlayers(nMatchPLayer).SetWeapon(spray.Weapon).SetSpray(sprayBuf.Bytes()).Exec(context.Background())
|
||||
err = tx.Spray.Create().
|
||||
SetMatchPlayers(nMatchPLayer).
|
||||
SetWeapon(spray.Weapon).
|
||||
SetSpray(sprayBuf.Bytes()).
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Warningf("[DP] Failure adding spray to database: %v", err)
|
||||
dp.Done <- demo
|
||||
continue workloop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bulk := make([]*ent.MessagesCreate, 0)
|
||||
var bulk []*ent.MessagesCreate
|
||||
for _, msg := range tMatchPlayer.Edges.Messages {
|
||||
bulk = append(bulk, p.db.Messages.Create().SetMessage(msg.Message).SetAllChat(msg.AllChat).SetTick(msg.Tick).SetMatchPlayer(tMatchPlayer))
|
||||
bulk = append(bulk, tx.Messages.Create().
|
||||
SetMessage(strings.ToValidUTF8(msg.Message, "")).
|
||||
SetAllChat(msg.AllChat).
|
||||
SetTick(msg.Tick).
|
||||
SetMatchPlayer(tMatchPlayer))
|
||||
}
|
||||
if len(bulk) > 0 {
|
||||
err = p.db.Messages.CreateBulk(bulk...).Exec(context.Background())
|
||||
err = tx.Messages.CreateBulk(bulk...).Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[DP] Failure adding messages to database: %v", err)
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Warningf("[DP] Failure adding messages to db: %v", err)
|
||||
dp.Done <- demo
|
||||
continue workloop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("[DP] parsed match %d (took %s/%s)", demo.MatchId, downloadTime, time.Since(startTime))
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
log.Errorf("[DP] error commting to db: %v", err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
|
||||
log.Infof("[DP] parsed match %d (took %s/%s)", demo.MatchID, downloadTime, time.Since(startTime))
|
||||
|
||||
err = demoParser.Close()
|
||||
if err != nil {
|
||||
log.Errorf("[DP] Unable close demo file for match %d: %v", demo.MatchId, err)
|
||||
log.Errorf("[DP] Unable close demo file for match %d: %v", demo.MatchID, err)
|
||||
}
|
||||
dp.Done <- demo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package csgo
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"regexp"
|
||||
@@ -9,10 +10,11 @@ import (
|
||||
)
|
||||
|
||||
//goland:noinspection SpellCheckingInspection
|
||||
var DICT = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789"
|
||||
var sharecodeRexEx = regexp.MustCompile("^CSGO(?:-?[\\w]{5}){5}$")
|
||||
const Base57Chars = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789"
|
||||
|
||||
func DecodeSharecode(code string) (uint64, uint64, uint16, error) {
|
||||
var sharecodeRexEx = regexp.MustCompile(`^CSGO(?:-?\w{5}){5}$`)
|
||||
|
||||
func DecodeSharecode(code string) (matchID, outcomeID uint64, tokenID uint16, err error) {
|
||||
if !sharecodeRexEx.MatchString(code) {
|
||||
return 0, 0, 0, fmt.Errorf("not a CSGO sharecode: %s", code)
|
||||
}
|
||||
@@ -21,24 +23,24 @@ func DecodeSharecode(code string) (uint64, uint64, uint16, error) {
|
||||
|
||||
chars := ReverseString(strings.Split(cleanCode, ""))
|
||||
bigInt := new(big.Int)
|
||||
dictLenBig := big.NewInt(int64(len(DICT)))
|
||||
dictLenBig := big.NewInt(int64(len(Base57Chars)))
|
||||
|
||||
for _, c := range chars {
|
||||
bigInt.Mul(bigInt, dictLenBig)
|
||||
bigInt.Add(bigInt, big.NewInt(int64(strings.Index(DICT, c))))
|
||||
bigInt.Add(bigInt, big.NewInt(int64(strings.Index(Base57Chars, c))))
|
||||
}
|
||||
|
||||
if bigInt.BitLen() > 144 {
|
||||
return 0, 0, 0, fmt.Errorf("invalid sharecode")
|
||||
return 0, 0, 0, errors.New("invalid sharecode")
|
||||
}
|
||||
bytes := make([]byte, 18)
|
||||
bigInt.FillBytes(bytes)
|
||||
|
||||
matchId := binary.LittleEndian.Uint64(bytes[0:8])
|
||||
outcomeId := binary.LittleEndian.Uint64(bytes[8:16])
|
||||
tokenId := binary.LittleEndian.Uint16(bytes[16:18])
|
||||
matchID = binary.LittleEndian.Uint64(bytes[0:8])
|
||||
outcomeID = binary.LittleEndian.Uint64(bytes[8:16])
|
||||
tokenID = binary.LittleEndian.Uint16(bytes[16:18])
|
||||
|
||||
return matchId, outcomeId, tokenId, nil
|
||||
return
|
||||
}
|
||||
|
||||
func ReverseString(numbers []string) []string {
|
||||
|
||||
@@ -1,42 +1,45 @@
|
||||
package csgo
|
||||
package csgo_test
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
|
||||
//goland:noinspection SpellCheckingInspection
|
||||
func TestGoodSharecodes(t *testing.T) {
|
||||
eMatchId := uint64(3505575050994516382)
|
||||
eOutcomeId := uint64(3505581094013501947)
|
||||
eTokenId := uint16(12909)
|
||||
"somegit.dev/csgowtf/csgowtfd/csgo"
|
||||
)
|
||||
|
||||
matchId, outcomeId, tokenId, err := DecodeSharecode("CSGO-P9k3F-eVL9n-LZLXN-DrBGF-VKD7K")
|
||||
func TestGoodSharecodes(t *testing.T) { //nolint:paralleltest
|
||||
eMatchID := uint64(3505575050994516382)
|
||||
eOutcomeID := uint64(3505581094013501947)
|
||||
eTokenID := uint16(12909)
|
||||
|
||||
matchID, outcomeId, tokenId, err := csgo.DecodeSharecode("CSGO-P9k3F-eVL9n-LZLXN-DrBGF-VKD7K")
|
||||
if err != nil {
|
||||
t.Log("error should be nil", err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if matchId != eMatchId {
|
||||
t.Logf("matchID should be %d, is %d", eMatchId, matchId)
|
||||
if matchID != eMatchID {
|
||||
t.Logf("matchID should be %d, is %d", eMatchID, matchID)
|
||||
t.Fail()
|
||||
}
|
||||
if outcomeId != eOutcomeId {
|
||||
t.Logf("outcomeID should be %d, is %d", eOutcomeId, outcomeId)
|
||||
if outcomeId != eOutcomeID {
|
||||
t.Logf("outcomeID should be %d, is %d", eOutcomeID, outcomeId)
|
||||
t.Fail()
|
||||
}
|
||||
if tokenId != eTokenId {
|
||||
t.Logf("tokenID should be %d, is %d", eTokenId, tokenId)
|
||||
if tokenId != eTokenID {
|
||||
t.Logf("tokenID should be %d, is %d", eTokenID, tokenId)
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestBadSharecodes(t *testing.T) {
|
||||
matchId, outcomeId, tokenId, err := DecodeSharecode("CSGO-AAAAA-AAAAA-AAAAA-AAAAA-AAAAA")
|
||||
matchID, outcomeId, tokenId, err := csgo.DecodeSharecode("CSGO-AAAAA-AAAAA-AAAAA-AAAAA-AAAAA")
|
||||
if err != nil {
|
||||
t.Log("error should not be set", err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if matchId != 0 {
|
||||
t.Logf("matchID should be 0, is %d", matchId)
|
||||
if matchID != 0 {
|
||||
t.Logf("matchID should be 0, is %d", matchID)
|
||||
t.Fail()
|
||||
}
|
||||
if outcomeId != 0 {
|
||||
@@ -48,14 +51,14 @@ func TestBadSharecodes(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
matchId, outcomeId, tokenId, err = DecodeSharecode("CSGO-99999-99999-99999-99999-99999")
|
||||
matchID, outcomeId, tokenId, err = csgo.DecodeSharecode("CSGO-99999-99999-99999-99999-99999")
|
||||
if err == nil {
|
||||
t.Log("error should be set", err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if matchId != 0 {
|
||||
t.Logf("matchID should be 0, is %d", matchId)
|
||||
if matchID != 0 {
|
||||
t.Logf("matchID should be 0, is %d", matchID)
|
||||
t.Fail()
|
||||
}
|
||||
if outcomeId != 0 {
|
||||
|
||||
684
ent/client.go
684
ent/client.go
File diff suppressed because it is too large
Load Diff
@@ -1,65 +0,0 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
)
|
||||
|
||||
// Option function to configure the client.
|
||||
type Option func(*config)
|
||||
|
||||
// Config is the configuration for the client and its builder.
|
||||
type config struct {
|
||||
// driver used for executing database requests.
|
||||
driver dialect.Driver
|
||||
// debug enable a debug logging.
|
||||
debug bool
|
||||
// log used for logging on debug mode.
|
||||
log func(...interface{})
|
||||
// hooks to execute on mutations.
|
||||
hooks *hooks
|
||||
}
|
||||
|
||||
// hooks per client, for fast access.
|
||||
type hooks struct {
|
||||
Match []ent.Hook
|
||||
MatchPlayer []ent.Hook
|
||||
Messages []ent.Hook
|
||||
Player []ent.Hook
|
||||
RoundStats []ent.Hook
|
||||
Spray []ent.Hook
|
||||
Weapon []ent.Hook
|
||||
}
|
||||
|
||||
// Options applies the options on the config object.
|
||||
func (c *config) options(opts ...Option) {
|
||||
for _, opt := range opts {
|
||||
opt(c)
|
||||
}
|
||||
if c.debug {
|
||||
c.driver = dialect.Debug(c.driver, c.log)
|
||||
}
|
||||
}
|
||||
|
||||
// Debug enables debug logging on the ent.Driver.
|
||||
func Debug() Option {
|
||||
return func(c *config) {
|
||||
c.debug = true
|
||||
}
|
||||
}
|
||||
|
||||
// Log sets the logging function for debug mode.
|
||||
func Log(fn func(...interface{})) Option {
|
||||
return func(c *config) {
|
||||
c.log = fn
|
||||
}
|
||||
}
|
||||
|
||||
// Driver configures the client driver.
|
||||
func Driver(driver dialect.Driver) Option {
|
||||
return func(c *config) {
|
||||
c.driver = driver
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type clientCtxKey struct{}
|
||||
|
||||
// FromContext returns a Client stored inside a context, or nil if there isn't one.
|
||||
func FromContext(ctx context.Context) *Client {
|
||||
c, _ := ctx.Value(clientCtxKey{}).(*Client)
|
||||
return c
|
||||
}
|
||||
|
||||
// NewContext returns a new context with the given Client attached.
|
||||
func NewContext(parent context.Context, c *Client) context.Context {
|
||||
return context.WithValue(parent, clientCtxKey{}, c)
|
||||
}
|
||||
|
||||
type txCtxKey struct{}
|
||||
|
||||
// TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
|
||||
func TxFromContext(ctx context.Context) *Tx {
|
||||
tx, _ := ctx.Value(txCtxKey{}).(*Tx)
|
||||
return tx
|
||||
}
|
||||
|
||||
// NewTxContext returns a new context with the given Tx attached.
|
||||
func NewTxContext(parent context.Context, tx *Tx) context.Context {
|
||||
return context.WithValue(parent, txCtxKey{}, tx)
|
||||
}
|
||||
457
ent/ent.go
457
ent/ent.go
@@ -1,68 +1,101 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/messages"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"csgowtfd/ent/spray"
|
||||
"csgowtfd/ent/weapon"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/messages"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
)
|
||||
|
||||
// ent aliases to avoid import conflicts in user's code.
|
||||
type (
|
||||
Op = ent.Op
|
||||
Hook = ent.Hook
|
||||
Value = ent.Value
|
||||
Query = ent.Query
|
||||
Policy = ent.Policy
|
||||
Mutator = ent.Mutator
|
||||
Mutation = ent.Mutation
|
||||
MutateFunc = ent.MutateFunc
|
||||
Op = ent.Op
|
||||
Hook = ent.Hook
|
||||
Value = ent.Value
|
||||
Query = ent.Query
|
||||
QueryContext = ent.QueryContext
|
||||
Querier = ent.Querier
|
||||
QuerierFunc = ent.QuerierFunc
|
||||
Interceptor = ent.Interceptor
|
||||
InterceptFunc = ent.InterceptFunc
|
||||
Traverser = ent.Traverser
|
||||
TraverseFunc = ent.TraverseFunc
|
||||
Policy = ent.Policy
|
||||
Mutator = ent.Mutator
|
||||
Mutation = ent.Mutation
|
||||
MutateFunc = ent.MutateFunc
|
||||
)
|
||||
|
||||
type clientCtxKey struct{}
|
||||
|
||||
// FromContext returns a Client stored inside a context, or nil if there isn't one.
|
||||
func FromContext(ctx context.Context) *Client {
|
||||
c, _ := ctx.Value(clientCtxKey{}).(*Client)
|
||||
return c
|
||||
}
|
||||
|
||||
// NewContext returns a new context with the given Client attached.
|
||||
func NewContext(parent context.Context, c *Client) context.Context {
|
||||
return context.WithValue(parent, clientCtxKey{}, c)
|
||||
}
|
||||
|
||||
type txCtxKey struct{}
|
||||
|
||||
// TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
|
||||
func TxFromContext(ctx context.Context) *Tx {
|
||||
tx, _ := ctx.Value(txCtxKey{}).(*Tx)
|
||||
return tx
|
||||
}
|
||||
|
||||
// NewTxContext returns a new context with the given Tx attached.
|
||||
func NewTxContext(parent context.Context, tx *Tx) context.Context {
|
||||
return context.WithValue(parent, txCtxKey{}, tx)
|
||||
}
|
||||
|
||||
// OrderFunc applies an ordering on the sql selector.
|
||||
// Deprecated: Use Asc/Desc functions or the package builders instead.
|
||||
type OrderFunc func(*sql.Selector)
|
||||
|
||||
// columnChecker returns a function indicates if the column exists in the given column.
|
||||
func columnChecker(table string) func(string) error {
|
||||
checks := map[string]func(string) bool{
|
||||
match.Table: match.ValidColumn,
|
||||
matchplayer.Table: matchplayer.ValidColumn,
|
||||
messages.Table: messages.ValidColumn,
|
||||
player.Table: player.ValidColumn,
|
||||
roundstats.Table: roundstats.ValidColumn,
|
||||
spray.Table: spray.ValidColumn,
|
||||
weapon.Table: weapon.ValidColumn,
|
||||
}
|
||||
check, ok := checks[table]
|
||||
if !ok {
|
||||
return func(string) error {
|
||||
return fmt.Errorf("unknown table %q", table)
|
||||
}
|
||||
}
|
||||
return func(column string) error {
|
||||
if !check(column) {
|
||||
return fmt.Errorf("unknown column %q for table %q", column, table)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var (
|
||||
initCheck sync.Once
|
||||
columnCheck sql.ColumnCheck
|
||||
)
|
||||
|
||||
// checkColumn checks if the column exists in the given table.
|
||||
func checkColumn(t, c string) error {
|
||||
initCheck.Do(func() {
|
||||
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
|
||||
match.Table: match.ValidColumn,
|
||||
matchplayer.Table: matchplayer.ValidColumn,
|
||||
messages.Table: messages.ValidColumn,
|
||||
player.Table: player.ValidColumn,
|
||||
roundstats.Table: roundstats.ValidColumn,
|
||||
spray.Table: spray.ValidColumn,
|
||||
weapon.Table: weapon.ValidColumn,
|
||||
})
|
||||
})
|
||||
return columnCheck(t, c)
|
||||
}
|
||||
|
||||
// Asc applies the given fields in ASC order.
|
||||
func Asc(fields ...string) OrderFunc {
|
||||
func Asc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Asc(s.C(f)))
|
||||
@@ -71,11 +104,10 @@ func Asc(fields ...string) OrderFunc {
|
||||
}
|
||||
|
||||
// Desc applies the given fields in DESC order.
|
||||
func Desc(fields ...string) OrderFunc {
|
||||
func Desc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
check := columnChecker(s.TableName())
|
||||
for _, f := range fields {
|
||||
if err := check(f); err != nil {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Desc(s.C(f)))
|
||||
@@ -91,7 +123,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)
|
||||
@@ -108,8 +139,7 @@ func Count() AggregateFunc {
|
||||
// Max applies the "max" aggregation function on the given field of each group.
|
||||
func Max(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -120,8 +150,7 @@ func Max(field string) AggregateFunc {
|
||||
// Mean applies the "mean" aggregation function on the given field of each group.
|
||||
func Mean(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -132,8 +161,7 @@ func Mean(field string) AggregateFunc {
|
||||
// Min applies the "min" aggregation function on the given field of each group.
|
||||
func Min(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -144,8 +172,7 @@ func Min(field string) AggregateFunc {
|
||||
// Sum applies the "sum" aggregation function on the given field of each group.
|
||||
func Sum(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
check := columnChecker(s.TableName())
|
||||
if err := check(field); err != nil {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
@@ -269,3 +296,325 @@ 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
|
||||
fns []AggregateFunc
|
||||
scan func(context.Context, any) error
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (s *selector) ScanX(ctx context.Context, v any) {
|
||||
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
|
||||
}
|
||||
|
||||
// withHooks invokes the builder operation with the given hooks, if any.
|
||||
func withHooks[V Value, M any, PM interface {
|
||||
*M
|
||||
Mutation
|
||||
}](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) {
|
||||
if len(hooks) == 0 {
|
||||
return exec(ctx)
|
||||
}
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutationT, ok := any(m).(PM)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
// Set the mutation to the builder.
|
||||
*mutation = *mutationT
|
||||
return exec(ctx)
|
||||
})
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
if hooks[i] == nil {
|
||||
return value, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = hooks[i](mut)
|
||||
}
|
||||
v, err := mut.Mutate(ctx, mutation)
|
||||
if err != nil {
|
||||
return value, err
|
||||
}
|
||||
nv, ok := v.(V)
|
||||
if !ok {
|
||||
return value, fmt.Errorf("unexpected node type %T returned from %T", v, mutation)
|
||||
}
|
||||
return nv, nil
|
||||
}
|
||||
|
||||
// setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist.
|
||||
func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context {
|
||||
if ent.QueryFromContext(ctx) == nil {
|
||||
qc.Op = op
|
||||
ctx = ent.NewQueryContext(ctx, qc)
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
func querierAll[V Value, Q interface {
|
||||
sqlAll(context.Context, ...queryHook) (V, error)
|
||||
}]() Querier {
|
||||
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
return query.sqlAll(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func querierCount[Q interface {
|
||||
sqlCount(context.Context) (int, error)
|
||||
}]() Querier {
|
||||
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
return query.sqlCount(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func withInterceptors[V Value](ctx context.Context, q Query, qr Querier, inters []Interceptor) (v V, err error) {
|
||||
for i := len(inters) - 1; i >= 0; i-- {
|
||||
qr = inters[i].Intercept(qr)
|
||||
}
|
||||
rv, err := qr.Query(ctx, q)
|
||||
if err != nil {
|
||||
return v, err
|
||||
}
|
||||
vt, ok := rv.(V)
|
||||
if !ok {
|
||||
return v, fmt.Errorf("unexpected type %T returned from %T. expected type: %T", vt, q, v)
|
||||
}
|
||||
return vt, nil
|
||||
}
|
||||
|
||||
func scanWithInterceptors[Q1 ent.Query, Q2 interface {
|
||||
sqlScan(context.Context, Q1, any) error
|
||||
}](ctx context.Context, rootQuery Q1, selectOrGroup Q2, inters []Interceptor, v any) error {
|
||||
rv := reflect.ValueOf(v)
|
||||
var qr Querier = QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q1)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
if err := selectOrGroup.sqlScan(ctx, query, v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if k := rv.Kind(); k == reflect.Pointer && rv.Elem().CanInterface() {
|
||||
return rv.Elem().Interface(), nil
|
||||
}
|
||||
return v, nil
|
||||
})
|
||||
for i := len(inters) - 1; i >= 0; i-- {
|
||||
qr = inters[i].Intercept(qr)
|
||||
}
|
||||
vv, err := qr.Query(ctx, rootQuery)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch rv2 := reflect.ValueOf(vv); {
|
||||
case rv.IsNil(), rv2.IsNil(), rv.Kind() != reflect.Pointer:
|
||||
case rv.Type() == rv2.Type():
|
||||
rv.Elem().Set(rv2.Elem())
|
||||
case rv.Elem().Type() == rv2.Type():
|
||||
rv.Elem().Set(rv2)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// queryHook describes an internal hook for the different sqlAll methods.
|
||||
type queryHook func(context.Context, *sqlgraph.QuerySpec)
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package enttest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent"
|
||||
|
||||
"somegit.dev/csgowtf/csgowtfd/ent"
|
||||
// required by schema hooks.
|
||||
_ "csgowtfd/ent/runtime"
|
||||
_ "somegit.dev/csgowtf/csgowtfd/ent/runtime"
|
||||
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/migrate"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -16,7 +18,7 @@ type (
|
||||
// testing.T and testing.B and used by enttest.
|
||||
TestingT interface {
|
||||
FailNow()
|
||||
Error(...interface{})
|
||||
Error(...any)
|
||||
}
|
||||
|
||||
// Option configures client creation.
|
||||
@@ -58,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
|
||||
}
|
||||
|
||||
@@ -69,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
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package hook
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent"
|
||||
"fmt"
|
||||
|
||||
"somegit.dev/csgowtf/csgowtfd/ent"
|
||||
)
|
||||
|
||||
// The MatchFunc type is an adapter to allow the use of ordinary
|
||||
@@ -14,11 +15,10 @@ type MatchFunc func(context.Context, *ent.MatchMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f MatchFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.MatchMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MatchMutation", m)
|
||||
if mv, ok := m.(*ent.MatchMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MatchMutation", m)
|
||||
}
|
||||
|
||||
// The MatchPlayerFunc type is an adapter to allow the use of ordinary
|
||||
@@ -27,11 +27,10 @@ type MatchPlayerFunc func(context.Context, *ent.MatchPlayerMutation) (ent.Value,
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f MatchPlayerFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.MatchPlayerMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MatchPlayerMutation", m)
|
||||
if mv, ok := m.(*ent.MatchPlayerMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MatchPlayerMutation", m)
|
||||
}
|
||||
|
||||
// The MessagesFunc type is an adapter to allow the use of ordinary
|
||||
@@ -40,11 +39,10 @@ type MessagesFunc func(context.Context, *ent.MessagesMutation) (ent.Value, error
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f MessagesFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.MessagesMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MessagesMutation", m)
|
||||
if mv, ok := m.(*ent.MessagesMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MessagesMutation", m)
|
||||
}
|
||||
|
||||
// The PlayerFunc type is an adapter to allow the use of ordinary
|
||||
@@ -53,11 +51,10 @@ type PlayerFunc func(context.Context, *ent.PlayerMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f PlayerFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.PlayerMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PlayerMutation", m)
|
||||
if mv, ok := m.(*ent.PlayerMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PlayerMutation", m)
|
||||
}
|
||||
|
||||
// The RoundStatsFunc type is an adapter to allow the use of ordinary
|
||||
@@ -66,11 +63,10 @@ type RoundStatsFunc func(context.Context, *ent.RoundStatsMutation) (ent.Value, e
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f RoundStatsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.RoundStatsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.RoundStatsMutation", m)
|
||||
if mv, ok := m.(*ent.RoundStatsMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.RoundStatsMutation", m)
|
||||
}
|
||||
|
||||
// The SprayFunc type is an adapter to allow the use of ordinary
|
||||
@@ -79,11 +75,10 @@ type SprayFunc func(context.Context, *ent.SprayMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f SprayFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.SprayMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.SprayMutation", m)
|
||||
if mv, ok := m.(*ent.SprayMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.SprayMutation", m)
|
||||
}
|
||||
|
||||
// The WeaponFunc type is an adapter to allow the use of ordinary
|
||||
@@ -92,11 +87,10 @@ type WeaponFunc func(context.Context, *ent.WeaponMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f WeaponFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
mv, ok := m.(*ent.WeaponMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.WeaponMutation", m)
|
||||
if mv, ok := m.(*ent.WeaponMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return f(ctx, mv)
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.WeaponMutation", m)
|
||||
}
|
||||
|
||||
// Condition is a hook condition function.
|
||||
@@ -194,7 +188,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) {
|
||||
@@ -209,7 +202,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))
|
||||
}
|
||||
@@ -217,7 +209,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)))
|
||||
}
|
||||
@@ -238,7 +229,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)
|
||||
|
||||
159
ent/match.go
159
ent/match.go
@@ -1,14 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/match"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
)
|
||||
|
||||
// Match is the model entity for the Match schema.
|
||||
@@ -42,9 +43,12 @@ type Match struct {
|
||||
GamebanPresent bool `json:"gameban_present,omitempty"`
|
||||
// DecryptionKey holds the value of the "decryption_key" field.
|
||||
DecryptionKey []byte `json:"decryption_key,omitempty"`
|
||||
// TickRate holds the value of the "tick_rate" field.
|
||||
TickRate float64 `json:"tick_rate,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the MatchQuery when eager-loading is set.
|
||||
Edges MatchEdges `json:"edges"`
|
||||
Edges MatchEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// MatchEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -77,14 +81,16 @@ func (e MatchEdges) PlayersOrErr() ([]*Player, error) {
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Match) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Match) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case match.FieldDecryptionKey:
|
||||
values[i] = new([]byte)
|
||||
case match.FieldDemoParsed, match.FieldVacPresent, match.FieldGamebanPresent:
|
||||
values[i] = new(sql.NullBool)
|
||||
case match.FieldTickRate:
|
||||
values[i] = new(sql.NullFloat64)
|
||||
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case match.FieldShareCode, match.FieldMap, match.FieldReplayURL:
|
||||
@@ -92,7 +98,7 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
|
||||
case match.FieldDate:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Match", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -100,7 +106,7 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Match fields.
|
||||
func (m *Match) assignValues(columns []string, values []interface{}) error {
|
||||
func (_m *Match) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@@ -111,158 +117,181 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
m.ID = uint64(value.Int64)
|
||||
_m.ID = uint64(value.Int64)
|
||||
case match.FieldShareCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field share_code", values[i])
|
||||
} else if value.Valid {
|
||||
m.ShareCode = value.String
|
||||
_m.ShareCode = value.String
|
||||
}
|
||||
case match.FieldMap:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field map", values[i])
|
||||
} else if value.Valid {
|
||||
m.Map = value.String
|
||||
_m.Map = value.String
|
||||
}
|
||||
case match.FieldDate:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field date", values[i])
|
||||
} else if value.Valid {
|
||||
m.Date = value.Time
|
||||
_m.Date = value.Time
|
||||
}
|
||||
case match.FieldScoreTeamA:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field score_team_a", values[i])
|
||||
} else if value.Valid {
|
||||
m.ScoreTeamA = int(value.Int64)
|
||||
_m.ScoreTeamA = int(value.Int64)
|
||||
}
|
||||
case match.FieldScoreTeamB:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field score_team_b", values[i])
|
||||
} else if value.Valid {
|
||||
m.ScoreTeamB = int(value.Int64)
|
||||
_m.ScoreTeamB = int(value.Int64)
|
||||
}
|
||||
case match.FieldReplayURL:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field replay_url", values[i])
|
||||
} else if value.Valid {
|
||||
m.ReplayURL = value.String
|
||||
_m.ReplayURL = value.String
|
||||
}
|
||||
case match.FieldDuration:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field duration", values[i])
|
||||
} else if value.Valid {
|
||||
m.Duration = int(value.Int64)
|
||||
_m.Duration = int(value.Int64)
|
||||
}
|
||||
case match.FieldMatchResult:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field match_result", values[i])
|
||||
} else if value.Valid {
|
||||
m.MatchResult = int(value.Int64)
|
||||
_m.MatchResult = int(value.Int64)
|
||||
}
|
||||
case match.FieldMaxRounds:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field max_rounds", values[i])
|
||||
} else if value.Valid {
|
||||
m.MaxRounds = int(value.Int64)
|
||||
_m.MaxRounds = int(value.Int64)
|
||||
}
|
||||
case match.FieldDemoParsed:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field demo_parsed", values[i])
|
||||
} else if value.Valid {
|
||||
m.DemoParsed = value.Bool
|
||||
_m.DemoParsed = value.Bool
|
||||
}
|
||||
case match.FieldVacPresent:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field vac_present", values[i])
|
||||
} else if value.Valid {
|
||||
m.VacPresent = value.Bool
|
||||
_m.VacPresent = value.Bool
|
||||
}
|
||||
case match.FieldGamebanPresent:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field gameban_present", values[i])
|
||||
} else if value.Valid {
|
||||
m.GamebanPresent = value.Bool
|
||||
_m.GamebanPresent = value.Bool
|
||||
}
|
||||
case match.FieldDecryptionKey:
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field decryption_key", values[i])
|
||||
} else if value != nil {
|
||||
m.DecryptionKey = *value
|
||||
_m.DecryptionKey = *value
|
||||
}
|
||||
case match.FieldTickRate:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field tick_rate", values[i])
|
||||
} else if value.Valid {
|
||||
_m.TickRate = value.Float64
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Match.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *Match) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryStats queries the "stats" edge of the Match entity.
|
||||
func (m *Match) QueryStats() *MatchPlayerQuery {
|
||||
return (&MatchClient{config: m.config}).QueryStats(m)
|
||||
func (_m *Match) QueryStats() *MatchPlayerQuery {
|
||||
return NewMatchClient(_m.config).QueryStats(_m)
|
||||
}
|
||||
|
||||
// QueryPlayers queries the "players" edge of the Match entity.
|
||||
func (m *Match) QueryPlayers() *PlayerQuery {
|
||||
return (&MatchClient{config: m.config}).QueryPlayers(m)
|
||||
func (_m *Match) QueryPlayers() *PlayerQuery {
|
||||
return NewMatchClient(_m.config).QueryPlayers(_m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Match.
|
||||
// Note that you need to call Match.Unwrap() before calling this method if this Match
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (m *Match) Update() *MatchUpdateOne {
|
||||
return (&MatchClient{config: m.config}).UpdateOne(m)
|
||||
func (_m *Match) Update() *MatchUpdateOne {
|
||||
return NewMatchClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// 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)
|
||||
func (_m *Match) Unwrap() *Match {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Match is not a transactional entity")
|
||||
}
|
||||
m.config.driver = tx.drv
|
||||
return m
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (m *Match) String() string {
|
||||
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(m.ShareCode)
|
||||
builder.WriteString(", map=")
|
||||
builder.WriteString(m.Map)
|
||||
builder.WriteString(", date=")
|
||||
builder.WriteString(m.Date.Format(time.ANSIC))
|
||||
builder.WriteString(", score_team_a=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.ScoreTeamA))
|
||||
builder.WriteString(", score_team_b=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.ScoreTeamB))
|
||||
builder.WriteString(", replay_url=")
|
||||
builder.WriteString(m.ReplayURL)
|
||||
builder.WriteString(", duration=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.Duration))
|
||||
builder.WriteString(", match_result=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.MatchResult))
|
||||
builder.WriteString(", max_rounds=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.MaxRounds))
|
||||
builder.WriteString(", demo_parsed=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.DemoParsed))
|
||||
builder.WriteString(", vac_present=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.VacPresent))
|
||||
builder.WriteString(", gameban_present=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.GamebanPresent))
|
||||
builder.WriteString(", decryption_key=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.DecryptionKey))
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("share_code=")
|
||||
builder.WriteString(_m.ShareCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("map=")
|
||||
builder.WriteString(_m.Map)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("date=")
|
||||
builder.WriteString(_m.Date.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("score_team_a=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.ScoreTeamA))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("score_team_b=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.ScoreTeamB))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("replay_url=")
|
||||
builder.WriteString(_m.ReplayURL)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("duration=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Duration))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("match_result=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.MatchResult))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("max_rounds=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.MaxRounds))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("demo_parsed=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.DemoParsed))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("vac_present=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.VacPresent))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("gameban_present=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.GamebanPresent))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("decryption_key=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.DecryptionKey))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("tick_rate=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.TickRate))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Matches is a parsable slice of Match.
|
||||
type Matches []*Match
|
||||
|
||||
func (m Matches) config(cfg config) {
|
||||
for _i := range m {
|
||||
m[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package match
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the match type in the database.
|
||||
Label = "match"
|
||||
@@ -33,6 +38,8 @@ const (
|
||||
FieldGamebanPresent = "gameban_present"
|
||||
// FieldDecryptionKey holds the string denoting the decryption_key field in the database.
|
||||
FieldDecryptionKey = "decryption_key"
|
||||
// FieldTickRate holds the string denoting the tick_rate field in the database.
|
||||
FieldTickRate = "tick_rate"
|
||||
// EdgeStats holds the string denoting the stats edge name in mutations.
|
||||
EdgeStats = "stats"
|
||||
// EdgePlayers holds the string denoting the players edge name in mutations.
|
||||
@@ -69,6 +76,7 @@ var Columns = []string{
|
||||
FieldVacPresent,
|
||||
FieldGamebanPresent,
|
||||
FieldDecryptionKey,
|
||||
FieldTickRate,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -95,3 +103,118 @@ var (
|
||||
// DefaultGamebanPresent holds the default value on creation for the "gameban_present" field.
|
||||
DefaultGamebanPresent bool
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Match queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByShareCode orders the results by the share_code field.
|
||||
func ByShareCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldShareCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMap orders the results by the map field.
|
||||
func ByMap(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMap, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDate orders the results by the date field.
|
||||
func ByDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByScoreTeamA orders the results by the score_team_a field.
|
||||
func ByScoreTeamA(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldScoreTeamA, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByScoreTeamB orders the results by the score_team_b field.
|
||||
func ByScoreTeamB(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldScoreTeamB, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByReplayURL orders the results by the replay_url field.
|
||||
func ByReplayURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldReplayURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDuration orders the results by the duration field.
|
||||
func ByDuration(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDuration, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchResult orders the results by the match_result field.
|
||||
func ByMatchResult(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMatchResult, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaxRounds orders the results by the max_rounds field.
|
||||
func ByMaxRounds(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaxRounds, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDemoParsed orders the results by the demo_parsed field.
|
||||
func ByDemoParsed(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDemoParsed, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVacPresent orders the results by the vac_present field.
|
||||
func ByVacPresent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVacPresent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGamebanPresent orders the results by the gameban_present field.
|
||||
func ByGamebanPresent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGamebanPresent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTickRate orders the results by the tick_rate field.
|
||||
func ByTickRate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTickRate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatsCount orders the results by stats count.
|
||||
func ByStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByStats orders the results by stats terms.
|
||||
func ByStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByPlayersCount orders the results by players count.
|
||||
func ByPlayersCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newPlayersStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByPlayers orders the results by players terms.
|
||||
func ByPlayers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newPlayersStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, StatsTable, StatsColumn),
|
||||
)
|
||||
}
|
||||
func newPlayersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, PlayersTable, PlayersPrimaryKey...),
|
||||
)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,18 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/player"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
)
|
||||
|
||||
// MatchCreate is the builder for creating a Match entity.
|
||||
@@ -23,209 +23,187 @@ type MatchCreate struct {
|
||||
}
|
||||
|
||||
// SetShareCode sets the "share_code" field.
|
||||
func (mc *MatchCreate) SetShareCode(s string) *MatchCreate {
|
||||
mc.mutation.SetShareCode(s)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetShareCode(v string) *MatchCreate {
|
||||
_c.mutation.SetShareCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMap sets the "map" field.
|
||||
func (mc *MatchCreate) SetMap(s string) *MatchCreate {
|
||||
mc.mutation.SetMap(s)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetMap(v string) *MatchCreate {
|
||||
_c.mutation.SetMap(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableMap sets the "map" field if the given value is not nil.
|
||||
func (mc *MatchCreate) SetNillableMap(s *string) *MatchCreate {
|
||||
if s != nil {
|
||||
mc.SetMap(*s)
|
||||
func (_c *MatchCreate) SetNillableMap(v *string) *MatchCreate {
|
||||
if v != nil {
|
||||
_c.SetMap(*v)
|
||||
}
|
||||
return mc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDate sets the "date" field.
|
||||
func (mc *MatchCreate) SetDate(t time.Time) *MatchCreate {
|
||||
mc.mutation.SetDate(t)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetDate(v time.Time) *MatchCreate {
|
||||
_c.mutation.SetDate(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetScoreTeamA sets the "score_team_a" field.
|
||||
func (mc *MatchCreate) SetScoreTeamA(i int) *MatchCreate {
|
||||
mc.mutation.SetScoreTeamA(i)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetScoreTeamA(v int) *MatchCreate {
|
||||
_c.mutation.SetScoreTeamA(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetScoreTeamB sets the "score_team_b" field.
|
||||
func (mc *MatchCreate) SetScoreTeamB(i int) *MatchCreate {
|
||||
mc.mutation.SetScoreTeamB(i)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetScoreTeamB(v int) *MatchCreate {
|
||||
_c.mutation.SetScoreTeamB(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetReplayURL sets the "replay_url" field.
|
||||
func (mc *MatchCreate) SetReplayURL(s string) *MatchCreate {
|
||||
mc.mutation.SetReplayURL(s)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetReplayURL(v string) *MatchCreate {
|
||||
_c.mutation.SetReplayURL(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableReplayURL sets the "replay_url" field if the given value is not nil.
|
||||
func (mc *MatchCreate) SetNillableReplayURL(s *string) *MatchCreate {
|
||||
if s != nil {
|
||||
mc.SetReplayURL(*s)
|
||||
func (_c *MatchCreate) SetNillableReplayURL(v *string) *MatchCreate {
|
||||
if v != nil {
|
||||
_c.SetReplayURL(*v)
|
||||
}
|
||||
return mc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDuration sets the "duration" field.
|
||||
func (mc *MatchCreate) SetDuration(i int) *MatchCreate {
|
||||
mc.mutation.SetDuration(i)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetDuration(v int) *MatchCreate {
|
||||
_c.mutation.SetDuration(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMatchResult sets the "match_result" field.
|
||||
func (mc *MatchCreate) SetMatchResult(i int) *MatchCreate {
|
||||
mc.mutation.SetMatchResult(i)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetMatchResult(v int) *MatchCreate {
|
||||
_c.mutation.SetMatchResult(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMaxRounds sets the "max_rounds" field.
|
||||
func (mc *MatchCreate) SetMaxRounds(i int) *MatchCreate {
|
||||
mc.mutation.SetMaxRounds(i)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetMaxRounds(v int) *MatchCreate {
|
||||
_c.mutation.SetMaxRounds(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDemoParsed sets the "demo_parsed" field.
|
||||
func (mc *MatchCreate) SetDemoParsed(b bool) *MatchCreate {
|
||||
mc.mutation.SetDemoParsed(b)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetDemoParsed(v bool) *MatchCreate {
|
||||
_c.mutation.SetDemoParsed(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableDemoParsed sets the "demo_parsed" field if the given value is not nil.
|
||||
func (mc *MatchCreate) SetNillableDemoParsed(b *bool) *MatchCreate {
|
||||
if b != nil {
|
||||
mc.SetDemoParsed(*b)
|
||||
func (_c *MatchCreate) SetNillableDemoParsed(v *bool) *MatchCreate {
|
||||
if v != nil {
|
||||
_c.SetDemoParsed(*v)
|
||||
}
|
||||
return mc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetVacPresent sets the "vac_present" field.
|
||||
func (mc *MatchCreate) SetVacPresent(b bool) *MatchCreate {
|
||||
mc.mutation.SetVacPresent(b)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetVacPresent(v bool) *MatchCreate {
|
||||
_c.mutation.SetVacPresent(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableVacPresent sets the "vac_present" field if the given value is not nil.
|
||||
func (mc *MatchCreate) SetNillableVacPresent(b *bool) *MatchCreate {
|
||||
if b != nil {
|
||||
mc.SetVacPresent(*b)
|
||||
func (_c *MatchCreate) SetNillableVacPresent(v *bool) *MatchCreate {
|
||||
if v != nil {
|
||||
_c.SetVacPresent(*v)
|
||||
}
|
||||
return mc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetGamebanPresent sets the "gameban_present" field.
|
||||
func (mc *MatchCreate) SetGamebanPresent(b bool) *MatchCreate {
|
||||
mc.mutation.SetGamebanPresent(b)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetGamebanPresent(v bool) *MatchCreate {
|
||||
_c.mutation.SetGamebanPresent(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableGamebanPresent sets the "gameban_present" field if the given value is not nil.
|
||||
func (mc *MatchCreate) SetNillableGamebanPresent(b *bool) *MatchCreate {
|
||||
if b != nil {
|
||||
mc.SetGamebanPresent(*b)
|
||||
func (_c *MatchCreate) SetNillableGamebanPresent(v *bool) *MatchCreate {
|
||||
if v != nil {
|
||||
_c.SetGamebanPresent(*v)
|
||||
}
|
||||
return mc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDecryptionKey sets the "decryption_key" field.
|
||||
func (mc *MatchCreate) SetDecryptionKey(b []byte) *MatchCreate {
|
||||
mc.mutation.SetDecryptionKey(b)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetDecryptionKey(v []byte) *MatchCreate {
|
||||
_c.mutation.SetDecryptionKey(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetTickRate sets the "tick_rate" field.
|
||||
func (_c *MatchCreate) SetTickRate(v float64) *MatchCreate {
|
||||
_c.mutation.SetTickRate(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableTickRate sets the "tick_rate" field if the given value is not nil.
|
||||
func (_c *MatchCreate) SetNillableTickRate(v *float64) *MatchCreate {
|
||||
if v != nil {
|
||||
_c.SetTickRate(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (mc *MatchCreate) SetID(u uint64) *MatchCreate {
|
||||
mc.mutation.SetID(u)
|
||||
return mc
|
||||
func (_c *MatchCreate) SetID(v uint64) *MatchCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// AddStatIDs adds the "stats" edge to the MatchPlayer entity by IDs.
|
||||
func (mc *MatchCreate) AddStatIDs(ids ...int) *MatchCreate {
|
||||
mc.mutation.AddStatIDs(ids...)
|
||||
return mc
|
||||
func (_c *MatchCreate) AddStatIDs(ids ...int) *MatchCreate {
|
||||
_c.mutation.AddStatIDs(ids...)
|
||||
return _c
|
||||
}
|
||||
|
||||
// AddStats adds the "stats" edges to the MatchPlayer entity.
|
||||
func (mc *MatchCreate) AddStats(m ...*MatchPlayer) *MatchCreate {
|
||||
ids := make([]int, len(m))
|
||||
for i := range m {
|
||||
ids[i] = m[i].ID
|
||||
func (_c *MatchCreate) AddStats(v ...*MatchPlayer) *MatchCreate {
|
||||
ids := make([]int, len(v))
|
||||
for i := range v {
|
||||
ids[i] = v[i].ID
|
||||
}
|
||||
return mc.AddStatIDs(ids...)
|
||||
return _c.AddStatIDs(ids...)
|
||||
}
|
||||
|
||||
// AddPlayerIDs adds the "players" edge to the Player entity by IDs.
|
||||
func (mc *MatchCreate) AddPlayerIDs(ids ...uint64) *MatchCreate {
|
||||
mc.mutation.AddPlayerIDs(ids...)
|
||||
return mc
|
||||
func (_c *MatchCreate) AddPlayerIDs(ids ...uint64) *MatchCreate {
|
||||
_c.mutation.AddPlayerIDs(ids...)
|
||||
return _c
|
||||
}
|
||||
|
||||
// AddPlayers adds the "players" edges to the Player entity.
|
||||
func (mc *MatchCreate) AddPlayers(p ...*Player) *MatchCreate {
|
||||
ids := make([]uint64, len(p))
|
||||
for i := range p {
|
||||
ids[i] = p[i].ID
|
||||
func (_c *MatchCreate) AddPlayers(v ...*Player) *MatchCreate {
|
||||
ids := make([]uint64, len(v))
|
||||
for i := range v {
|
||||
ids[i] = v[i].ID
|
||||
}
|
||||
return mc.AddPlayerIDs(ids...)
|
||||
return _c.AddPlayerIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the MatchMutation object of the builder.
|
||||
func (mc *MatchCreate) Mutation() *MatchMutation {
|
||||
return mc.mutation
|
||||
func (_c *MatchCreate) Mutation() *MatchMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the Match in the database.
|
||||
func (mc *MatchCreate) Save(ctx context.Context) (*Match, error) {
|
||||
var (
|
||||
err error
|
||||
node *Match
|
||||
)
|
||||
mc.defaults()
|
||||
if len(mc.hooks) == 0 {
|
||||
if err = mc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = mc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MatchMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = mc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mc.mutation = mutation
|
||||
if node, err = mc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(mc.hooks) - 1; i >= 0; i-- {
|
||||
if mc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = mc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, mc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_c *MatchCreate) Save(ctx context.Context) (*Match, error) {
|
||||
_c.defaults()
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (mc *MatchCreate) SaveX(ctx context.Context) *Match {
|
||||
v, err := mc.Save(ctx)
|
||||
func (_c *MatchCreate) SaveX(ctx context.Context) *Match {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -233,74 +211,77 @@ func (mc *MatchCreate) SaveX(ctx context.Context) *Match {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (mc *MatchCreate) Exec(ctx context.Context) error {
|
||||
_, err := mc.Save(ctx)
|
||||
func (_c *MatchCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mc *MatchCreate) ExecX(ctx context.Context) {
|
||||
if err := mc.Exec(ctx); err != nil {
|
||||
func (_c *MatchCreate) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (mc *MatchCreate) defaults() {
|
||||
if _, ok := mc.mutation.DemoParsed(); !ok {
|
||||
func (_c *MatchCreate) defaults() {
|
||||
if _, ok := _c.mutation.DemoParsed(); !ok {
|
||||
v := match.DefaultDemoParsed
|
||||
mc.mutation.SetDemoParsed(v)
|
||||
_c.mutation.SetDemoParsed(v)
|
||||
}
|
||||
if _, ok := mc.mutation.VacPresent(); !ok {
|
||||
if _, ok := _c.mutation.VacPresent(); !ok {
|
||||
v := match.DefaultVacPresent
|
||||
mc.mutation.SetVacPresent(v)
|
||||
_c.mutation.SetVacPresent(v)
|
||||
}
|
||||
if _, ok := mc.mutation.GamebanPresent(); !ok {
|
||||
if _, ok := _c.mutation.GamebanPresent(); !ok {
|
||||
v := match.DefaultGamebanPresent
|
||||
mc.mutation.SetGamebanPresent(v)
|
||||
_c.mutation.SetGamebanPresent(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (mc *MatchCreate) check() error {
|
||||
if _, ok := mc.mutation.ShareCode(); !ok {
|
||||
func (_c *MatchCreate) check() error {
|
||||
if _, ok := _c.mutation.ShareCode(); !ok {
|
||||
return &ValidationError{Name: "share_code", err: errors.New(`ent: missing required field "Match.share_code"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.Date(); !ok {
|
||||
if _, ok := _c.mutation.Date(); !ok {
|
||||
return &ValidationError{Name: "date", err: errors.New(`ent: missing required field "Match.date"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.ScoreTeamA(); !ok {
|
||||
if _, ok := _c.mutation.ScoreTeamA(); !ok {
|
||||
return &ValidationError{Name: "score_team_a", err: errors.New(`ent: missing required field "Match.score_team_a"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.ScoreTeamB(); !ok {
|
||||
if _, ok := _c.mutation.ScoreTeamB(); !ok {
|
||||
return &ValidationError{Name: "score_team_b", err: errors.New(`ent: missing required field "Match.score_team_b"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.Duration(); !ok {
|
||||
if _, ok := _c.mutation.Duration(); !ok {
|
||||
return &ValidationError{Name: "duration", err: errors.New(`ent: missing required field "Match.duration"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.MatchResult(); !ok {
|
||||
if _, ok := _c.mutation.MatchResult(); !ok {
|
||||
return &ValidationError{Name: "match_result", err: errors.New(`ent: missing required field "Match.match_result"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.MaxRounds(); !ok {
|
||||
if _, ok := _c.mutation.MaxRounds(); !ok {
|
||||
return &ValidationError{Name: "max_rounds", err: errors.New(`ent: missing required field "Match.max_rounds"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.DemoParsed(); !ok {
|
||||
if _, ok := _c.mutation.DemoParsed(); !ok {
|
||||
return &ValidationError{Name: "demo_parsed", err: errors.New(`ent: missing required field "Match.demo_parsed"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.VacPresent(); !ok {
|
||||
if _, ok := _c.mutation.VacPresent(); !ok {
|
||||
return &ValidationError{Name: "vac_present", err: errors.New(`ent: missing required field "Match.vac_present"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.GamebanPresent(); !ok {
|
||||
if _, ok := _c.mutation.GamebanPresent(); !ok {
|
||||
return &ValidationError{Name: "gameban_present", err: errors.New(`ent: missing required field "Match.gameban_present"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mc *MatchCreate) sqlSave(ctx context.Context) (*Match, error) {
|
||||
_node, _spec := mc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil {
|
||||
func (_c *MatchCreate) sqlSave(ctx context.Context) (*Match, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@@ -308,129 +289,77 @@ func (mc *MatchCreate) sqlSave(ctx context.Context) (*Match, error) {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = uint64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
func (_c *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Match{config: mc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: match.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
}
|
||||
_node = &Match{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(match.Table, sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64))
|
||||
)
|
||||
if id, ok := mc.mutation.ID(); ok {
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := mc.mutation.ShareCode(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: match.FieldShareCode,
|
||||
})
|
||||
if value, ok := _c.mutation.ShareCode(); ok {
|
||||
_spec.SetField(match.FieldShareCode, field.TypeString, value)
|
||||
_node.ShareCode = value
|
||||
}
|
||||
if value, ok := mc.mutation.Map(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: match.FieldMap,
|
||||
})
|
||||
if value, ok := _c.mutation.Map(); ok {
|
||||
_spec.SetField(match.FieldMap, field.TypeString, value)
|
||||
_node.Map = value
|
||||
}
|
||||
if value, ok := mc.mutation.Date(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: match.FieldDate,
|
||||
})
|
||||
if value, ok := _c.mutation.Date(); ok {
|
||||
_spec.SetField(match.FieldDate, field.TypeTime, value)
|
||||
_node.Date = value
|
||||
}
|
||||
if value, ok := mc.mutation.ScoreTeamA(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: match.FieldScoreTeamA,
|
||||
})
|
||||
if value, ok := _c.mutation.ScoreTeamA(); ok {
|
||||
_spec.SetField(match.FieldScoreTeamA, field.TypeInt, value)
|
||||
_node.ScoreTeamA = value
|
||||
}
|
||||
if value, ok := mc.mutation.ScoreTeamB(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: match.FieldScoreTeamB,
|
||||
})
|
||||
if value, ok := _c.mutation.ScoreTeamB(); ok {
|
||||
_spec.SetField(match.FieldScoreTeamB, field.TypeInt, value)
|
||||
_node.ScoreTeamB = value
|
||||
}
|
||||
if value, ok := mc.mutation.ReplayURL(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: match.FieldReplayURL,
|
||||
})
|
||||
if value, ok := _c.mutation.ReplayURL(); ok {
|
||||
_spec.SetField(match.FieldReplayURL, field.TypeString, value)
|
||||
_node.ReplayURL = value
|
||||
}
|
||||
if value, ok := mc.mutation.Duration(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: match.FieldDuration,
|
||||
})
|
||||
if value, ok := _c.mutation.Duration(); ok {
|
||||
_spec.SetField(match.FieldDuration, field.TypeInt, value)
|
||||
_node.Duration = value
|
||||
}
|
||||
if value, ok := mc.mutation.MatchResult(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: match.FieldMatchResult,
|
||||
})
|
||||
if value, ok := _c.mutation.MatchResult(); ok {
|
||||
_spec.SetField(match.FieldMatchResult, field.TypeInt, value)
|
||||
_node.MatchResult = value
|
||||
}
|
||||
if value, ok := mc.mutation.MaxRounds(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: match.FieldMaxRounds,
|
||||
})
|
||||
if value, ok := _c.mutation.MaxRounds(); ok {
|
||||
_spec.SetField(match.FieldMaxRounds, field.TypeInt, value)
|
||||
_node.MaxRounds = value
|
||||
}
|
||||
if value, ok := mc.mutation.DemoParsed(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: match.FieldDemoParsed,
|
||||
})
|
||||
if value, ok := _c.mutation.DemoParsed(); ok {
|
||||
_spec.SetField(match.FieldDemoParsed, field.TypeBool, value)
|
||||
_node.DemoParsed = value
|
||||
}
|
||||
if value, ok := mc.mutation.VacPresent(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: match.FieldVacPresent,
|
||||
})
|
||||
if value, ok := _c.mutation.VacPresent(); ok {
|
||||
_spec.SetField(match.FieldVacPresent, field.TypeBool, value)
|
||||
_node.VacPresent = value
|
||||
}
|
||||
if value, ok := mc.mutation.GamebanPresent(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: match.FieldGamebanPresent,
|
||||
})
|
||||
if value, ok := _c.mutation.GamebanPresent(); ok {
|
||||
_spec.SetField(match.FieldGamebanPresent, field.TypeBool, value)
|
||||
_node.GamebanPresent = value
|
||||
}
|
||||
if value, ok := mc.mutation.DecryptionKey(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: match.FieldDecryptionKey,
|
||||
})
|
||||
if value, ok := _c.mutation.DecryptionKey(); ok {
|
||||
_spec.SetField(match.FieldDecryptionKey, field.TypeBytes, value)
|
||||
_node.DecryptionKey = value
|
||||
}
|
||||
if nodes := mc.mutation.StatsIDs(); len(nodes) > 0 {
|
||||
if value, ok := _c.mutation.TickRate(); ok {
|
||||
_spec.SetField(match.FieldTickRate, field.TypeFloat64, value)
|
||||
_node.TickRate = value
|
||||
}
|
||||
if nodes := _c.mutation.StatsIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
@@ -438,10 +367,7 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{match.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -449,7 +375,7 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
}
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
if nodes := mc.mutation.PlayersIDs(); len(nodes) > 0 {
|
||||
if nodes := _c.mutation.PlayersIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2M,
|
||||
Inverse: true,
|
||||
@@ -457,10 +383,7 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
Columns: match.PlayersPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -474,17 +397,21 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
// MatchCreateBulk is the builder for creating many Match entities in bulk.
|
||||
type MatchCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*MatchCreate
|
||||
}
|
||||
|
||||
// Save creates the Match entities in the database.
|
||||
func (mcb *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) {
|
||||
specs := make([]*sqlgraph.CreateSpec, len(mcb.builders))
|
||||
nodes := make([]*Match, len(mcb.builders))
|
||||
mutators := make([]Mutator, len(mcb.builders))
|
||||
for i := range mcb.builders {
|
||||
func (_c *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*Match, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := mcb.builders[i]
|
||||
builder := _c.builders[i]
|
||||
builder.defaults()
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MatchMutation)
|
||||
@@ -495,16 +422,16 @@ func (mcb *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, mcb.builders[i+1].mutation)
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, mcb.driver, spec); err != nil {
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,11 +439,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-- {
|
||||
@@ -526,7 +453,7 @@ func (mcb *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) {
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, mcb.builders[0].mutation); err != nil {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -534,8 +461,8 @@ func (mcb *MatchCreateBulk) Save(ctx context.Context) ([]*Match, error) {
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (mcb *MatchCreateBulk) SaveX(ctx context.Context) []*Match {
|
||||
v, err := mcb.Save(ctx)
|
||||
func (_c *MatchCreateBulk) SaveX(ctx context.Context) []*Match {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -543,14 +470,14 @@ func (mcb *MatchCreateBulk) SaveX(ctx context.Context) []*Match {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (mcb *MatchCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := mcb.Save(ctx)
|
||||
func (_c *MatchCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mcb *MatchCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := mcb.Exec(ctx); err != nil {
|
||||
func (_c *MatchCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/predicate"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// MatchDelete is the builder for deleting a Match entity.
|
||||
@@ -21,80 +20,56 @@ type MatchDelete struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MatchDelete builder.
|
||||
func (md *MatchDelete) Where(ps ...predicate.Match) *MatchDelete {
|
||||
md.mutation.Where(ps...)
|
||||
return md
|
||||
func (_d *MatchDelete) Where(ps ...predicate.Match) *MatchDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (md *MatchDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(md.hooks) == 0 {
|
||||
affected, err = md.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MatchMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
md.mutation = mutation
|
||||
affected, err = md.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(md.hooks) - 1; i >= 0; i-- {
|
||||
if md.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = md.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, md.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_d *MatchDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (md *MatchDelete) ExecX(ctx context.Context) int {
|
||||
n, err := md.Exec(ctx)
|
||||
func (_d *MatchDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (md *MatchDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: match.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := md.mutation.predicates; len(ps) > 0 {
|
||||
func (_d *MatchDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(match.Table, sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, md.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// MatchDeleteOne is the builder for deleting a single Match entity.
|
||||
type MatchDeleteOne struct {
|
||||
md *MatchDelete
|
||||
_d *MatchDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MatchDelete builder.
|
||||
func (_d *MatchDeleteOne) Where(ps ...predicate.Match) *MatchDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (mdo *MatchDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := mdo.md.Exec(ctx)
|
||||
func (_d *MatchDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
@@ -106,6 +81,8 @@ func (mdo *MatchDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mdo *MatchDeleteOne) ExecX(ctx context.Context) {
|
||||
mdo.md.ExecX(ctx)
|
||||
func (_d *MatchDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
1050
ent/match_query.go
1050
ent/match_query.go
File diff suppressed because it is too large
Load Diff
1318
ent/match_update.go
1318
ent/match_update.go
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/player"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
)
|
||||
|
||||
// MatchPlayer is the model entity for the MatchPlayer schema.
|
||||
@@ -81,9 +82,12 @@ type MatchPlayer struct {
|
||||
PlayerStats uint64 `json:"player_stats,omitempty"`
|
||||
// FlashAssists holds the value of the "flash_assists" field.
|
||||
FlashAssists int `json:"flash_assists,omitempty"`
|
||||
// AvgPing holds the value of the "avg_ping" field.
|
||||
AvgPing float64 `json:"avg_ping,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the MatchPlayerQuery when eager-loading is set.
|
||||
Edges MatchPlayerEdges `json:"edges"`
|
||||
Edges MatchPlayerEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// MatchPlayerEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -108,13 +112,10 @@ type MatchPlayerEdges struct {
|
||||
// MatchesOrErr returns the Matches value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
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.
|
||||
return nil, &NotFoundError{label: match.Label}
|
||||
}
|
||||
if e.Matches != nil {
|
||||
return e.Matches, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: match.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "matches"}
|
||||
}
|
||||
@@ -122,13 +123,10 @@ func (e MatchPlayerEdges) MatchesOrErr() (*Match, error) {
|
||||
// PlayersOrErr returns the Players value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
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.
|
||||
return nil, &NotFoundError{label: player.Label}
|
||||
}
|
||||
if e.Players != nil {
|
||||
return e.Players, nil
|
||||
} else if e.loadedTypes[1] {
|
||||
return nil, &NotFoundError{label: player.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "players"}
|
||||
}
|
||||
@@ -170,18 +168,18 @@ func (e MatchPlayerEdges) MessagesOrErr() ([]*Messages, error) {
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*MatchPlayer) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*MatchPlayer) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case matchplayer.FieldFlashDurationSelf, matchplayer.FieldFlashDurationTeam, matchplayer.FieldFlashDurationEnemy:
|
||||
case matchplayer.FieldFlashDurationSelf, matchplayer.FieldFlashDurationTeam, matchplayer.FieldFlashDurationEnemy, matchplayer.FieldAvgPing:
|
||||
values[i] = new(sql.NullFloat64)
|
||||
case matchplayer.FieldID, matchplayer.FieldTeamID, matchplayer.FieldKills, matchplayer.FieldDeaths, matchplayer.FieldAssists, matchplayer.FieldHeadshot, matchplayer.FieldMvp, matchplayer.FieldScore, matchplayer.FieldRankNew, matchplayer.FieldRankOld, matchplayer.FieldMk2, matchplayer.FieldMk3, matchplayer.FieldMk4, matchplayer.FieldMk5, matchplayer.FieldDmgEnemy, matchplayer.FieldDmgTeam, matchplayer.FieldUdHe, matchplayer.FieldUdFlames, matchplayer.FieldUdFlash, matchplayer.FieldUdDecoy, matchplayer.FieldUdSmoke, matchplayer.FieldKast, matchplayer.FieldFlashTotalSelf, matchplayer.FieldFlashTotalTeam, matchplayer.FieldFlashTotalEnemy, matchplayer.FieldMatchStats, matchplayer.FieldPlayerStats, matchplayer.FieldFlashAssists:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case matchplayer.FieldCrosshair, matchplayer.FieldColor:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type MatchPlayer", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -189,7 +187,7 @@ func (*MatchPlayer) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the MatchPlayer fields.
|
||||
func (mp *MatchPlayer) assignValues(columns []string, values []interface{}) error {
|
||||
func (_m *MatchPlayer) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@@ -200,330 +198,372 @@ func (mp *MatchPlayer) assignValues(columns []string, values []interface{}) erro
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
mp.ID = int(value.Int64)
|
||||
_m.ID = int(value.Int64)
|
||||
case matchplayer.FieldTeamID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field team_id", values[i])
|
||||
} else if value.Valid {
|
||||
mp.TeamID = int(value.Int64)
|
||||
_m.TeamID = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldKills:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field kills", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Kills = int(value.Int64)
|
||||
_m.Kills = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldDeaths:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deaths", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Deaths = int(value.Int64)
|
||||
_m.Deaths = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldAssists:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field assists", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Assists = int(value.Int64)
|
||||
_m.Assists = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldHeadshot:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field headshot", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Headshot = int(value.Int64)
|
||||
_m.Headshot = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldMvp:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field mvp", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Mvp = uint(value.Int64)
|
||||
_m.Mvp = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldScore:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field score", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Score = int(value.Int64)
|
||||
_m.Score = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldRankNew:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field rank_new", values[i])
|
||||
} else if value.Valid {
|
||||
mp.RankNew = int(value.Int64)
|
||||
_m.RankNew = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldRankOld:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field rank_old", values[i])
|
||||
} else if value.Valid {
|
||||
mp.RankOld = int(value.Int64)
|
||||
_m.RankOld = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldMk2:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field mk_2", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Mk2 = uint(value.Int64)
|
||||
_m.Mk2 = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldMk3:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field mk_3", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Mk3 = uint(value.Int64)
|
||||
_m.Mk3 = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldMk4:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field mk_4", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Mk4 = uint(value.Int64)
|
||||
_m.Mk4 = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldMk5:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field mk_5", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Mk5 = uint(value.Int64)
|
||||
_m.Mk5 = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldDmgEnemy:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field dmg_enemy", values[i])
|
||||
} else if value.Valid {
|
||||
mp.DmgEnemy = uint(value.Int64)
|
||||
_m.DmgEnemy = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldDmgTeam:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field dmg_team", values[i])
|
||||
} else if value.Valid {
|
||||
mp.DmgTeam = uint(value.Int64)
|
||||
_m.DmgTeam = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldUdHe:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field ud_he", values[i])
|
||||
} else if value.Valid {
|
||||
mp.UdHe = uint(value.Int64)
|
||||
_m.UdHe = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldUdFlames:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field ud_flames", values[i])
|
||||
} else if value.Valid {
|
||||
mp.UdFlames = uint(value.Int64)
|
||||
_m.UdFlames = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldUdFlash:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field ud_flash", values[i])
|
||||
} else if value.Valid {
|
||||
mp.UdFlash = uint(value.Int64)
|
||||
_m.UdFlash = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldUdDecoy:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field ud_decoy", values[i])
|
||||
} else if value.Valid {
|
||||
mp.UdDecoy = uint(value.Int64)
|
||||
_m.UdDecoy = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldUdSmoke:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field ud_smoke", values[i])
|
||||
} else if value.Valid {
|
||||
mp.UdSmoke = uint(value.Int64)
|
||||
_m.UdSmoke = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldCrosshair:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field crosshair", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Crosshair = value.String
|
||||
_m.Crosshair = value.String
|
||||
}
|
||||
case matchplayer.FieldColor:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field color", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Color = matchplayer.Color(value.String)
|
||||
_m.Color = matchplayer.Color(value.String)
|
||||
}
|
||||
case matchplayer.FieldKast:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field kast", values[i])
|
||||
} else if value.Valid {
|
||||
mp.Kast = int(value.Int64)
|
||||
_m.Kast = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldFlashDurationSelf:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flash_duration_self", values[i])
|
||||
} else if value.Valid {
|
||||
mp.FlashDurationSelf = float32(value.Float64)
|
||||
_m.FlashDurationSelf = float32(value.Float64)
|
||||
}
|
||||
case matchplayer.FieldFlashDurationTeam:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flash_duration_team", values[i])
|
||||
} else if value.Valid {
|
||||
mp.FlashDurationTeam = float32(value.Float64)
|
||||
_m.FlashDurationTeam = float32(value.Float64)
|
||||
}
|
||||
case matchplayer.FieldFlashDurationEnemy:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flash_duration_enemy", values[i])
|
||||
} else if value.Valid {
|
||||
mp.FlashDurationEnemy = float32(value.Float64)
|
||||
_m.FlashDurationEnemy = float32(value.Float64)
|
||||
}
|
||||
case matchplayer.FieldFlashTotalSelf:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flash_total_self", values[i])
|
||||
} else if value.Valid {
|
||||
mp.FlashTotalSelf = uint(value.Int64)
|
||||
_m.FlashTotalSelf = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldFlashTotalTeam:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flash_total_team", values[i])
|
||||
} else if value.Valid {
|
||||
mp.FlashTotalTeam = uint(value.Int64)
|
||||
_m.FlashTotalTeam = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldFlashTotalEnemy:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flash_total_enemy", values[i])
|
||||
} else if value.Valid {
|
||||
mp.FlashTotalEnemy = uint(value.Int64)
|
||||
_m.FlashTotalEnemy = uint(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldMatchStats:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field match_stats", values[i])
|
||||
} else if value.Valid {
|
||||
mp.MatchStats = uint64(value.Int64)
|
||||
_m.MatchStats = uint64(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldPlayerStats:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field player_stats", values[i])
|
||||
} else if value.Valid {
|
||||
mp.PlayerStats = uint64(value.Int64)
|
||||
_m.PlayerStats = uint64(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldFlashAssists:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flash_assists", values[i])
|
||||
} else if value.Valid {
|
||||
mp.FlashAssists = int(value.Int64)
|
||||
_m.FlashAssists = int(value.Int64)
|
||||
}
|
||||
case matchplayer.FieldAvgPing:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field avg_ping", values[i])
|
||||
} else if value.Valid {
|
||||
_m.AvgPing = value.Float64
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the MatchPlayer.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *MatchPlayer) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatches queries the "matches" edge of the MatchPlayer entity.
|
||||
func (mp *MatchPlayer) QueryMatches() *MatchQuery {
|
||||
return (&MatchPlayerClient{config: mp.config}).QueryMatches(mp)
|
||||
func (_m *MatchPlayer) QueryMatches() *MatchQuery {
|
||||
return NewMatchPlayerClient(_m.config).QueryMatches(_m)
|
||||
}
|
||||
|
||||
// QueryPlayers queries the "players" edge of the MatchPlayer entity.
|
||||
func (mp *MatchPlayer) QueryPlayers() *PlayerQuery {
|
||||
return (&MatchPlayerClient{config: mp.config}).QueryPlayers(mp)
|
||||
func (_m *MatchPlayer) QueryPlayers() *PlayerQuery {
|
||||
return NewMatchPlayerClient(_m.config).QueryPlayers(_m)
|
||||
}
|
||||
|
||||
// QueryWeaponStats queries the "weapon_stats" edge of the MatchPlayer entity.
|
||||
func (mp *MatchPlayer) QueryWeaponStats() *WeaponQuery {
|
||||
return (&MatchPlayerClient{config: mp.config}).QueryWeaponStats(mp)
|
||||
func (_m *MatchPlayer) QueryWeaponStats() *WeaponQuery {
|
||||
return NewMatchPlayerClient(_m.config).QueryWeaponStats(_m)
|
||||
}
|
||||
|
||||
// QueryRoundStats queries the "round_stats" edge of the MatchPlayer entity.
|
||||
func (mp *MatchPlayer) QueryRoundStats() *RoundStatsQuery {
|
||||
return (&MatchPlayerClient{config: mp.config}).QueryRoundStats(mp)
|
||||
func (_m *MatchPlayer) QueryRoundStats() *RoundStatsQuery {
|
||||
return NewMatchPlayerClient(_m.config).QueryRoundStats(_m)
|
||||
}
|
||||
|
||||
// QuerySpray queries the "spray" edge of the MatchPlayer entity.
|
||||
func (mp *MatchPlayer) QuerySpray() *SprayQuery {
|
||||
return (&MatchPlayerClient{config: mp.config}).QuerySpray(mp)
|
||||
func (_m *MatchPlayer) QuerySpray() *SprayQuery {
|
||||
return NewMatchPlayerClient(_m.config).QuerySpray(_m)
|
||||
}
|
||||
|
||||
// QueryMessages queries the "messages" edge of the MatchPlayer entity.
|
||||
func (mp *MatchPlayer) QueryMessages() *MessagesQuery {
|
||||
return (&MatchPlayerClient{config: mp.config}).QueryMessages(mp)
|
||||
func (_m *MatchPlayer) QueryMessages() *MessagesQuery {
|
||||
return NewMatchPlayerClient(_m.config).QueryMessages(_m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this MatchPlayer.
|
||||
// Note that you need to call MatchPlayer.Unwrap() before calling this method if this MatchPlayer
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (mp *MatchPlayer) Update() *MatchPlayerUpdateOne {
|
||||
return (&MatchPlayerClient{config: mp.config}).UpdateOne(mp)
|
||||
func (_m *MatchPlayer) Update() *MatchPlayerUpdateOne {
|
||||
return NewMatchPlayerClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// 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)
|
||||
func (_m *MatchPlayer) Unwrap() *MatchPlayer {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: MatchPlayer is not a transactional entity")
|
||||
}
|
||||
mp.config.driver = tx.drv
|
||||
return mp
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (mp *MatchPlayer) String() string {
|
||||
func (_m *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("%v", mp.TeamID))
|
||||
builder.WriteString(", kills=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Kills))
|
||||
builder.WriteString(", deaths=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Deaths))
|
||||
builder.WriteString(", assists=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Assists))
|
||||
builder.WriteString(", headshot=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Headshot))
|
||||
builder.WriteString(", mvp=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Mvp))
|
||||
builder.WriteString(", score=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Score))
|
||||
builder.WriteString(", rank_new=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.RankNew))
|
||||
builder.WriteString(", rank_old=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.RankOld))
|
||||
builder.WriteString(", mk_2=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Mk2))
|
||||
builder.WriteString(", mk_3=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Mk3))
|
||||
builder.WriteString(", mk_4=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Mk4))
|
||||
builder.WriteString(", mk_5=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Mk5))
|
||||
builder.WriteString(", dmg_enemy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.DmgEnemy))
|
||||
builder.WriteString(", dmg_team=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.DmgTeam))
|
||||
builder.WriteString(", ud_he=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.UdHe))
|
||||
builder.WriteString(", ud_flames=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.UdFlames))
|
||||
builder.WriteString(", ud_flash=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.UdFlash))
|
||||
builder.WriteString(", ud_decoy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.UdDecoy))
|
||||
builder.WriteString(", ud_smoke=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.UdSmoke))
|
||||
builder.WriteString(", crosshair=")
|
||||
builder.WriteString(mp.Crosshair)
|
||||
builder.WriteString(", color=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Color))
|
||||
builder.WriteString(", kast=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.Kast))
|
||||
builder.WriteString(", flash_duration_self=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.FlashDurationSelf))
|
||||
builder.WriteString(", flash_duration_team=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.FlashDurationTeam))
|
||||
builder.WriteString(", flash_duration_enemy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.FlashDurationEnemy))
|
||||
builder.WriteString(", flash_total_self=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.FlashTotalSelf))
|
||||
builder.WriteString(", flash_total_team=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.FlashTotalTeam))
|
||||
builder.WriteString(", flash_total_enemy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.FlashTotalEnemy))
|
||||
builder.WriteString(", match_stats=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.MatchStats))
|
||||
builder.WriteString(", player_stats=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.PlayerStats))
|
||||
builder.WriteString(", flash_assists=")
|
||||
builder.WriteString(fmt.Sprintf("%v", mp.FlashAssists))
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("team_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.TeamID))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("kills=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Kills))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deaths=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deaths))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("assists=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Assists))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("headshot=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Headshot))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("mvp=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Mvp))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("score=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Score))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("rank_new=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.RankNew))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("rank_old=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.RankOld))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("mk_2=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Mk2))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("mk_3=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Mk3))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("mk_4=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Mk4))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("mk_5=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Mk5))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("dmg_enemy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.DmgEnemy))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("dmg_team=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.DmgTeam))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("ud_he=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UdHe))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("ud_flames=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UdFlames))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("ud_flash=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UdFlash))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("ud_decoy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UdDecoy))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("ud_smoke=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.UdSmoke))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("crosshair=")
|
||||
builder.WriteString(_m.Crosshair)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("color=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Color))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("kast=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Kast))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flash_duration_self=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlashDurationSelf))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flash_duration_team=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlashDurationTeam))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flash_duration_enemy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlashDurationEnemy))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flash_total_self=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlashTotalSelf))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flash_total_team=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlashTotalTeam))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flash_total_enemy=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlashTotalEnemy))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("match_stats=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.MatchStats))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("player_stats=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.PlayerStats))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flash_assists=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlashAssists))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("avg_ping=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.AvgPing))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// MatchPlayers is a parsable slice of MatchPlayer.
|
||||
type MatchPlayers []*MatchPlayer
|
||||
|
||||
func (mp MatchPlayers) config(cfg config) {
|
||||
for _i := range mp {
|
||||
mp[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package matchplayer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -75,6 +78,8 @@ const (
|
||||
FieldPlayerStats = "player_stats"
|
||||
// FieldFlashAssists holds the string denoting the flash_assists field in the database.
|
||||
FieldFlashAssists = "flash_assists"
|
||||
// FieldAvgPing holds the string denoting the avg_ping field in the database.
|
||||
FieldAvgPing = "avg_ping"
|
||||
// EdgeMatches holds the string denoting the matches edge name in mutations.
|
||||
EdgeMatches = "matches"
|
||||
// EdgePlayers holds the string denoting the players edge name in mutations.
|
||||
@@ -168,6 +173,7 @@ var Columns = []string{
|
||||
FieldMatchStats,
|
||||
FieldPlayerStats,
|
||||
FieldFlashAssists,
|
||||
FieldAvgPing,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
@@ -206,3 +212,288 @@ func ColorValidator(c Color) error {
|
||||
return fmt.Errorf("matchplayer: invalid enum value for color field: %q", c)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the MatchPlayer queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTeamID orders the results by the team_id field.
|
||||
func ByTeamID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTeamID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByKills orders the results by the kills field.
|
||||
func ByKills(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldKills, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeaths orders the results by the deaths field.
|
||||
func ByDeaths(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeaths, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAssists orders the results by the assists field.
|
||||
func ByAssists(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAssists, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeadshot orders the results by the headshot field.
|
||||
func ByHeadshot(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeadshot, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMvp orders the results by the mvp field.
|
||||
func ByMvp(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMvp, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByScore orders the results by the score field.
|
||||
func ByScore(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldScore, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRankNew orders the results by the rank_new field.
|
||||
func ByRankNew(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRankNew, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRankOld orders the results by the rank_old field.
|
||||
func ByRankOld(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRankOld, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk2 orders the results by the mk_2 field.
|
||||
func ByMk2(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk2, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk3 orders the results by the mk_3 field.
|
||||
func ByMk3(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk3, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk4 orders the results by the mk_4 field.
|
||||
func ByMk4(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk4, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMk5 orders the results by the mk_5 field.
|
||||
func ByMk5(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMk5, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDmgEnemy orders the results by the dmg_enemy field.
|
||||
func ByDmgEnemy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDmgEnemy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDmgTeam orders the results by the dmg_team field.
|
||||
func ByDmgTeam(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDmgTeam, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdHe orders the results by the ud_he field.
|
||||
func ByUdHe(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdHe, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdFlames orders the results by the ud_flames field.
|
||||
func ByUdFlames(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdFlames, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdFlash orders the results by the ud_flash field.
|
||||
func ByUdFlash(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdFlash, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdDecoy orders the results by the ud_decoy field.
|
||||
func ByUdDecoy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdDecoy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUdSmoke orders the results by the ud_smoke field.
|
||||
func ByUdSmoke(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUdSmoke, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCrosshair orders the results by the crosshair field.
|
||||
func ByCrosshair(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCrosshair, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByColor orders the results by the color field.
|
||||
func ByColor(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldColor, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByKast orders the results by the kast field.
|
||||
func ByKast(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldKast, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashDurationSelf orders the results by the flash_duration_self field.
|
||||
func ByFlashDurationSelf(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashDurationSelf, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashDurationTeam orders the results by the flash_duration_team field.
|
||||
func ByFlashDurationTeam(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashDurationTeam, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashDurationEnemy orders the results by the flash_duration_enemy field.
|
||||
func ByFlashDurationEnemy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashDurationEnemy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashTotalSelf orders the results by the flash_total_self field.
|
||||
func ByFlashTotalSelf(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashTotalSelf, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashTotalTeam orders the results by the flash_total_team field.
|
||||
func ByFlashTotalTeam(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashTotalTeam, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashTotalEnemy orders the results by the flash_total_enemy field.
|
||||
func ByFlashTotalEnemy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashTotalEnemy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchStats orders the results by the match_stats field.
|
||||
func ByMatchStats(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMatchStats, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPlayerStats orders the results by the player_stats field.
|
||||
func ByPlayerStats(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPlayerStats, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFlashAssists orders the results by the flash_assists field.
|
||||
func ByFlashAssists(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldFlashAssists, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAvgPing orders the results by the avg_ping field.
|
||||
func ByAvgPing(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAvgPing, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchesField orders the results by matches field.
|
||||
func ByMatchesField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchesStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
|
||||
// ByPlayersField orders the results by players field.
|
||||
func ByPlayersField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newPlayersStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
|
||||
// ByWeaponStatsCount orders the results by weapon_stats count.
|
||||
func ByWeaponStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newWeaponStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByWeaponStats orders the results by weapon_stats terms.
|
||||
func ByWeaponStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newWeaponStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByRoundStatsCount orders the results by round_stats count.
|
||||
func ByRoundStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newRoundStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByRoundStats orders the results by round_stats terms.
|
||||
func ByRoundStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newRoundStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// BySprayCount orders the results by spray count.
|
||||
func BySprayCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newSprayStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// BySpray orders the results by spray terms.
|
||||
func BySpray(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newSprayStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMessagesCount orders the results by messages count.
|
||||
func ByMessagesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newMessagesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMessages orders the results by messages terms.
|
||||
func ByMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newMatchesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchesTable, MatchesColumn),
|
||||
)
|
||||
}
|
||||
func newPlayersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, PlayersTable, PlayersColumn),
|
||||
)
|
||||
}
|
||||
func newWeaponStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(WeaponStatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, WeaponStatsTable, WeaponStatsColumn),
|
||||
)
|
||||
}
|
||||
func newRoundStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(RoundStatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, RoundStatsTable, RoundStatsColumn),
|
||||
)
|
||||
}
|
||||
func newSprayStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(SprayInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, SprayTable, SprayColumn),
|
||||
)
|
||||
}
|
||||
func newMessagesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MessagesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, MessagesTable, MessagesColumn),
|
||||
)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/predicate"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// MatchPlayerDelete is the builder for deleting a MatchPlayer entity.
|
||||
@@ -21,80 +20,56 @@ type MatchPlayerDelete struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MatchPlayerDelete builder.
|
||||
func (mpd *MatchPlayerDelete) Where(ps ...predicate.MatchPlayer) *MatchPlayerDelete {
|
||||
mpd.mutation.Where(ps...)
|
||||
return mpd
|
||||
func (_d *MatchPlayerDelete) Where(ps ...predicate.MatchPlayer) *MatchPlayerDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (mpd *MatchPlayerDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(mpd.hooks) == 0 {
|
||||
affected, err = mpd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MatchPlayerMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
mpd.mutation = mutation
|
||||
affected, err = mpd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(mpd.hooks) - 1; i >= 0; i-- {
|
||||
if mpd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = mpd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, mpd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_d *MatchPlayerDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mpd *MatchPlayerDelete) ExecX(ctx context.Context) int {
|
||||
n, err := mpd.Exec(ctx)
|
||||
func (_d *MatchPlayerDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (mpd *MatchPlayerDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: matchplayer.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := mpd.mutation.predicates; len(ps) > 0 {
|
||||
func (_d *MatchPlayerDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(matchplayer.Table, sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, mpd.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// MatchPlayerDeleteOne is the builder for deleting a single MatchPlayer entity.
|
||||
type MatchPlayerDeleteOne struct {
|
||||
mpd *MatchPlayerDelete
|
||||
_d *MatchPlayerDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MatchPlayerDelete builder.
|
||||
func (_d *MatchPlayerDeleteOne) Where(ps ...predicate.MatchPlayer) *MatchPlayerDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (mpdo *MatchPlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := mpdo.mpd.Exec(ctx)
|
||||
func (_d *MatchPlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
@@ -106,6 +81,8 @@ func (mpdo *MatchPlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mpdo *MatchPlayerDeleteOne) ExecX(ctx context.Context) {
|
||||
mpdo.mpd.ExecX(ctx)
|
||||
func (_d *MatchPlayerDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/messages"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/messages"
|
||||
)
|
||||
|
||||
// Messages is the model entity for the Messages schema.
|
||||
@@ -26,6 +27,7 @@ type Messages struct {
|
||||
// The values are being populated by the MessagesQuery when eager-loading is set.
|
||||
Edges MessagesEdges `json:"edges"`
|
||||
match_player_messages *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// MessagesEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -40,20 +42,17 @@ type MessagesEdges struct {
|
||||
// MatchPlayerOrErr returns the MatchPlayer value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
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.
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
if e.MatchPlayer != nil {
|
||||
return e.MatchPlayer, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "match_player"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Messages) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Messages) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case messages.FieldAllChat:
|
||||
@@ -65,7 +64,7 @@ func (*Messages) scanValues(columns []string) ([]interface{}, error) {
|
||||
case messages.ForeignKeys[0]: // match_player_messages
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Messages", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -73,7 +72,7 @@ func (*Messages) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Messages fields.
|
||||
func (m *Messages) assignValues(columns []string, values []interface{}) error {
|
||||
func (_m *Messages) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@@ -84,80 +83,84 @@ func (m *Messages) assignValues(columns []string, values []interface{}) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
m.ID = int(value.Int64)
|
||||
_m.ID = int(value.Int64)
|
||||
case messages.FieldMessage:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field message", values[i])
|
||||
} else if value.Valid {
|
||||
m.Message = value.String
|
||||
_m.Message = value.String
|
||||
}
|
||||
case messages.FieldAllChat:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field all_chat", values[i])
|
||||
} else if value.Valid {
|
||||
m.AllChat = value.Bool
|
||||
_m.AllChat = value.Bool
|
||||
}
|
||||
case messages.FieldTick:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field tick", values[i])
|
||||
} else if value.Valid {
|
||||
m.Tick = int(value.Int64)
|
||||
_m.Tick = int(value.Int64)
|
||||
}
|
||||
case messages.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field match_player_messages", value)
|
||||
} else if value.Valid {
|
||||
m.match_player_messages = new(int)
|
||||
*m.match_player_messages = int(value.Int64)
|
||||
_m.match_player_messages = new(int)
|
||||
*_m.match_player_messages = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Messages.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *Messages) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatchPlayer queries the "match_player" edge of the Messages entity.
|
||||
func (m *Messages) QueryMatchPlayer() *MatchPlayerQuery {
|
||||
return (&MessagesClient{config: m.config}).QueryMatchPlayer(m)
|
||||
func (_m *Messages) QueryMatchPlayer() *MatchPlayerQuery {
|
||||
return NewMessagesClient(_m.config).QueryMatchPlayer(_m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Messages.
|
||||
// Note that you need to call Messages.Unwrap() before calling this method if this Messages
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (m *Messages) Update() *MessagesUpdateOne {
|
||||
return (&MessagesClient{config: m.config}).UpdateOne(m)
|
||||
func (_m *Messages) Update() *MessagesUpdateOne {
|
||||
return NewMessagesClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// 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)
|
||||
func (_m *Messages) Unwrap() *Messages {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Messages is not a transactional entity")
|
||||
}
|
||||
m.config.driver = tx.drv
|
||||
return m
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (m *Messages) String() string {
|
||||
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(m.Message)
|
||||
builder.WriteString(", all_chat=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.AllChat))
|
||||
builder.WriteString(", tick=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.Tick))
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("message=")
|
||||
builder.WriteString(_m.Message)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("all_chat=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.AllChat))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("tick=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Tick))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// MessagesSlice is a parsable slice of Messages.
|
||||
type MessagesSlice []*Messages
|
||||
|
||||
func (m MessagesSlice) config(cfg config) {
|
||||
for _i := range m {
|
||||
m[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package messages
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the messages type in the database.
|
||||
Label = "messages"
|
||||
@@ -54,3 +59,40 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Messages queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMessage orders the results by the message field.
|
||||
func ByMessage(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMessage, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAllChat orders the results by the all_chat field.
|
||||
func ByAllChat(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAllChat, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTick orders the results by the tick field.
|
||||
func ByTick(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTick, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchPlayerField orders the results by match_player field.
|
||||
func ByMatchPlayerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchPlayerStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newMatchPlayerStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,317 +1,186 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package messages
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Messages(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Messages(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Messages(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Messages(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Messages(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Messages(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Messages(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Message applies equality check predicate on the "message" field. It's identical to MessageEQ.
|
||||
func Message(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldMessage, v))
|
||||
}
|
||||
|
||||
// AllChat applies equality check predicate on the "all_chat" field. It's identical to AllChatEQ.
|
||||
func AllChat(v bool) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldAllChat), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldAllChat, v))
|
||||
}
|
||||
|
||||
// Tick applies equality check predicate on the "tick" field. It's identical to TickEQ.
|
||||
func Tick(v int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldTick), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldTick, v))
|
||||
}
|
||||
|
||||
// MessageEQ applies the EQ predicate on the "message" field.
|
||||
func MessageEQ(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageNEQ applies the NEQ predicate on the "message" field.
|
||||
func MessageNEQ(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldNEQ(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageIn applies the In predicate on the "message" field.
|
||||
func MessageIn(vs ...string) predicate.Messages {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Messages(sql.FieldIn(FieldMessage, vs...))
|
||||
}
|
||||
|
||||
// MessageNotIn applies the NotIn predicate on the "message" field.
|
||||
func MessageNotIn(vs ...string) predicate.Messages {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Messages(sql.FieldNotIn(FieldMessage, vs...))
|
||||
}
|
||||
|
||||
// MessageGT applies the GT predicate on the "message" field.
|
||||
func MessageGT(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldGT(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageGTE applies the GTE predicate on the "message" field.
|
||||
func MessageGTE(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldGTE(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageLT applies the LT predicate on the "message" field.
|
||||
func MessageLT(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldLT(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageLTE applies the LTE predicate on the "message" field.
|
||||
func MessageLTE(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldLTE(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageContains applies the Contains predicate on the "message" field.
|
||||
func MessageContains(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldContains(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageHasPrefix applies the HasPrefix predicate on the "message" field.
|
||||
func MessageHasPrefix(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldHasPrefix(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageHasSuffix applies the HasSuffix predicate on the "message" field.
|
||||
func MessageHasSuffix(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldHasSuffix(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageEqualFold applies the EqualFold predicate on the "message" field.
|
||||
func MessageEqualFold(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEqualFold(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageContainsFold applies the ContainsFold predicate on the "message" field.
|
||||
func MessageContainsFold(v string) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldMessage), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldContainsFold(FieldMessage, v))
|
||||
}
|
||||
|
||||
// AllChatEQ applies the EQ predicate on the "all_chat" field.
|
||||
func AllChatEQ(v bool) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldAllChat), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldAllChat, v))
|
||||
}
|
||||
|
||||
// AllChatNEQ applies the NEQ predicate on the "all_chat" field.
|
||||
func AllChatNEQ(v bool) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldAllChat), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldNEQ(FieldAllChat, v))
|
||||
}
|
||||
|
||||
// TickEQ applies the EQ predicate on the "tick" field.
|
||||
func TickEQ(v int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldTick), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldEQ(FieldTick, v))
|
||||
}
|
||||
|
||||
// TickNEQ applies the NEQ predicate on the "tick" field.
|
||||
func TickNEQ(v int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldTick), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldNEQ(FieldTick, v))
|
||||
}
|
||||
|
||||
// TickIn applies the In predicate on the "tick" field.
|
||||
func TickIn(vs ...int) predicate.Messages {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Messages(sql.FieldIn(FieldTick, vs...))
|
||||
}
|
||||
|
||||
// TickNotIn applies the NotIn predicate on the "tick" field.
|
||||
func TickNotIn(vs ...int) predicate.Messages {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Messages(sql.FieldNotIn(FieldTick, vs...))
|
||||
}
|
||||
|
||||
// TickGT applies the GT predicate on the "tick" field.
|
||||
func TickGT(v int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldTick), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldGT(FieldTick, v))
|
||||
}
|
||||
|
||||
// TickGTE applies the GTE predicate on the "tick" field.
|
||||
func TickGTE(v int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldTick), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldGTE(FieldTick, v))
|
||||
}
|
||||
|
||||
// TickLT applies the LT predicate on the "tick" field.
|
||||
func TickLT(v int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldTick), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldLT(FieldTick, v))
|
||||
}
|
||||
|
||||
// TickLTE applies the LTE predicate on the "tick" field.
|
||||
func TickLTE(v int) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldTick), v))
|
||||
})
|
||||
return predicate.Messages(sql.FieldLTE(FieldTick, v))
|
||||
}
|
||||
|
||||
// HasMatchPlayer applies the HasEdge predicate on the "match_player" edge.
|
||||
@@ -319,7 +188,6 @@ func HasMatchPlayer() predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@@ -329,11 +197,7 @@ func HasMatchPlayer() predicate.Messages {
|
||||
// HasMatchPlayerWith applies the HasEdge predicate on the "match_player" edge with a given conditions (other predicates).
|
||||
func HasMatchPlayerWith(preds ...predicate.MatchPlayer) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
step := newMatchPlayerStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -344,32 +208,15 @@ func HasMatchPlayerWith(preds ...predicate.MatchPlayer) predicate.Messages {
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Messages) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Messages(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Messages) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Messages(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Messages) predicate.Messages {
|
||||
return predicate.Messages(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
return predicate.Messages(sql.NotPredicates(p))
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/messages"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/messages"
|
||||
)
|
||||
|
||||
// MessagesCreate is the builder for creating a Messages entity.
|
||||
@@ -21,91 +21,55 @@ type MessagesCreate struct {
|
||||
}
|
||||
|
||||
// SetMessage sets the "message" field.
|
||||
func (mc *MessagesCreate) SetMessage(s string) *MessagesCreate {
|
||||
mc.mutation.SetMessage(s)
|
||||
return mc
|
||||
func (_c *MessagesCreate) SetMessage(v string) *MessagesCreate {
|
||||
_c.mutation.SetMessage(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAllChat sets the "all_chat" field.
|
||||
func (mc *MessagesCreate) SetAllChat(b bool) *MessagesCreate {
|
||||
mc.mutation.SetAllChat(b)
|
||||
return mc
|
||||
func (_c *MessagesCreate) SetAllChat(v bool) *MessagesCreate {
|
||||
_c.mutation.SetAllChat(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetTick sets the "tick" field.
|
||||
func (mc *MessagesCreate) SetTick(i int) *MessagesCreate {
|
||||
mc.mutation.SetTick(i)
|
||||
return mc
|
||||
func (_c *MessagesCreate) SetTick(v int) *MessagesCreate {
|
||||
_c.mutation.SetTick(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (mc *MessagesCreate) SetMatchPlayerID(id int) *MessagesCreate {
|
||||
mc.mutation.SetMatchPlayerID(id)
|
||||
return mc
|
||||
func (_c *MessagesCreate) SetMatchPlayerID(id int) *MessagesCreate {
|
||||
_c.mutation.SetMatchPlayerID(id)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (mc *MessagesCreate) SetNillableMatchPlayerID(id *int) *MessagesCreate {
|
||||
func (_c *MessagesCreate) SetNillableMatchPlayerID(id *int) *MessagesCreate {
|
||||
if id != nil {
|
||||
mc = mc.SetMatchPlayerID(*id)
|
||||
_c = _c.SetMatchPlayerID(*id)
|
||||
}
|
||||
return mc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (mc *MessagesCreate) SetMatchPlayer(m *MatchPlayer) *MessagesCreate {
|
||||
return mc.SetMatchPlayerID(m.ID)
|
||||
func (_c *MessagesCreate) SetMatchPlayer(v *MatchPlayer) *MessagesCreate {
|
||||
return _c.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the MessagesMutation object of the builder.
|
||||
func (mc *MessagesCreate) Mutation() *MessagesMutation {
|
||||
return mc.mutation
|
||||
func (_c *MessagesCreate) Mutation() *MessagesMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the Messages in the database.
|
||||
func (mc *MessagesCreate) Save(ctx context.Context) (*Messages, error) {
|
||||
var (
|
||||
err error
|
||||
node *Messages
|
||||
)
|
||||
if len(mc.hooks) == 0 {
|
||||
if err = mc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = mc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MessagesMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = mc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mc.mutation = mutation
|
||||
if node, err = mc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(mc.hooks) - 1; i >= 0; i-- {
|
||||
if mc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = mc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, mc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_c *MessagesCreate) Save(ctx context.Context) (*Messages, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (mc *MessagesCreate) SaveX(ctx context.Context) *Messages {
|
||||
v, err := mc.Save(ctx)
|
||||
func (_c *MessagesCreate) SaveX(ctx context.Context) *Messages {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -113,81 +77,68 @@ func (mc *MessagesCreate) SaveX(ctx context.Context) *Messages {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (mc *MessagesCreate) Exec(ctx context.Context) error {
|
||||
_, err := mc.Save(ctx)
|
||||
func (_c *MessagesCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mc *MessagesCreate) ExecX(ctx context.Context) {
|
||||
if err := mc.Exec(ctx); err != nil {
|
||||
func (_c *MessagesCreate) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (mc *MessagesCreate) check() error {
|
||||
if _, ok := mc.mutation.Message(); !ok {
|
||||
func (_c *MessagesCreate) check() error {
|
||||
if _, ok := _c.mutation.Message(); !ok {
|
||||
return &ValidationError{Name: "message", err: errors.New(`ent: missing required field "Messages.message"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.AllChat(); !ok {
|
||||
if _, ok := _c.mutation.AllChat(); !ok {
|
||||
return &ValidationError{Name: "all_chat", err: errors.New(`ent: missing required field "Messages.all_chat"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.Tick(); !ok {
|
||||
if _, ok := _c.mutation.Tick(); !ok {
|
||||
return &ValidationError{Name: "tick", err: errors.New(`ent: missing required field "Messages.tick"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mc *MessagesCreate) sqlSave(ctx context.Context) (*Messages, error) {
|
||||
_node, _spec := mc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil {
|
||||
func (_c *MessagesCreate) sqlSave(ctx context.Context) (*Messages, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int(id)
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (mc *MessagesCreate) createSpec() (*Messages, *sqlgraph.CreateSpec) {
|
||||
func (_c *MessagesCreate) createSpec() (*Messages, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Messages{config: mc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: messages.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
}
|
||||
_node = &Messages{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(messages.Table, sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt))
|
||||
)
|
||||
if value, ok := mc.mutation.Message(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: messages.FieldMessage,
|
||||
})
|
||||
if value, ok := _c.mutation.Message(); ok {
|
||||
_spec.SetField(messages.FieldMessage, field.TypeString, value)
|
||||
_node.Message = value
|
||||
}
|
||||
if value, ok := mc.mutation.AllChat(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: messages.FieldAllChat,
|
||||
})
|
||||
if value, ok := _c.mutation.AllChat(); ok {
|
||||
_spec.SetField(messages.FieldAllChat, field.TypeBool, value)
|
||||
_node.AllChat = value
|
||||
}
|
||||
if value, ok := mc.mutation.Tick(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: messages.FieldTick,
|
||||
})
|
||||
if value, ok := _c.mutation.Tick(); ok {
|
||||
_spec.SetField(messages.FieldTick, field.TypeInt, value)
|
||||
_node.Tick = value
|
||||
}
|
||||
if nodes := mc.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _c.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -195,10 +146,7 @@ func (mc *MessagesCreate) createSpec() (*Messages, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -213,17 +161,21 @@ func (mc *MessagesCreate) createSpec() (*Messages, *sqlgraph.CreateSpec) {
|
||||
// MessagesCreateBulk is the builder for creating many Messages entities in bulk.
|
||||
type MessagesCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*MessagesCreate
|
||||
}
|
||||
|
||||
// Save creates the Messages entities in the database.
|
||||
func (mcb *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) {
|
||||
specs := make([]*sqlgraph.CreateSpec, len(mcb.builders))
|
||||
nodes := make([]*Messages, len(mcb.builders))
|
||||
mutators := make([]Mutator, len(mcb.builders))
|
||||
for i := range mcb.builders {
|
||||
func (_c *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*Messages, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := mcb.builders[i]
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MessagesMutation)
|
||||
if !ok {
|
||||
@@ -233,16 +185,16 @@ func (mcb *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, mcb.builders[i+1].mutation)
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, mcb.driver, spec); err != nil {
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,11 +202,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-- {
|
||||
@@ -264,7 +216,7 @@ func (mcb *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) {
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, mcb.builders[0].mutation); err != nil {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -272,8 +224,8 @@ func (mcb *MessagesCreateBulk) Save(ctx context.Context) ([]*Messages, error) {
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (mcb *MessagesCreateBulk) SaveX(ctx context.Context) []*Messages {
|
||||
v, err := mcb.Save(ctx)
|
||||
func (_c *MessagesCreateBulk) SaveX(ctx context.Context) []*Messages {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -281,14 +233,14 @@ func (mcb *MessagesCreateBulk) SaveX(ctx context.Context) []*Messages {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (mcb *MessagesCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := mcb.Save(ctx)
|
||||
func (_c *MessagesCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mcb *MessagesCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := mcb.Exec(ctx); err != nil {
|
||||
func (_c *MessagesCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/messages"
|
||||
"csgowtfd/ent/predicate"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/messages"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// MessagesDelete is the builder for deleting a Messages entity.
|
||||
@@ -21,80 +20,56 @@ type MessagesDelete struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MessagesDelete builder.
|
||||
func (md *MessagesDelete) Where(ps ...predicate.Messages) *MessagesDelete {
|
||||
md.mutation.Where(ps...)
|
||||
return md
|
||||
func (_d *MessagesDelete) Where(ps ...predicate.Messages) *MessagesDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (md *MessagesDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(md.hooks) == 0 {
|
||||
affected, err = md.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MessagesMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
md.mutation = mutation
|
||||
affected, err = md.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(md.hooks) - 1; i >= 0; i-- {
|
||||
if md.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = md.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, md.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_d *MessagesDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (md *MessagesDelete) ExecX(ctx context.Context) int {
|
||||
n, err := md.Exec(ctx)
|
||||
func (_d *MessagesDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (md *MessagesDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: messages.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := md.mutation.predicates; len(ps) > 0 {
|
||||
func (_d *MessagesDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(messages.Table, sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, md.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// MessagesDeleteOne is the builder for deleting a single Messages entity.
|
||||
type MessagesDeleteOne struct {
|
||||
md *MessagesDelete
|
||||
_d *MessagesDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MessagesDelete builder.
|
||||
func (_d *MessagesDeleteOne) Where(ps ...predicate.Messages) *MessagesDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (mdo *MessagesDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := mdo.md.Exec(ctx)
|
||||
func (_d *MessagesDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
@@ -106,6 +81,8 @@ func (mdo *MessagesDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mdo *MessagesDeleteOne) ExecX(ctx context.Context) {
|
||||
mdo.md.ExecX(ctx)
|
||||
func (_d *MessagesDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,123 +1,121 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/messages"
|
||||
"csgowtfd/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/messages"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// 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.
|
||||
func (mu *MessagesUpdate) Where(ps ...predicate.Messages) *MessagesUpdate {
|
||||
mu.mutation.Where(ps...)
|
||||
return mu
|
||||
func (_u *MessagesUpdate) Where(ps ...predicate.Messages) *MessagesUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMessage sets the "message" field.
|
||||
func (mu *MessagesUpdate) SetMessage(s string) *MessagesUpdate {
|
||||
mu.mutation.SetMessage(s)
|
||||
return mu
|
||||
func (_u *MessagesUpdate) SetMessage(v string) *MessagesUpdate {
|
||||
_u.mutation.SetMessage(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMessage sets the "message" field if the given value is not nil.
|
||||
func (_u *MessagesUpdate) SetNillableMessage(v *string) *MessagesUpdate {
|
||||
if v != nil {
|
||||
_u.SetMessage(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAllChat sets the "all_chat" field.
|
||||
func (mu *MessagesUpdate) SetAllChat(b bool) *MessagesUpdate {
|
||||
mu.mutation.SetAllChat(b)
|
||||
return mu
|
||||
func (_u *MessagesUpdate) SetAllChat(v bool) *MessagesUpdate {
|
||||
_u.mutation.SetAllChat(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAllChat sets the "all_chat" field if the given value is not nil.
|
||||
func (_u *MessagesUpdate) SetNillableAllChat(v *bool) *MessagesUpdate {
|
||||
if v != nil {
|
||||
_u.SetAllChat(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetTick sets the "tick" field.
|
||||
func (mu *MessagesUpdate) SetTick(i int) *MessagesUpdate {
|
||||
mu.mutation.ResetTick()
|
||||
mu.mutation.SetTick(i)
|
||||
return mu
|
||||
func (_u *MessagesUpdate) SetTick(v int) *MessagesUpdate {
|
||||
_u.mutation.ResetTick()
|
||||
_u.mutation.SetTick(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddTick adds i to the "tick" field.
|
||||
func (mu *MessagesUpdate) AddTick(i int) *MessagesUpdate {
|
||||
mu.mutation.AddTick(i)
|
||||
return mu
|
||||
// SetNillableTick sets the "tick" field if the given value is not nil.
|
||||
func (_u *MessagesUpdate) SetNillableTick(v *int) *MessagesUpdate {
|
||||
if v != nil {
|
||||
_u.SetTick(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddTick adds value to the "tick" field.
|
||||
func (_u *MessagesUpdate) AddTick(v int) *MessagesUpdate {
|
||||
_u.mutation.AddTick(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (mu *MessagesUpdate) SetMatchPlayerID(id int) *MessagesUpdate {
|
||||
mu.mutation.SetMatchPlayerID(id)
|
||||
return mu
|
||||
func (_u *MessagesUpdate) SetMatchPlayerID(id int) *MessagesUpdate {
|
||||
_u.mutation.SetMatchPlayerID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (mu *MessagesUpdate) SetNillableMatchPlayerID(id *int) *MessagesUpdate {
|
||||
func (_u *MessagesUpdate) SetNillableMatchPlayerID(id *int) *MessagesUpdate {
|
||||
if id != nil {
|
||||
mu = mu.SetMatchPlayerID(*id)
|
||||
_u = _u.SetMatchPlayerID(*id)
|
||||
}
|
||||
return mu
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (mu *MessagesUpdate) SetMatchPlayer(m *MatchPlayer) *MessagesUpdate {
|
||||
return mu.SetMatchPlayerID(m.ID)
|
||||
func (_u *MessagesUpdate) SetMatchPlayer(v *MatchPlayer) *MessagesUpdate {
|
||||
return _u.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the MessagesMutation object of the builder.
|
||||
func (mu *MessagesUpdate) Mutation() *MessagesMutation {
|
||||
return mu.mutation
|
||||
func (_u *MessagesUpdate) Mutation() *MessagesMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayer clears the "match_player" edge to the MatchPlayer entity.
|
||||
func (mu *MessagesUpdate) ClearMatchPlayer() *MessagesUpdate {
|
||||
mu.mutation.ClearMatchPlayer()
|
||||
return mu
|
||||
func (_u *MessagesUpdate) ClearMatchPlayer() *MessagesUpdate {
|
||||
_u.mutation.ClearMatchPlayer()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (mu *MessagesUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(mu.hooks) == 0 {
|
||||
affected, err = mu.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MessagesMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
mu.mutation = mutation
|
||||
affected, err = mu.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(mu.hooks) - 1; i >= 0; i-- {
|
||||
if mu.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = mu.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, mu.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_u *MessagesUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (mu *MessagesUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := mu.Save(ctx)
|
||||
func (_u *MessagesUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -125,65 +123,46 @@ func (mu *MessagesUpdate) SaveX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (mu *MessagesUpdate) Exec(ctx context.Context) error {
|
||||
_, err := mu.Save(ctx)
|
||||
func (_u *MessagesUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (mu *MessagesUpdate) ExecX(ctx context.Context) {
|
||||
if err := mu.Exec(ctx); err != nil {
|
||||
func (_u *MessagesUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: messages.Table,
|
||||
Columns: messages.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := mu.mutation.predicates; len(ps) > 0 {
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *MessagesUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MessagesUpdate {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *MessagesUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(messages.Table, messages.Columns, sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := mu.mutation.Message(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: messages.FieldMessage,
|
||||
})
|
||||
if value, ok := _u.mutation.Message(); ok {
|
||||
_spec.SetField(messages.FieldMessage, field.TypeString, value)
|
||||
}
|
||||
if value, ok := mu.mutation.AllChat(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: messages.FieldAllChat,
|
||||
})
|
||||
if value, ok := _u.mutation.AllChat(); ok {
|
||||
_spec.SetField(messages.FieldAllChat, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := mu.mutation.Tick(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: messages.FieldTick,
|
||||
})
|
||||
if value, ok := _u.mutation.Tick(); ok {
|
||||
_spec.SetField(messages.FieldTick, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := mu.mutation.AddedTick(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: messages.FieldTick,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedTick(); ok {
|
||||
_spec.AddField(messages.FieldTick, field.TypeInt, value)
|
||||
}
|
||||
if mu.mutation.MatchPlayerCleared() {
|
||||
if _u.mutation.MatchPlayerCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -191,15 +170,12 @@ func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := mu.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -207,10 +183,7 @@ func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -218,122 +191,128 @@ func (mu *MessagesUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, mu.driver, _spec); err != nil {
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.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
|
||||
}
|
||||
return n, nil
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (muo *MessagesUpdateOne) SetMessage(s string) *MessagesUpdateOne {
|
||||
muo.mutation.SetMessage(s)
|
||||
return muo
|
||||
func (_u *MessagesUpdateOne) SetMessage(v string) *MessagesUpdateOne {
|
||||
_u.mutation.SetMessage(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMessage sets the "message" field if the given value is not nil.
|
||||
func (_u *MessagesUpdateOne) SetNillableMessage(v *string) *MessagesUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetMessage(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAllChat sets the "all_chat" field.
|
||||
func (muo *MessagesUpdateOne) SetAllChat(b bool) *MessagesUpdateOne {
|
||||
muo.mutation.SetAllChat(b)
|
||||
return muo
|
||||
func (_u *MessagesUpdateOne) SetAllChat(v bool) *MessagesUpdateOne {
|
||||
_u.mutation.SetAllChat(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAllChat sets the "all_chat" field if the given value is not nil.
|
||||
func (_u *MessagesUpdateOne) SetNillableAllChat(v *bool) *MessagesUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetAllChat(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetTick sets the "tick" field.
|
||||
func (muo *MessagesUpdateOne) SetTick(i int) *MessagesUpdateOne {
|
||||
muo.mutation.ResetTick()
|
||||
muo.mutation.SetTick(i)
|
||||
return muo
|
||||
func (_u *MessagesUpdateOne) SetTick(v int) *MessagesUpdateOne {
|
||||
_u.mutation.ResetTick()
|
||||
_u.mutation.SetTick(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddTick adds i to the "tick" field.
|
||||
func (muo *MessagesUpdateOne) AddTick(i int) *MessagesUpdateOne {
|
||||
muo.mutation.AddTick(i)
|
||||
return muo
|
||||
// SetNillableTick sets the "tick" field if the given value is not nil.
|
||||
func (_u *MessagesUpdateOne) SetNillableTick(v *int) *MessagesUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetTick(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddTick adds value to the "tick" field.
|
||||
func (_u *MessagesUpdateOne) AddTick(v int) *MessagesUpdateOne {
|
||||
_u.mutation.AddTick(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (muo *MessagesUpdateOne) SetMatchPlayerID(id int) *MessagesUpdateOne {
|
||||
muo.mutation.SetMatchPlayerID(id)
|
||||
return muo
|
||||
func (_u *MessagesUpdateOne) SetMatchPlayerID(id int) *MessagesUpdateOne {
|
||||
_u.mutation.SetMatchPlayerID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (muo *MessagesUpdateOne) SetNillableMatchPlayerID(id *int) *MessagesUpdateOne {
|
||||
func (_u *MessagesUpdateOne) SetNillableMatchPlayerID(id *int) *MessagesUpdateOne {
|
||||
if id != nil {
|
||||
muo = muo.SetMatchPlayerID(*id)
|
||||
_u = _u.SetMatchPlayerID(*id)
|
||||
}
|
||||
return muo
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (muo *MessagesUpdateOne) SetMatchPlayer(m *MatchPlayer) *MessagesUpdateOne {
|
||||
return muo.SetMatchPlayerID(m.ID)
|
||||
func (_u *MessagesUpdateOne) SetMatchPlayer(v *MatchPlayer) *MessagesUpdateOne {
|
||||
return _u.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the MessagesMutation object of the builder.
|
||||
func (muo *MessagesUpdateOne) Mutation() *MessagesMutation {
|
||||
return muo.mutation
|
||||
func (_u *MessagesUpdateOne) Mutation() *MessagesMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayer clears the "match_player" edge to the MatchPlayer entity.
|
||||
func (muo *MessagesUpdateOne) ClearMatchPlayer() *MessagesUpdateOne {
|
||||
muo.mutation.ClearMatchPlayer()
|
||||
return muo
|
||||
func (_u *MessagesUpdateOne) ClearMatchPlayer() *MessagesUpdateOne {
|
||||
_u.mutation.ClearMatchPlayer()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the MessagesUpdate builder.
|
||||
func (_u *MessagesUpdateOne) Where(ps ...predicate.Messages) *MessagesUpdateOne {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (muo *MessagesUpdateOne) Select(field string, fields ...string) *MessagesUpdateOne {
|
||||
muo.fields = append([]string{field}, fields...)
|
||||
return muo
|
||||
func (_u *MessagesUpdateOne) Select(field string, fields ...string) *MessagesUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated Messages entity.
|
||||
func (muo *MessagesUpdateOne) Save(ctx context.Context) (*Messages, error) {
|
||||
var (
|
||||
err error
|
||||
node *Messages
|
||||
)
|
||||
if len(muo.hooks) == 0 {
|
||||
node, err = muo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*MessagesMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
muo.mutation = mutation
|
||||
node, err = muo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(muo.hooks) - 1; i >= 0; i-- {
|
||||
if muo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = muo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, muo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_u *MessagesUpdateOne) Save(ctx context.Context) (*Messages, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (muo *MessagesUpdateOne) SaveX(ctx context.Context) *Messages {
|
||||
node, err := muo.Save(ctx)
|
||||
func (_u *MessagesUpdateOne) SaveX(ctx context.Context) *Messages {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -341,35 +320,32 @@ func (muo *MessagesUpdateOne) SaveX(ctx context.Context) *Messages {
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (muo *MessagesUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := muo.Save(ctx)
|
||||
func (_u *MessagesUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (muo *MessagesUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := muo.Exec(ctx); err != nil {
|
||||
func (_u *MessagesUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: messages.Table,
|
||||
Columns: messages.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: messages.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
id, ok := muo.mutation.ID()
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *MessagesUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MessagesUpdateOne {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(messages.Table, messages.Columns, sqlgraph.NewFieldSpec(messages.FieldID, field.TypeInt))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Messages.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := muo.fields; len(fields) > 0 {
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, messages.FieldID)
|
||||
for _, f := range fields {
|
||||
@@ -381,42 +357,26 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := muo.mutation.predicates; len(ps) > 0 {
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := muo.mutation.Message(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: messages.FieldMessage,
|
||||
})
|
||||
if value, ok := _u.mutation.Message(); ok {
|
||||
_spec.SetField(messages.FieldMessage, field.TypeString, value)
|
||||
}
|
||||
if value, ok := muo.mutation.AllChat(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBool,
|
||||
Value: value,
|
||||
Column: messages.FieldAllChat,
|
||||
})
|
||||
if value, ok := _u.mutation.AllChat(); ok {
|
||||
_spec.SetField(messages.FieldAllChat, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := muo.mutation.Tick(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: messages.FieldTick,
|
||||
})
|
||||
if value, ok := _u.mutation.Tick(); ok {
|
||||
_spec.SetField(messages.FieldTick, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := muo.mutation.AddedTick(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: messages.FieldTick,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedTick(); ok {
|
||||
_spec.AddField(messages.FieldTick, field.TypeInt, value)
|
||||
}
|
||||
if muo.mutation.MatchPlayerCleared() {
|
||||
if _u.mutation.MatchPlayerCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -424,15 +384,12 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := muo.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -440,10 +397,7 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err
|
||||
Columns: []string{messages.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -451,16 +405,18 @@ func (muo *MessagesUpdateOne) sqlSave(ctx context.Context) (_node *Messages, err
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_node = &Messages{config: muo.config}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
_node = &Messages{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, muo.driver, _spec); err != nil {
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.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 nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
@@ -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...)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
@@ -24,6 +24,7 @@ var (
|
||||
{Name: "vac_present", Type: field.TypeBool, Default: false},
|
||||
{Name: "gameban_present", Type: field.TypeBool, Default: false},
|
||||
{Name: "decryption_key", Type: field.TypeBytes, Nullable: true},
|
||||
{Name: "tick_rate", Type: field.TypeFloat64, Nullable: true},
|
||||
}
|
||||
// MatchesTable holds the schema information for the "matches" table.
|
||||
MatchesTable = &schema.Table{
|
||||
@@ -64,6 +65,7 @@ var (
|
||||
{Name: "flash_total_team", Type: field.TypeUint, Nullable: true},
|
||||
{Name: "flash_total_enemy", Type: field.TypeUint, Nullable: true},
|
||||
{Name: "flash_assists", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "avg_ping", Type: field.TypeFloat64, Nullable: true},
|
||||
{Name: "match_stats", Type: field.TypeUint64, Nullable: true},
|
||||
{Name: "player_stats", Type: field.TypeUint64, Nullable: true},
|
||||
}
|
||||
@@ -75,13 +77,13 @@ var (
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "match_players_matches_stats",
|
||||
Columns: []*schema.Column{MatchPlayersColumns[31]},
|
||||
Columns: []*schema.Column{MatchPlayersColumns[32]},
|
||||
RefColumns: []*schema.Column{MatchesColumns[0]},
|
||||
OnDelete: schema.SetNull,
|
||||
},
|
||||
{
|
||||
Symbol: "match_players_players_stats",
|
||||
Columns: []*schema.Column{MatchPlayersColumns[32]},
|
||||
Columns: []*schema.Column{MatchPlayersColumns[33]},
|
||||
RefColumns: []*schema.Column{PlayersColumns[0]},
|
||||
OnDelete: schema.SetNull,
|
||||
},
|
||||
|
||||
352
ent/mutation.go
352
ent/mutation.go
@@ -1,23 +1,24 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/messages"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"csgowtfd/ent/spray"
|
||||
"csgowtfd/ent/weapon"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/messages"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -62,6 +63,8 @@ type MatchMutation struct {
|
||||
vac_present *bool
|
||||
gameban_present *bool
|
||||
decryption_key *[]byte
|
||||
tick_rate *float64
|
||||
addtick_rate *float64
|
||||
clearedFields map[string]struct{}
|
||||
stats map[int]struct{}
|
||||
removedstats map[int]struct{}
|
||||
@@ -785,6 +788,76 @@ func (m *MatchMutation) ResetDecryptionKey() {
|
||||
delete(m.clearedFields, match.FieldDecryptionKey)
|
||||
}
|
||||
|
||||
// SetTickRate sets the "tick_rate" field.
|
||||
func (m *MatchMutation) SetTickRate(f float64) {
|
||||
m.tick_rate = &f
|
||||
m.addtick_rate = nil
|
||||
}
|
||||
|
||||
// TickRate returns the value of the "tick_rate" field in the mutation.
|
||||
func (m *MatchMutation) TickRate() (r float64, exists bool) {
|
||||
v := m.tick_rate
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldTickRate returns the old "tick_rate" field's value of the Match entity.
|
||||
// If the Match object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *MatchMutation) OldTickRate(ctx context.Context) (v float64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldTickRate is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldTickRate requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldTickRate: %w", err)
|
||||
}
|
||||
return oldValue.TickRate, nil
|
||||
}
|
||||
|
||||
// AddTickRate adds f to the "tick_rate" field.
|
||||
func (m *MatchMutation) AddTickRate(f float64) {
|
||||
if m.addtick_rate != nil {
|
||||
*m.addtick_rate += f
|
||||
} else {
|
||||
m.addtick_rate = &f
|
||||
}
|
||||
}
|
||||
|
||||
// AddedTickRate returns the value that was added to the "tick_rate" field in this mutation.
|
||||
func (m *MatchMutation) AddedTickRate() (r float64, exists bool) {
|
||||
v := m.addtick_rate
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearTickRate clears the value of the "tick_rate" field.
|
||||
func (m *MatchMutation) ClearTickRate() {
|
||||
m.tick_rate = nil
|
||||
m.addtick_rate = nil
|
||||
m.clearedFields[match.FieldTickRate] = struct{}{}
|
||||
}
|
||||
|
||||
// TickRateCleared returns if the "tick_rate" field was cleared in this mutation.
|
||||
func (m *MatchMutation) TickRateCleared() bool {
|
||||
_, ok := m.clearedFields[match.FieldTickRate]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetTickRate resets all changes to the "tick_rate" field.
|
||||
func (m *MatchMutation) ResetTickRate() {
|
||||
m.tick_rate = nil
|
||||
m.addtick_rate = nil
|
||||
delete(m.clearedFields, match.FieldTickRate)
|
||||
}
|
||||
|
||||
// AddStatIDs adds the "stats" edge to the MatchPlayer entity by ids.
|
||||
func (m *MatchMutation) AddStatIDs(ids ...int) {
|
||||
if m.stats == nil {
|
||||
@@ -898,11 +971,26 @@ func (m *MatchMutation) Where(ps ...predicate.Match) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the MatchMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *MatchMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Match, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *MatchMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *MatchMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Match).
|
||||
func (m *MatchMutation) Type() string {
|
||||
return m.typ
|
||||
@@ -912,7 +1000,7 @@ func (m *MatchMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *MatchMutation) Fields() []string {
|
||||
fields := make([]string, 0, 13)
|
||||
fields := make([]string, 0, 14)
|
||||
if m.share_code != nil {
|
||||
fields = append(fields, match.FieldShareCode)
|
||||
}
|
||||
@@ -952,6 +1040,9 @@ func (m *MatchMutation) Fields() []string {
|
||||
if m.decryption_key != nil {
|
||||
fields = append(fields, match.FieldDecryptionKey)
|
||||
}
|
||||
if m.tick_rate != nil {
|
||||
fields = append(fields, match.FieldTickRate)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -986,6 +1077,8 @@ func (m *MatchMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.GamebanPresent()
|
||||
case match.FieldDecryptionKey:
|
||||
return m.DecryptionKey()
|
||||
case match.FieldTickRate:
|
||||
return m.TickRate()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -1021,6 +1114,8 @@ func (m *MatchMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
||||
return m.OldGamebanPresent(ctx)
|
||||
case match.FieldDecryptionKey:
|
||||
return m.OldDecryptionKey(ctx)
|
||||
case match.FieldTickRate:
|
||||
return m.OldTickRate(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
@@ -1121,6 +1216,13 @@ func (m *MatchMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetDecryptionKey(v)
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetTickRate(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
@@ -1144,6 +1246,9 @@ func (m *MatchMutation) AddedFields() []string {
|
||||
if m.addmax_rounds != nil {
|
||||
fields = append(fields, match.FieldMaxRounds)
|
||||
}
|
||||
if m.addtick_rate != nil {
|
||||
fields = append(fields, match.FieldTickRate)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -1162,6 +1267,8 @@ func (m *MatchMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return m.AddedMatchResult()
|
||||
case match.FieldMaxRounds:
|
||||
return m.AddedMaxRounds()
|
||||
case match.FieldTickRate:
|
||||
return m.AddedTickRate()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -1206,6 +1313,13 @@ func (m *MatchMutation) AddField(name string, value ent.Value) error {
|
||||
}
|
||||
m.AddMaxRounds(v)
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddTickRate(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match numeric field %s", name)
|
||||
}
|
||||
@@ -1223,6 +1337,9 @@ func (m *MatchMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(match.FieldDecryptionKey) {
|
||||
fields = append(fields, match.FieldDecryptionKey)
|
||||
}
|
||||
if m.FieldCleared(match.FieldTickRate) {
|
||||
fields = append(fields, match.FieldTickRate)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -1246,6 +1363,9 @@ func (m *MatchMutation) ClearField(name string) error {
|
||||
case match.FieldDecryptionKey:
|
||||
m.ClearDecryptionKey()
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
m.ClearTickRate()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match nullable field %s", name)
|
||||
}
|
||||
@@ -1293,6 +1413,9 @@ func (m *MatchMutation) ResetField(name string) error {
|
||||
case match.FieldDecryptionKey:
|
||||
m.ResetDecryptionKey()
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
m.ResetTickRate()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
@@ -1471,6 +1594,8 @@ type MatchPlayerMutation struct {
|
||||
addflash_total_enemy *int
|
||||
flash_assists *int
|
||||
addflash_assists *int
|
||||
avg_ping *float64
|
||||
addavg_ping *float64
|
||||
clearedFields map[string]struct{}
|
||||
matches *uint64
|
||||
clearedmatches bool
|
||||
@@ -3649,6 +3774,76 @@ func (m *MatchPlayerMutation) ResetFlashAssists() {
|
||||
delete(m.clearedFields, matchplayer.FieldFlashAssists)
|
||||
}
|
||||
|
||||
// SetAvgPing sets the "avg_ping" field.
|
||||
func (m *MatchPlayerMutation) SetAvgPing(f float64) {
|
||||
m.avg_ping = &f
|
||||
m.addavg_ping = nil
|
||||
}
|
||||
|
||||
// AvgPing returns the value of the "avg_ping" field in the mutation.
|
||||
func (m *MatchPlayerMutation) AvgPing() (r float64, exists bool) {
|
||||
v := m.avg_ping
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAvgPing returns the old "avg_ping" field's value of the MatchPlayer entity.
|
||||
// If the MatchPlayer object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *MatchPlayerMutation) OldAvgPing(ctx context.Context) (v float64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldAvgPing is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldAvgPing requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldAvgPing: %w", err)
|
||||
}
|
||||
return oldValue.AvgPing, nil
|
||||
}
|
||||
|
||||
// AddAvgPing adds f to the "avg_ping" field.
|
||||
func (m *MatchPlayerMutation) AddAvgPing(f float64) {
|
||||
if m.addavg_ping != nil {
|
||||
*m.addavg_ping += f
|
||||
} else {
|
||||
m.addavg_ping = &f
|
||||
}
|
||||
}
|
||||
|
||||
// AddedAvgPing returns the value that was added to the "avg_ping" field in this mutation.
|
||||
func (m *MatchPlayerMutation) AddedAvgPing() (r float64, exists bool) {
|
||||
v := m.addavg_ping
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearAvgPing clears the value of the "avg_ping" field.
|
||||
func (m *MatchPlayerMutation) ClearAvgPing() {
|
||||
m.avg_ping = nil
|
||||
m.addavg_ping = nil
|
||||
m.clearedFields[matchplayer.FieldAvgPing] = struct{}{}
|
||||
}
|
||||
|
||||
// AvgPingCleared returns if the "avg_ping" field was cleared in this mutation.
|
||||
func (m *MatchPlayerMutation) AvgPingCleared() bool {
|
||||
_, ok := m.clearedFields[matchplayer.FieldAvgPing]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetAvgPing resets all changes to the "avg_ping" field.
|
||||
func (m *MatchPlayerMutation) ResetAvgPing() {
|
||||
m.avg_ping = nil
|
||||
m.addavg_ping = nil
|
||||
delete(m.clearedFields, matchplayer.FieldAvgPing)
|
||||
}
|
||||
|
||||
// SetMatchesID sets the "matches" edge to the Match entity by id.
|
||||
func (m *MatchPlayerMutation) SetMatchesID(id uint64) {
|
||||
m.matches = &id
|
||||
@@ -3657,6 +3852,7 @@ func (m *MatchPlayerMutation) SetMatchesID(id uint64) {
|
||||
// ClearMatches clears the "matches" edge to the Match entity.
|
||||
func (m *MatchPlayerMutation) ClearMatches() {
|
||||
m.clearedmatches = true
|
||||
m.clearedFields[matchplayer.FieldMatchStats] = struct{}{}
|
||||
}
|
||||
|
||||
// MatchesCleared reports if the "matches" edge to the Match entity was cleared.
|
||||
@@ -3696,6 +3892,7 @@ func (m *MatchPlayerMutation) SetPlayersID(id uint64) {
|
||||
// ClearPlayers clears the "players" edge to the Player entity.
|
||||
func (m *MatchPlayerMutation) ClearPlayers() {
|
||||
m.clearedplayers = true
|
||||
m.clearedFields[matchplayer.FieldPlayerStats] = struct{}{}
|
||||
}
|
||||
|
||||
// PlayersCleared reports if the "players" edge to the Player entity was cleared.
|
||||
@@ -3948,11 +4145,26 @@ func (m *MatchPlayerMutation) Where(ps ...predicate.MatchPlayer) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the MatchPlayerMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *MatchPlayerMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.MatchPlayer, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *MatchPlayerMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *MatchPlayerMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (MatchPlayer).
|
||||
func (m *MatchPlayerMutation) Type() string {
|
||||
return m.typ
|
||||
@@ -3962,7 +4174,7 @@ func (m *MatchPlayerMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *MatchPlayerMutation) Fields() []string {
|
||||
fields := make([]string, 0, 32)
|
||||
fields := make([]string, 0, 33)
|
||||
if m.team_id != nil {
|
||||
fields = append(fields, matchplayer.FieldTeamID)
|
||||
}
|
||||
@@ -4059,6 +4271,9 @@ func (m *MatchPlayerMutation) Fields() []string {
|
||||
if m.flash_assists != nil {
|
||||
fields = append(fields, matchplayer.FieldFlashAssists)
|
||||
}
|
||||
if m.avg_ping != nil {
|
||||
fields = append(fields, matchplayer.FieldAvgPing)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -4131,6 +4346,8 @@ func (m *MatchPlayerMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.PlayerStats()
|
||||
case matchplayer.FieldFlashAssists:
|
||||
return m.FlashAssists()
|
||||
case matchplayer.FieldAvgPing:
|
||||
return m.AvgPing()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -4204,6 +4421,8 @@ func (m *MatchPlayerMutation) OldField(ctx context.Context, name string) (ent.Va
|
||||
return m.OldPlayerStats(ctx)
|
||||
case matchplayer.FieldFlashAssists:
|
||||
return m.OldFlashAssists(ctx)
|
||||
case matchplayer.FieldAvgPing:
|
||||
return m.OldAvgPing(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown MatchPlayer field %s", name)
|
||||
}
|
||||
@@ -4437,6 +4656,13 @@ func (m *MatchPlayerMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetFlashAssists(v)
|
||||
return nil
|
||||
case matchplayer.FieldAvgPing:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetAvgPing(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown MatchPlayer field %s", name)
|
||||
}
|
||||
@@ -4529,6 +4755,9 @@ func (m *MatchPlayerMutation) AddedFields() []string {
|
||||
if m.addflash_assists != nil {
|
||||
fields = append(fields, matchplayer.FieldFlashAssists)
|
||||
}
|
||||
if m.addavg_ping != nil {
|
||||
fields = append(fields, matchplayer.FieldAvgPing)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -4593,6 +4822,8 @@ func (m *MatchPlayerMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return m.AddedFlashTotalEnemy()
|
||||
case matchplayer.FieldFlashAssists:
|
||||
return m.AddedFlashAssists()
|
||||
case matchplayer.FieldAvgPing:
|
||||
return m.AddedAvgPing()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -4798,6 +5029,13 @@ func (m *MatchPlayerMutation) AddField(name string, value ent.Value) error {
|
||||
}
|
||||
m.AddFlashAssists(v)
|
||||
return nil
|
||||
case matchplayer.FieldAvgPing:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddAvgPing(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown MatchPlayer numeric field %s", name)
|
||||
}
|
||||
@@ -4881,6 +5119,9 @@ func (m *MatchPlayerMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(matchplayer.FieldFlashAssists) {
|
||||
fields = append(fields, matchplayer.FieldFlashAssists)
|
||||
}
|
||||
if m.FieldCleared(matchplayer.FieldAvgPing) {
|
||||
fields = append(fields, matchplayer.FieldAvgPing)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -4970,6 +5211,9 @@ func (m *MatchPlayerMutation) ClearField(name string) error {
|
||||
case matchplayer.FieldFlashAssists:
|
||||
m.ClearFlashAssists()
|
||||
return nil
|
||||
case matchplayer.FieldAvgPing:
|
||||
m.ClearAvgPing()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown MatchPlayer nullable field %s", name)
|
||||
}
|
||||
@@ -5074,6 +5318,9 @@ func (m *MatchPlayerMutation) ResetField(name string) error {
|
||||
case matchplayer.FieldFlashAssists:
|
||||
m.ResetFlashAssists()
|
||||
return nil
|
||||
case matchplayer.FieldAvgPing:
|
||||
m.ResetAvgPing()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown MatchPlayer field %s", name)
|
||||
}
|
||||
@@ -5564,11 +5811,26 @@ func (m *MessagesMutation) Where(ps ...predicate.Messages) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the MessagesMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *MessagesMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Messages, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *MessagesMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *MessagesMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Messages).
|
||||
func (m *MessagesMutation) Type() string {
|
||||
return m.typ
|
||||
@@ -5754,8 +6016,6 @@ func (m *MessagesMutation) RemovedEdges() []string {
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *MessagesMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6932,11 +7192,26 @@ func (m *PlayerMutation) Where(ps ...predicate.Player) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the PlayerMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *PlayerMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Player, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *PlayerMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *PlayerMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Player).
|
||||
func (m *PlayerMutation) Type() string {
|
||||
return m.typ
|
||||
@@ -7952,11 +8227,26 @@ func (m *RoundStatsMutation) Where(ps ...predicate.RoundStats) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the RoundStatsMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *RoundStatsMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.RoundStats, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *RoundStatsMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *RoundStatsMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (RoundStats).
|
||||
func (m *RoundStatsMutation) Type() string {
|
||||
return m.typ
|
||||
@@ -8195,8 +8485,6 @@ func (m *RoundStatsMutation) RemovedEdges() []string {
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *RoundStatsMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -8492,11 +8780,26 @@ func (m *SprayMutation) Where(ps ...predicate.Spray) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the SprayMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *SprayMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Spray, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *SprayMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *SprayMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Spray).
|
||||
func (m *SprayMutation) Type() string {
|
||||
return m.typ
|
||||
@@ -8665,8 +8968,6 @@ func (m *SprayMutation) RemovedEdges() []string {
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *SprayMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -9099,11 +9400,26 @@ func (m *WeaponMutation) Where(ps ...predicate.Weapon) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
}
|
||||
|
||||
// WhereP appends storage-level predicates to the WeaponMutation builder. Using this method,
|
||||
// users can use type-assertion to append predicates that do not depend on any generated package.
|
||||
func (m *WeaponMutation) WhereP(ps ...func(*sql.Selector)) {
|
||||
p := make([]predicate.Weapon, len(ps))
|
||||
for i := range ps {
|
||||
p[i] = ps[i]
|
||||
}
|
||||
m.Where(p...)
|
||||
}
|
||||
|
||||
// Op returns the operation name.
|
||||
func (m *WeaponMutation) Op() Op {
|
||||
return m.op
|
||||
}
|
||||
|
||||
// SetOp allows setting the mutation operation.
|
||||
func (m *WeaponMutation) SetOp(op Op) {
|
||||
m.op = op
|
||||
}
|
||||
|
||||
// Type returns the node type of this mutation (Weapon).
|
||||
func (m *WeaponMutation) Type() string {
|
||||
return m.typ
|
||||
@@ -9342,8 +9658,6 @@ func (m *WeaponMutation) RemovedEdges() []string {
|
||||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *WeaponMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
165
ent/player.go
165
ent/player.go
@@ -1,14 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/player"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
)
|
||||
|
||||
// Player is the model entity for the Player schema.
|
||||
@@ -50,7 +51,8 @@ type Player struct {
|
||||
Ties int `json:"ties,omitempty"`
|
||||
// Edges holds the relations/edges for other nodes in the graph.
|
||||
// The values are being populated by the PlayerQuery when eager-loading is set.
|
||||
Edges PlayerEdges `json:"edges"`
|
||||
Edges PlayerEdges `json:"edges"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// PlayerEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -83,8 +85,8 @@ func (e PlayerEdges) MatchesOrErr() ([]*Match, error) {
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Player) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Player) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case player.FieldID, player.FieldVacCount, player.FieldGameBanCount, player.FieldWins, player.FieldLooses, player.FieldTies:
|
||||
@@ -94,7 +96,7 @@ func (*Player) scanValues(columns []string) ([]interface{}, error) {
|
||||
case player.FieldVacDate, player.FieldGameBanDate, player.FieldSteamUpdated, player.FieldSharecodeUpdated, player.FieldProfileCreated:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Player", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -102,7 +104,7 @@ func (*Player) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Player fields.
|
||||
func (pl *Player) assignValues(columns []string, values []interface{}) error {
|
||||
func (_m *Player) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@@ -113,181 +115,198 @@ func (pl *Player) assignValues(columns []string, values []interface{}) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
pl.ID = uint64(value.Int64)
|
||||
_m.ID = uint64(value.Int64)
|
||||
case player.FieldName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field name", values[i])
|
||||
} else if value.Valid {
|
||||
pl.Name = value.String
|
||||
_m.Name = value.String
|
||||
}
|
||||
case player.FieldAvatar:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field avatar", values[i])
|
||||
} else if value.Valid {
|
||||
pl.Avatar = value.String
|
||||
_m.Avatar = value.String
|
||||
}
|
||||
case player.FieldVanityURL:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field vanity_url", values[i])
|
||||
} else if value.Valid {
|
||||
pl.VanityURL = value.String
|
||||
_m.VanityURL = value.String
|
||||
}
|
||||
case player.FieldVanityURLReal:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field vanity_url_real", values[i])
|
||||
} else if value.Valid {
|
||||
pl.VanityURLReal = value.String
|
||||
_m.VanityURLReal = value.String
|
||||
}
|
||||
case player.FieldVacDate:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field vac_date", values[i])
|
||||
} else if value.Valid {
|
||||
pl.VacDate = value.Time
|
||||
_m.VacDate = value.Time
|
||||
}
|
||||
case player.FieldVacCount:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field vac_count", values[i])
|
||||
} else if value.Valid {
|
||||
pl.VacCount = int(value.Int64)
|
||||
_m.VacCount = int(value.Int64)
|
||||
}
|
||||
case player.FieldGameBanDate:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field game_ban_date", values[i])
|
||||
} else if value.Valid {
|
||||
pl.GameBanDate = value.Time
|
||||
_m.GameBanDate = value.Time
|
||||
}
|
||||
case player.FieldGameBanCount:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field game_ban_count", values[i])
|
||||
} else if value.Valid {
|
||||
pl.GameBanCount = int(value.Int64)
|
||||
_m.GameBanCount = int(value.Int64)
|
||||
}
|
||||
case player.FieldSteamUpdated:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field steam_updated", values[i])
|
||||
} else if value.Valid {
|
||||
pl.SteamUpdated = value.Time
|
||||
_m.SteamUpdated = value.Time
|
||||
}
|
||||
case player.FieldSharecodeUpdated:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sharecode_updated", values[i])
|
||||
} else if value.Valid {
|
||||
pl.SharecodeUpdated = value.Time
|
||||
_m.SharecodeUpdated = value.Time
|
||||
}
|
||||
case player.FieldAuthCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field auth_code", values[i])
|
||||
} else if value.Valid {
|
||||
pl.AuthCode = value.String
|
||||
_m.AuthCode = value.String
|
||||
}
|
||||
case player.FieldProfileCreated:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field profile_created", values[i])
|
||||
} else if value.Valid {
|
||||
pl.ProfileCreated = value.Time
|
||||
_m.ProfileCreated = value.Time
|
||||
}
|
||||
case player.FieldOldestSharecodeSeen:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field oldest_sharecode_seen", values[i])
|
||||
} else if value.Valid {
|
||||
pl.OldestSharecodeSeen = value.String
|
||||
_m.OldestSharecodeSeen = value.String
|
||||
}
|
||||
case player.FieldWins:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field wins", values[i])
|
||||
} else if value.Valid {
|
||||
pl.Wins = int(value.Int64)
|
||||
_m.Wins = int(value.Int64)
|
||||
}
|
||||
case player.FieldLooses:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field looses", values[i])
|
||||
} else if value.Valid {
|
||||
pl.Looses = int(value.Int64)
|
||||
_m.Looses = int(value.Int64)
|
||||
}
|
||||
case player.FieldTies:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field ties", values[i])
|
||||
} else if value.Valid {
|
||||
pl.Ties = int(value.Int64)
|
||||
_m.Ties = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Player.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *Player) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryStats queries the "stats" edge of the Player entity.
|
||||
func (pl *Player) QueryStats() *MatchPlayerQuery {
|
||||
return (&PlayerClient{config: pl.config}).QueryStats(pl)
|
||||
func (_m *Player) QueryStats() *MatchPlayerQuery {
|
||||
return NewPlayerClient(_m.config).QueryStats(_m)
|
||||
}
|
||||
|
||||
// QueryMatches queries the "matches" edge of the Player entity.
|
||||
func (pl *Player) QueryMatches() *MatchQuery {
|
||||
return (&PlayerClient{config: pl.config}).QueryMatches(pl)
|
||||
func (_m *Player) QueryMatches() *MatchQuery {
|
||||
return NewPlayerClient(_m.config).QueryMatches(_m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Player.
|
||||
// Note that you need to call Player.Unwrap() before calling this method if this Player
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (pl *Player) Update() *PlayerUpdateOne {
|
||||
return (&PlayerClient{config: pl.config}).UpdateOne(pl)
|
||||
func (_m *Player) Update() *PlayerUpdateOne {
|
||||
return NewPlayerClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// 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)
|
||||
func (_m *Player) Unwrap() *Player {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Player is not a transactional entity")
|
||||
}
|
||||
pl.config.driver = tx.drv
|
||||
return pl
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (pl *Player) String() string {
|
||||
func (_m *Player) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("Player(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v", pl.ID))
|
||||
builder.WriteString(", name=")
|
||||
builder.WriteString(pl.Name)
|
||||
builder.WriteString(", avatar=")
|
||||
builder.WriteString(pl.Avatar)
|
||||
builder.WriteString(", vanity_url=")
|
||||
builder.WriteString(pl.VanityURL)
|
||||
builder.WriteString(", vanity_url_real=")
|
||||
builder.WriteString(pl.VanityURLReal)
|
||||
builder.WriteString(", vac_date=")
|
||||
builder.WriteString(pl.VacDate.Format(time.ANSIC))
|
||||
builder.WriteString(", vac_count=")
|
||||
builder.WriteString(fmt.Sprintf("%v", pl.VacCount))
|
||||
builder.WriteString(", game_ban_date=")
|
||||
builder.WriteString(pl.GameBanDate.Format(time.ANSIC))
|
||||
builder.WriteString(", game_ban_count=")
|
||||
builder.WriteString(fmt.Sprintf("%v", pl.GameBanCount))
|
||||
builder.WriteString(", steam_updated=")
|
||||
builder.WriteString(pl.SteamUpdated.Format(time.ANSIC))
|
||||
builder.WriteString(", sharecode_updated=")
|
||||
builder.WriteString(pl.SharecodeUpdated.Format(time.ANSIC))
|
||||
builder.WriteString(", auth_code=<sensitive>")
|
||||
builder.WriteString(", profile_created=")
|
||||
builder.WriteString(pl.ProfileCreated.Format(time.ANSIC))
|
||||
builder.WriteString(", oldest_sharecode_seen=")
|
||||
builder.WriteString(pl.OldestSharecodeSeen)
|
||||
builder.WriteString(", wins=")
|
||||
builder.WriteString(fmt.Sprintf("%v", pl.Wins))
|
||||
builder.WriteString(", looses=")
|
||||
builder.WriteString(fmt.Sprintf("%v", pl.Looses))
|
||||
builder.WriteString(", ties=")
|
||||
builder.WriteString(fmt.Sprintf("%v", pl.Ties))
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("name=")
|
||||
builder.WriteString(_m.Name)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("avatar=")
|
||||
builder.WriteString(_m.Avatar)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("vanity_url=")
|
||||
builder.WriteString(_m.VanityURL)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("vanity_url_real=")
|
||||
builder.WriteString(_m.VanityURLReal)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("vac_date=")
|
||||
builder.WriteString(_m.VacDate.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("vac_count=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.VacCount))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("game_ban_date=")
|
||||
builder.WriteString(_m.GameBanDate.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("game_ban_count=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.GameBanCount))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("steam_updated=")
|
||||
builder.WriteString(_m.SteamUpdated.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sharecode_updated=")
|
||||
builder.WriteString(_m.SharecodeUpdated.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("auth_code=<sensitive>")
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("profile_created=")
|
||||
builder.WriteString(_m.ProfileCreated.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("oldest_sharecode_seen=")
|
||||
builder.WriteString(_m.OldestSharecodeSeen)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("wins=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Wins))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("looses=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Looses))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("ties=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Ties))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Players is a parsable slice of Player.
|
||||
type Players []*Player
|
||||
|
||||
func (pl Players) config(cfg config) {
|
||||
for _i := range pl {
|
||||
pl[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package player
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -104,3 +107,133 @@ var (
|
||||
// DefaultSteamUpdated holds the default value on creation for the "steam_updated" field.
|
||||
DefaultSteamUpdated func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Player queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByName orders the results by the name field.
|
||||
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAvatar orders the results by the avatar field.
|
||||
func ByAvatar(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAvatar, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVanityURL orders the results by the vanity_url field.
|
||||
func ByVanityURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVanityURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVanityURLReal orders the results by the vanity_url_real field.
|
||||
func ByVanityURLReal(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVanityURLReal, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVacDate orders the results by the vac_date field.
|
||||
func ByVacDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVacDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVacCount orders the results by the vac_count field.
|
||||
func ByVacCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVacCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameBanDate orders the results by the game_ban_date field.
|
||||
func ByGameBanDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameBanDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGameBanCount orders the results by the game_ban_count field.
|
||||
func ByGameBanCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGameBanCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySteamUpdated orders the results by the steam_updated field.
|
||||
func BySteamUpdated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSteamUpdated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySharecodeUpdated orders the results by the sharecode_updated field.
|
||||
func BySharecodeUpdated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSharecodeUpdated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAuthCode orders the results by the auth_code field.
|
||||
func ByAuthCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAuthCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByProfileCreated orders the results by the profile_created field.
|
||||
func ByProfileCreated(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldProfileCreated, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByOldestSharecodeSeen orders the results by the oldest_sharecode_seen field.
|
||||
func ByOldestSharecodeSeen(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldOldestSharecodeSeen, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByWins orders the results by the wins field.
|
||||
func ByWins(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldWins, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLooses orders the results by the looses field.
|
||||
func ByLooses(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLooses, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTies orders the results by the ties field.
|
||||
func ByTies(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTies, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatsCount orders the results by stats count.
|
||||
func ByStatsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newStatsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByStats orders the results by stats terms.
|
||||
func ByStats(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newStatsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMatchesCount orders the results by matches count.
|
||||
func ByMatchesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newMatchesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMatches orders the results by matches terms.
|
||||
func ByMatches(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newStatsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, StatsTable, StatsColumn),
|
||||
)
|
||||
}
|
||||
func newMatchesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, MatchesTable, MatchesPrimaryKey...),
|
||||
)
|
||||
}
|
||||
|
||||
1233
ent/player/where.go
1233
ent/player/where.go
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,18 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/player"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
)
|
||||
|
||||
// PlayerCreate is the builder for creating a Player entity.
|
||||
@@ -23,315 +23,279 @@ type PlayerCreate struct {
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (pc *PlayerCreate) SetName(s string) *PlayerCreate {
|
||||
pc.mutation.SetName(s)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetName(v string) *PlayerCreate {
|
||||
_c.mutation.SetName(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableName(s *string) *PlayerCreate {
|
||||
if s != nil {
|
||||
pc.SetName(*s)
|
||||
func (_c *PlayerCreate) SetNillableName(v *string) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetName(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAvatar sets the "avatar" field.
|
||||
func (pc *PlayerCreate) SetAvatar(s string) *PlayerCreate {
|
||||
pc.mutation.SetAvatar(s)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetAvatar(v string) *PlayerCreate {
|
||||
_c.mutation.SetAvatar(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableAvatar sets the "avatar" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableAvatar(s *string) *PlayerCreate {
|
||||
if s != nil {
|
||||
pc.SetAvatar(*s)
|
||||
func (_c *PlayerCreate) SetNillableAvatar(v *string) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetAvatar(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetVanityURL sets the "vanity_url" field.
|
||||
func (pc *PlayerCreate) SetVanityURL(s string) *PlayerCreate {
|
||||
pc.mutation.SetVanityURL(s)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetVanityURL(v string) *PlayerCreate {
|
||||
_c.mutation.SetVanityURL(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableVanityURL sets the "vanity_url" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableVanityURL(s *string) *PlayerCreate {
|
||||
if s != nil {
|
||||
pc.SetVanityURL(*s)
|
||||
func (_c *PlayerCreate) SetNillableVanityURL(v *string) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetVanityURL(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetVanityURLReal sets the "vanity_url_real" field.
|
||||
func (pc *PlayerCreate) SetVanityURLReal(s string) *PlayerCreate {
|
||||
pc.mutation.SetVanityURLReal(s)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetVanityURLReal(v string) *PlayerCreate {
|
||||
_c.mutation.SetVanityURLReal(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableVanityURLReal sets the "vanity_url_real" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableVanityURLReal(s *string) *PlayerCreate {
|
||||
if s != nil {
|
||||
pc.SetVanityURLReal(*s)
|
||||
func (_c *PlayerCreate) SetNillableVanityURLReal(v *string) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetVanityURLReal(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetVacDate sets the "vac_date" field.
|
||||
func (pc *PlayerCreate) SetVacDate(t time.Time) *PlayerCreate {
|
||||
pc.mutation.SetVacDate(t)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetVacDate(v time.Time) *PlayerCreate {
|
||||
_c.mutation.SetVacDate(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableVacDate sets the "vac_date" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableVacDate(t *time.Time) *PlayerCreate {
|
||||
if t != nil {
|
||||
pc.SetVacDate(*t)
|
||||
func (_c *PlayerCreate) SetNillableVacDate(v *time.Time) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetVacDate(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetVacCount sets the "vac_count" field.
|
||||
func (pc *PlayerCreate) SetVacCount(i int) *PlayerCreate {
|
||||
pc.mutation.SetVacCount(i)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetVacCount(v int) *PlayerCreate {
|
||||
_c.mutation.SetVacCount(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableVacCount sets the "vac_count" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableVacCount(i *int) *PlayerCreate {
|
||||
if i != nil {
|
||||
pc.SetVacCount(*i)
|
||||
func (_c *PlayerCreate) SetNillableVacCount(v *int) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetVacCount(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetGameBanDate sets the "game_ban_date" field.
|
||||
func (pc *PlayerCreate) SetGameBanDate(t time.Time) *PlayerCreate {
|
||||
pc.mutation.SetGameBanDate(t)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetGameBanDate(v time.Time) *PlayerCreate {
|
||||
_c.mutation.SetGameBanDate(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableGameBanDate sets the "game_ban_date" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableGameBanDate(t *time.Time) *PlayerCreate {
|
||||
if t != nil {
|
||||
pc.SetGameBanDate(*t)
|
||||
func (_c *PlayerCreate) SetNillableGameBanDate(v *time.Time) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetGameBanDate(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetGameBanCount sets the "game_ban_count" field.
|
||||
func (pc *PlayerCreate) SetGameBanCount(i int) *PlayerCreate {
|
||||
pc.mutation.SetGameBanCount(i)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetGameBanCount(v int) *PlayerCreate {
|
||||
_c.mutation.SetGameBanCount(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableGameBanCount sets the "game_ban_count" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableGameBanCount(i *int) *PlayerCreate {
|
||||
if i != nil {
|
||||
pc.SetGameBanCount(*i)
|
||||
func (_c *PlayerCreate) SetNillableGameBanCount(v *int) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetGameBanCount(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSteamUpdated sets the "steam_updated" field.
|
||||
func (pc *PlayerCreate) SetSteamUpdated(t time.Time) *PlayerCreate {
|
||||
pc.mutation.SetSteamUpdated(t)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetSteamUpdated(v time.Time) *PlayerCreate {
|
||||
_c.mutation.SetSteamUpdated(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableSteamUpdated sets the "steam_updated" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableSteamUpdated(t *time.Time) *PlayerCreate {
|
||||
if t != nil {
|
||||
pc.SetSteamUpdated(*t)
|
||||
func (_c *PlayerCreate) SetNillableSteamUpdated(v *time.Time) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetSteamUpdated(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSharecodeUpdated sets the "sharecode_updated" field.
|
||||
func (pc *PlayerCreate) SetSharecodeUpdated(t time.Time) *PlayerCreate {
|
||||
pc.mutation.SetSharecodeUpdated(t)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetSharecodeUpdated(v time.Time) *PlayerCreate {
|
||||
_c.mutation.SetSharecodeUpdated(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableSharecodeUpdated sets the "sharecode_updated" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableSharecodeUpdated(t *time.Time) *PlayerCreate {
|
||||
if t != nil {
|
||||
pc.SetSharecodeUpdated(*t)
|
||||
func (_c *PlayerCreate) SetNillableSharecodeUpdated(v *time.Time) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetSharecodeUpdated(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAuthCode sets the "auth_code" field.
|
||||
func (pc *PlayerCreate) SetAuthCode(s string) *PlayerCreate {
|
||||
pc.mutation.SetAuthCode(s)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetAuthCode(v string) *PlayerCreate {
|
||||
_c.mutation.SetAuthCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableAuthCode sets the "auth_code" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableAuthCode(s *string) *PlayerCreate {
|
||||
if s != nil {
|
||||
pc.SetAuthCode(*s)
|
||||
func (_c *PlayerCreate) SetNillableAuthCode(v *string) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetAuthCode(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetProfileCreated sets the "profile_created" field.
|
||||
func (pc *PlayerCreate) SetProfileCreated(t time.Time) *PlayerCreate {
|
||||
pc.mutation.SetProfileCreated(t)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetProfileCreated(v time.Time) *PlayerCreate {
|
||||
_c.mutation.SetProfileCreated(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableProfileCreated sets the "profile_created" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableProfileCreated(t *time.Time) *PlayerCreate {
|
||||
if t != nil {
|
||||
pc.SetProfileCreated(*t)
|
||||
func (_c *PlayerCreate) SetNillableProfileCreated(v *time.Time) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetProfileCreated(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetOldestSharecodeSeen sets the "oldest_sharecode_seen" field.
|
||||
func (pc *PlayerCreate) SetOldestSharecodeSeen(s string) *PlayerCreate {
|
||||
pc.mutation.SetOldestSharecodeSeen(s)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetOldestSharecodeSeen(v string) *PlayerCreate {
|
||||
_c.mutation.SetOldestSharecodeSeen(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableOldestSharecodeSeen sets the "oldest_sharecode_seen" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableOldestSharecodeSeen(s *string) *PlayerCreate {
|
||||
if s != nil {
|
||||
pc.SetOldestSharecodeSeen(*s)
|
||||
func (_c *PlayerCreate) SetNillableOldestSharecodeSeen(v *string) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetOldestSharecodeSeen(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetWins sets the "wins" field.
|
||||
func (pc *PlayerCreate) SetWins(i int) *PlayerCreate {
|
||||
pc.mutation.SetWins(i)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetWins(v int) *PlayerCreate {
|
||||
_c.mutation.SetWins(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableWins sets the "wins" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableWins(i *int) *PlayerCreate {
|
||||
if i != nil {
|
||||
pc.SetWins(*i)
|
||||
func (_c *PlayerCreate) SetNillableWins(v *int) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetWins(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetLooses sets the "looses" field.
|
||||
func (pc *PlayerCreate) SetLooses(i int) *PlayerCreate {
|
||||
pc.mutation.SetLooses(i)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetLooses(v int) *PlayerCreate {
|
||||
_c.mutation.SetLooses(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableLooses sets the "looses" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableLooses(i *int) *PlayerCreate {
|
||||
if i != nil {
|
||||
pc.SetLooses(*i)
|
||||
func (_c *PlayerCreate) SetNillableLooses(v *int) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetLooses(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetTies sets the "ties" field.
|
||||
func (pc *PlayerCreate) SetTies(i int) *PlayerCreate {
|
||||
pc.mutation.SetTies(i)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetTies(v int) *PlayerCreate {
|
||||
_c.mutation.SetTies(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableTies sets the "ties" field if the given value is not nil.
|
||||
func (pc *PlayerCreate) SetNillableTies(i *int) *PlayerCreate {
|
||||
if i != nil {
|
||||
pc.SetTies(*i)
|
||||
func (_c *PlayerCreate) SetNillableTies(v *int) *PlayerCreate {
|
||||
if v != nil {
|
||||
_c.SetTies(*v)
|
||||
}
|
||||
return pc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (pc *PlayerCreate) SetID(u uint64) *PlayerCreate {
|
||||
pc.mutation.SetID(u)
|
||||
return pc
|
||||
func (_c *PlayerCreate) SetID(v uint64) *PlayerCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// AddStatIDs adds the "stats" edge to the MatchPlayer entity by IDs.
|
||||
func (pc *PlayerCreate) AddStatIDs(ids ...int) *PlayerCreate {
|
||||
pc.mutation.AddStatIDs(ids...)
|
||||
return pc
|
||||
func (_c *PlayerCreate) AddStatIDs(ids ...int) *PlayerCreate {
|
||||
_c.mutation.AddStatIDs(ids...)
|
||||
return _c
|
||||
}
|
||||
|
||||
// AddStats adds the "stats" edges to the MatchPlayer entity.
|
||||
func (pc *PlayerCreate) AddStats(m ...*MatchPlayer) *PlayerCreate {
|
||||
ids := make([]int, len(m))
|
||||
for i := range m {
|
||||
ids[i] = m[i].ID
|
||||
func (_c *PlayerCreate) AddStats(v ...*MatchPlayer) *PlayerCreate {
|
||||
ids := make([]int, len(v))
|
||||
for i := range v {
|
||||
ids[i] = v[i].ID
|
||||
}
|
||||
return pc.AddStatIDs(ids...)
|
||||
return _c.AddStatIDs(ids...)
|
||||
}
|
||||
|
||||
// AddMatchIDs adds the "matches" edge to the Match entity by IDs.
|
||||
func (pc *PlayerCreate) AddMatchIDs(ids ...uint64) *PlayerCreate {
|
||||
pc.mutation.AddMatchIDs(ids...)
|
||||
return pc
|
||||
func (_c *PlayerCreate) AddMatchIDs(ids ...uint64) *PlayerCreate {
|
||||
_c.mutation.AddMatchIDs(ids...)
|
||||
return _c
|
||||
}
|
||||
|
||||
// AddMatches adds the "matches" edges to the Match entity.
|
||||
func (pc *PlayerCreate) AddMatches(m ...*Match) *PlayerCreate {
|
||||
ids := make([]uint64, len(m))
|
||||
for i := range m {
|
||||
ids[i] = m[i].ID
|
||||
func (_c *PlayerCreate) AddMatches(v ...*Match) *PlayerCreate {
|
||||
ids := make([]uint64, len(v))
|
||||
for i := range v {
|
||||
ids[i] = v[i].ID
|
||||
}
|
||||
return pc.AddMatchIDs(ids...)
|
||||
return _c.AddMatchIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the PlayerMutation object of the builder.
|
||||
func (pc *PlayerCreate) Mutation() *PlayerMutation {
|
||||
return pc.mutation
|
||||
func (_c *PlayerCreate) Mutation() *PlayerMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the Player in the database.
|
||||
func (pc *PlayerCreate) Save(ctx context.Context) (*Player, error) {
|
||||
var (
|
||||
err error
|
||||
node *Player
|
||||
)
|
||||
pc.defaults()
|
||||
if len(pc.hooks) == 0 {
|
||||
if err = pc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = pc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*PlayerMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = pc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pc.mutation = mutation
|
||||
if node, err = pc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(pc.hooks) - 1; i >= 0; i-- {
|
||||
if pc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = pc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, pc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_c *PlayerCreate) Save(ctx context.Context) (*Player, error) {
|
||||
_c.defaults()
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (pc *PlayerCreate) SaveX(ctx context.Context) *Player {
|
||||
v, err := pc.Save(ctx)
|
||||
func (_c *PlayerCreate) SaveX(ctx context.Context) *Player {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -339,39 +303,42 @@ func (pc *PlayerCreate) SaveX(ctx context.Context) *Player {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (pc *PlayerCreate) Exec(ctx context.Context) error {
|
||||
_, err := pc.Save(ctx)
|
||||
func (_c *PlayerCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (pc *PlayerCreate) ExecX(ctx context.Context) {
|
||||
if err := pc.Exec(ctx); err != nil {
|
||||
func (_c *PlayerCreate) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (pc *PlayerCreate) defaults() {
|
||||
if _, ok := pc.mutation.SteamUpdated(); !ok {
|
||||
func (_c *PlayerCreate) defaults() {
|
||||
if _, ok := _c.mutation.SteamUpdated(); !ok {
|
||||
v := player.DefaultSteamUpdated()
|
||||
pc.mutation.SetSteamUpdated(v)
|
||||
_c.mutation.SetSteamUpdated(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (pc *PlayerCreate) check() error {
|
||||
if _, ok := pc.mutation.SteamUpdated(); !ok {
|
||||
func (_c *PlayerCreate) check() error {
|
||||
if _, ok := _c.mutation.SteamUpdated(); !ok {
|
||||
return &ValidationError{Name: "steam_updated", err: errors.New(`ent: missing required field "Player.steam_updated"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pc *PlayerCreate) sqlSave(ctx context.Context) (*Player, error) {
|
||||
_node, _spec := pc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil {
|
||||
func (_c *PlayerCreate) sqlSave(ctx context.Context) (*Player, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@@ -379,153 +346,85 @@ func (pc *PlayerCreate) sqlSave(ctx context.Context) (*Player, error) {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = uint64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (pc *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
func (_c *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Player{config: pc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: player.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
}
|
||||
_node = &Player{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(player.Table, sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64))
|
||||
)
|
||||
if id, ok := pc.mutation.ID(); ok {
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := pc.mutation.Name(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: player.FieldName,
|
||||
})
|
||||
if value, ok := _c.mutation.Name(); ok {
|
||||
_spec.SetField(player.FieldName, field.TypeString, value)
|
||||
_node.Name = value
|
||||
}
|
||||
if value, ok := pc.mutation.Avatar(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: player.FieldAvatar,
|
||||
})
|
||||
if value, ok := _c.mutation.Avatar(); ok {
|
||||
_spec.SetField(player.FieldAvatar, field.TypeString, value)
|
||||
_node.Avatar = value
|
||||
}
|
||||
if value, ok := pc.mutation.VanityURL(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: player.FieldVanityURL,
|
||||
})
|
||||
if value, ok := _c.mutation.VanityURL(); ok {
|
||||
_spec.SetField(player.FieldVanityURL, field.TypeString, value)
|
||||
_node.VanityURL = value
|
||||
}
|
||||
if value, ok := pc.mutation.VanityURLReal(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: player.FieldVanityURLReal,
|
||||
})
|
||||
if value, ok := _c.mutation.VanityURLReal(); ok {
|
||||
_spec.SetField(player.FieldVanityURLReal, field.TypeString, value)
|
||||
_node.VanityURLReal = value
|
||||
}
|
||||
if value, ok := pc.mutation.VacDate(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: player.FieldVacDate,
|
||||
})
|
||||
if value, ok := _c.mutation.VacDate(); ok {
|
||||
_spec.SetField(player.FieldVacDate, field.TypeTime, value)
|
||||
_node.VacDate = value
|
||||
}
|
||||
if value, ok := pc.mutation.VacCount(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: player.FieldVacCount,
|
||||
})
|
||||
if value, ok := _c.mutation.VacCount(); ok {
|
||||
_spec.SetField(player.FieldVacCount, field.TypeInt, value)
|
||||
_node.VacCount = value
|
||||
}
|
||||
if value, ok := pc.mutation.GameBanDate(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: player.FieldGameBanDate,
|
||||
})
|
||||
if value, ok := _c.mutation.GameBanDate(); ok {
|
||||
_spec.SetField(player.FieldGameBanDate, field.TypeTime, value)
|
||||
_node.GameBanDate = value
|
||||
}
|
||||
if value, ok := pc.mutation.GameBanCount(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: player.FieldGameBanCount,
|
||||
})
|
||||
if value, ok := _c.mutation.GameBanCount(); ok {
|
||||
_spec.SetField(player.FieldGameBanCount, field.TypeInt, value)
|
||||
_node.GameBanCount = value
|
||||
}
|
||||
if value, ok := pc.mutation.SteamUpdated(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: player.FieldSteamUpdated,
|
||||
})
|
||||
if value, ok := _c.mutation.SteamUpdated(); ok {
|
||||
_spec.SetField(player.FieldSteamUpdated, field.TypeTime, value)
|
||||
_node.SteamUpdated = value
|
||||
}
|
||||
if value, ok := pc.mutation.SharecodeUpdated(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: player.FieldSharecodeUpdated,
|
||||
})
|
||||
if value, ok := _c.mutation.SharecodeUpdated(); ok {
|
||||
_spec.SetField(player.FieldSharecodeUpdated, field.TypeTime, value)
|
||||
_node.SharecodeUpdated = value
|
||||
}
|
||||
if value, ok := pc.mutation.AuthCode(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: player.FieldAuthCode,
|
||||
})
|
||||
if value, ok := _c.mutation.AuthCode(); ok {
|
||||
_spec.SetField(player.FieldAuthCode, field.TypeString, value)
|
||||
_node.AuthCode = value
|
||||
}
|
||||
if value, ok := pc.mutation.ProfileCreated(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: player.FieldProfileCreated,
|
||||
})
|
||||
if value, ok := _c.mutation.ProfileCreated(); ok {
|
||||
_spec.SetField(player.FieldProfileCreated, field.TypeTime, value)
|
||||
_node.ProfileCreated = value
|
||||
}
|
||||
if value, ok := pc.mutation.OldestSharecodeSeen(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Value: value,
|
||||
Column: player.FieldOldestSharecodeSeen,
|
||||
})
|
||||
if value, ok := _c.mutation.OldestSharecodeSeen(); ok {
|
||||
_spec.SetField(player.FieldOldestSharecodeSeen, field.TypeString, value)
|
||||
_node.OldestSharecodeSeen = value
|
||||
}
|
||||
if value, ok := pc.mutation.Wins(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: player.FieldWins,
|
||||
})
|
||||
if value, ok := _c.mutation.Wins(); ok {
|
||||
_spec.SetField(player.FieldWins, field.TypeInt, value)
|
||||
_node.Wins = value
|
||||
}
|
||||
if value, ok := pc.mutation.Looses(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: player.FieldLooses,
|
||||
})
|
||||
if value, ok := _c.mutation.Looses(); ok {
|
||||
_spec.SetField(player.FieldLooses, field.TypeInt, value)
|
||||
_node.Looses = value
|
||||
}
|
||||
if value, ok := pc.mutation.Ties(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: player.FieldTies,
|
||||
})
|
||||
if value, ok := _c.mutation.Ties(); ok {
|
||||
_spec.SetField(player.FieldTies, field.TypeInt, value)
|
||||
_node.Ties = value
|
||||
}
|
||||
if nodes := pc.mutation.StatsIDs(); len(nodes) > 0 {
|
||||
if nodes := _c.mutation.StatsIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: false,
|
||||
@@ -533,10 +432,7 @@ func (pc *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{player.StatsColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -544,7 +440,7 @@ func (pc *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
}
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
if nodes := pc.mutation.MatchesIDs(); len(nodes) > 0 {
|
||||
if nodes := _c.mutation.MatchesIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2M,
|
||||
Inverse: false,
|
||||
@@ -552,10 +448,7 @@ func (pc *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
Columns: player.MatchesPrimaryKey,
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: match.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(match.FieldID, field.TypeUint64),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -569,17 +462,21 @@ func (pc *PlayerCreate) createSpec() (*Player, *sqlgraph.CreateSpec) {
|
||||
// PlayerCreateBulk is the builder for creating many Player entities in bulk.
|
||||
type PlayerCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*PlayerCreate
|
||||
}
|
||||
|
||||
// Save creates the Player entities in the database.
|
||||
func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) {
|
||||
specs := make([]*sqlgraph.CreateSpec, len(pcb.builders))
|
||||
nodes := make([]*Player, len(pcb.builders))
|
||||
mutators := make([]Mutator, len(pcb.builders))
|
||||
for i := range pcb.builders {
|
||||
func (_c *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*Player, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := pcb.builders[i]
|
||||
builder := _c.builders[i]
|
||||
builder.defaults()
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*PlayerMutation)
|
||||
@@ -590,16 +487,16 @@ func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, pcb.builders[i+1].mutation)
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, pcb.driver, spec); err != nil {
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -607,11 +504,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-- {
|
||||
@@ -621,7 +518,7 @@ func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) {
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, pcb.builders[0].mutation); err != nil {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -629,8 +526,8 @@ func (pcb *PlayerCreateBulk) Save(ctx context.Context) ([]*Player, error) {
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (pcb *PlayerCreateBulk) SaveX(ctx context.Context) []*Player {
|
||||
v, err := pcb.Save(ctx)
|
||||
func (_c *PlayerCreateBulk) SaveX(ctx context.Context) []*Player {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -638,14 +535,14 @@ func (pcb *PlayerCreateBulk) SaveX(ctx context.Context) []*Player {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (pcb *PlayerCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := pcb.Save(ctx)
|
||||
func (_c *PlayerCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (pcb *PlayerCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := pcb.Exec(ctx); err != nil {
|
||||
func (_c *PlayerCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/predicate"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// PlayerDelete is the builder for deleting a Player entity.
|
||||
@@ -21,80 +20,56 @@ type PlayerDelete struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the PlayerDelete builder.
|
||||
func (pd *PlayerDelete) Where(ps ...predicate.Player) *PlayerDelete {
|
||||
pd.mutation.Where(ps...)
|
||||
return pd
|
||||
func (_d *PlayerDelete) Where(ps ...predicate.Player) *PlayerDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (pd *PlayerDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(pd.hooks) == 0 {
|
||||
affected, err = pd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*PlayerMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
pd.mutation = mutation
|
||||
affected, err = pd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(pd.hooks) - 1; i >= 0; i-- {
|
||||
if pd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = pd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, pd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_d *PlayerDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (pd *PlayerDelete) ExecX(ctx context.Context) int {
|
||||
n, err := pd.Exec(ctx)
|
||||
func (_d *PlayerDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (pd *PlayerDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: player.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: player.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := pd.mutation.predicates; len(ps) > 0 {
|
||||
func (_d *PlayerDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(player.Table, sqlgraph.NewFieldSpec(player.FieldID, field.TypeUint64))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, pd.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// PlayerDeleteOne is the builder for deleting a single Player entity.
|
||||
type PlayerDeleteOne struct {
|
||||
pd *PlayerDelete
|
||||
_d *PlayerDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the PlayerDelete builder.
|
||||
func (_d *PlayerDeleteOne) Where(ps ...predicate.Player) *PlayerDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (pdo *PlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := pdo.pd.Exec(ctx)
|
||||
func (_d *PlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
@@ -106,6 +81,8 @@ func (pdo *PlayerDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (pdo *PlayerDeleteOne) ExecX(ctx context.Context) {
|
||||
pdo.pd.ExecX(ctx)
|
||||
func (_d *PlayerDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
1050
ent/player_query.go
1050
ent/player_query.go
File diff suppressed because it is too large
Load Diff
1706
ent/player_update.go
1706
ent/player_update.go
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package predicate
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
)
|
||||
|
||||
// RoundStats is the model entity for the RoundStats schema.
|
||||
@@ -28,6 +29,7 @@ type RoundStats struct {
|
||||
// The values are being populated by the RoundStatsQuery when eager-loading is set.
|
||||
Edges RoundStatsEdges `json:"edges"`
|
||||
match_player_round_stats *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// RoundStatsEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -42,20 +44,17 @@ type RoundStatsEdges struct {
|
||||
// MatchPlayerOrErr returns the MatchPlayer value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
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.
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
if e.MatchPlayer != nil {
|
||||
return e.MatchPlayer, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "match_player"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*RoundStats) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*RoundStats) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case roundstats.FieldID, roundstats.FieldRound, roundstats.FieldBank, roundstats.FieldEquipment, roundstats.FieldSpent:
|
||||
@@ -63,7 +62,7 @@ func (*RoundStats) scanValues(columns []string) ([]interface{}, error) {
|
||||
case roundstats.ForeignKeys[0]: // match_player_round_stats
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type RoundStats", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -71,7 +70,7 @@ func (*RoundStats) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the RoundStats fields.
|
||||
func (rs *RoundStats) assignValues(columns []string, values []interface{}) error {
|
||||
func (_m *RoundStats) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@@ -82,88 +81,93 @@ func (rs *RoundStats) assignValues(columns []string, values []interface{}) error
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
rs.ID = int(value.Int64)
|
||||
_m.ID = int(value.Int64)
|
||||
case roundstats.FieldRound:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field round", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Round = uint(value.Int64)
|
||||
_m.Round = uint(value.Int64)
|
||||
}
|
||||
case roundstats.FieldBank:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field bank", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Bank = uint(value.Int64)
|
||||
_m.Bank = uint(value.Int64)
|
||||
}
|
||||
case roundstats.FieldEquipment:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field equipment", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Equipment = uint(value.Int64)
|
||||
_m.Equipment = uint(value.Int64)
|
||||
}
|
||||
case roundstats.FieldSpent:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field spent", values[i])
|
||||
} else if value.Valid {
|
||||
rs.Spent = uint(value.Int64)
|
||||
_m.Spent = uint(value.Int64)
|
||||
}
|
||||
case roundstats.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field match_player_round_stats", value)
|
||||
} else if value.Valid {
|
||||
rs.match_player_round_stats = new(int)
|
||||
*rs.match_player_round_stats = int(value.Int64)
|
||||
_m.match_player_round_stats = new(int)
|
||||
*_m.match_player_round_stats = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the RoundStats.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *RoundStats) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatchPlayer queries the "match_player" edge of the RoundStats entity.
|
||||
func (rs *RoundStats) QueryMatchPlayer() *MatchPlayerQuery {
|
||||
return (&RoundStatsClient{config: rs.config}).QueryMatchPlayer(rs)
|
||||
func (_m *RoundStats) QueryMatchPlayer() *MatchPlayerQuery {
|
||||
return NewRoundStatsClient(_m.config).QueryMatchPlayer(_m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this RoundStats.
|
||||
// Note that you need to call RoundStats.Unwrap() before calling this method if this RoundStats
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (rs *RoundStats) Update() *RoundStatsUpdateOne {
|
||||
return (&RoundStatsClient{config: rs.config}).UpdateOne(rs)
|
||||
func (_m *RoundStats) Update() *RoundStatsUpdateOne {
|
||||
return NewRoundStatsClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// 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)
|
||||
func (_m *RoundStats) Unwrap() *RoundStats {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: RoundStats is not a transactional entity")
|
||||
}
|
||||
rs.config.driver = tx.drv
|
||||
return rs
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (rs *RoundStats) String() string {
|
||||
func (_m *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("%v", rs.Round))
|
||||
builder.WriteString(", bank=")
|
||||
builder.WriteString(fmt.Sprintf("%v", rs.Bank))
|
||||
builder.WriteString(", equipment=")
|
||||
builder.WriteString(fmt.Sprintf("%v", rs.Equipment))
|
||||
builder.WriteString(", spent=")
|
||||
builder.WriteString(fmt.Sprintf("%v", rs.Spent))
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("round=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Round))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("bank=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Bank))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("equipment=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Equipment))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("spent=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Spent))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// RoundStatsSlice is a parsable slice of RoundStats.
|
||||
type RoundStatsSlice []*RoundStats
|
||||
|
||||
func (rs RoundStatsSlice) config(cfg config) {
|
||||
for _i := range rs {
|
||||
rs[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package roundstats
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the roundstats type in the database.
|
||||
Label = "round_stats"
|
||||
@@ -57,3 +62,45 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the RoundStats queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRound orders the results by the round field.
|
||||
func ByRound(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRound, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBank orders the results by the bank field.
|
||||
func ByBank(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBank, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEquipment orders the results by the equipment field.
|
||||
func ByEquipment(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEquipment, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySpent orders the results by the spent field.
|
||||
func BySpent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSpent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchPlayerField orders the results by match_player field.
|
||||
func ByMatchPlayerField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchPlayerStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newMatchPlayerStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,427 +1,236 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package roundstats
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Round applies equality check predicate on the "round" field. It's identical to RoundEQ.
|
||||
func Round(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldRound), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldRound, v))
|
||||
}
|
||||
|
||||
// Bank applies equality check predicate on the "bank" field. It's identical to BankEQ.
|
||||
func Bank(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldBank), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldBank, v))
|
||||
}
|
||||
|
||||
// Equipment applies equality check predicate on the "equipment" field. It's identical to EquipmentEQ.
|
||||
func Equipment(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldEquipment), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldEquipment, v))
|
||||
}
|
||||
|
||||
// Spent applies equality check predicate on the "spent" field. It's identical to SpentEQ.
|
||||
func Spent(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldSpent), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldSpent, v))
|
||||
}
|
||||
|
||||
// RoundEQ applies the EQ predicate on the "round" field.
|
||||
func RoundEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldRound), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldRound, v))
|
||||
}
|
||||
|
||||
// RoundNEQ applies the NEQ predicate on the "round" field.
|
||||
func RoundNEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldRound), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNEQ(FieldRound, v))
|
||||
}
|
||||
|
||||
// RoundIn applies the In predicate on the "round" field.
|
||||
func RoundIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldIn(FieldRound, vs...))
|
||||
}
|
||||
|
||||
// RoundNotIn applies the NotIn predicate on the "round" field.
|
||||
func RoundNotIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNotIn(FieldRound, vs...))
|
||||
}
|
||||
|
||||
// RoundGT applies the GT predicate on the "round" field.
|
||||
func RoundGT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldRound), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGT(FieldRound, v))
|
||||
}
|
||||
|
||||
// RoundGTE applies the GTE predicate on the "round" field.
|
||||
func RoundGTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldRound), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGTE(FieldRound, v))
|
||||
}
|
||||
|
||||
// RoundLT applies the LT predicate on the "round" field.
|
||||
func RoundLT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldRound), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLT(FieldRound, v))
|
||||
}
|
||||
|
||||
// RoundLTE applies the LTE predicate on the "round" field.
|
||||
func RoundLTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldRound), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLTE(FieldRound, v))
|
||||
}
|
||||
|
||||
// BankEQ applies the EQ predicate on the "bank" field.
|
||||
func BankEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldBank), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldBank, v))
|
||||
}
|
||||
|
||||
// BankNEQ applies the NEQ predicate on the "bank" field.
|
||||
func BankNEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldBank), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNEQ(FieldBank, v))
|
||||
}
|
||||
|
||||
// BankIn applies the In predicate on the "bank" field.
|
||||
func BankIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldIn(FieldBank, vs...))
|
||||
}
|
||||
|
||||
// BankNotIn applies the NotIn predicate on the "bank" field.
|
||||
func BankNotIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNotIn(FieldBank, vs...))
|
||||
}
|
||||
|
||||
// BankGT applies the GT predicate on the "bank" field.
|
||||
func BankGT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldBank), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGT(FieldBank, v))
|
||||
}
|
||||
|
||||
// BankGTE applies the GTE predicate on the "bank" field.
|
||||
func BankGTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldBank), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGTE(FieldBank, v))
|
||||
}
|
||||
|
||||
// BankLT applies the LT predicate on the "bank" field.
|
||||
func BankLT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldBank), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLT(FieldBank, v))
|
||||
}
|
||||
|
||||
// BankLTE applies the LTE predicate on the "bank" field.
|
||||
func BankLTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldBank), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLTE(FieldBank, v))
|
||||
}
|
||||
|
||||
// EquipmentEQ applies the EQ predicate on the "equipment" field.
|
||||
func EquipmentEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldEquipment), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldEquipment, v))
|
||||
}
|
||||
|
||||
// EquipmentNEQ applies the NEQ predicate on the "equipment" field.
|
||||
func EquipmentNEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldEquipment), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNEQ(FieldEquipment, v))
|
||||
}
|
||||
|
||||
// EquipmentIn applies the In predicate on the "equipment" field.
|
||||
func EquipmentIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldIn(FieldEquipment, vs...))
|
||||
}
|
||||
|
||||
// EquipmentNotIn applies the NotIn predicate on the "equipment" field.
|
||||
func EquipmentNotIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNotIn(FieldEquipment, vs...))
|
||||
}
|
||||
|
||||
// EquipmentGT applies the GT predicate on the "equipment" field.
|
||||
func EquipmentGT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldEquipment), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGT(FieldEquipment, v))
|
||||
}
|
||||
|
||||
// EquipmentGTE applies the GTE predicate on the "equipment" field.
|
||||
func EquipmentGTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldEquipment), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGTE(FieldEquipment, v))
|
||||
}
|
||||
|
||||
// EquipmentLT applies the LT predicate on the "equipment" field.
|
||||
func EquipmentLT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldEquipment), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLT(FieldEquipment, v))
|
||||
}
|
||||
|
||||
// EquipmentLTE applies the LTE predicate on the "equipment" field.
|
||||
func EquipmentLTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldEquipment), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLTE(FieldEquipment, v))
|
||||
}
|
||||
|
||||
// SpentEQ applies the EQ predicate on the "spent" field.
|
||||
func SpentEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldSpent), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldEQ(FieldSpent, v))
|
||||
}
|
||||
|
||||
// SpentNEQ applies the NEQ predicate on the "spent" field.
|
||||
func SpentNEQ(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldSpent), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNEQ(FieldSpent, v))
|
||||
}
|
||||
|
||||
// SpentIn applies the In predicate on the "spent" field.
|
||||
func SpentIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldIn(FieldSpent, vs...))
|
||||
}
|
||||
|
||||
// SpentNotIn applies the NotIn predicate on the "spent" field.
|
||||
func SpentNotIn(vs ...uint) predicate.RoundStats {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldNotIn(FieldSpent, vs...))
|
||||
}
|
||||
|
||||
// SpentGT applies the GT predicate on the "spent" field.
|
||||
func SpentGT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldSpent), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGT(FieldSpent, v))
|
||||
}
|
||||
|
||||
// SpentGTE applies the GTE predicate on the "spent" field.
|
||||
func SpentGTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldSpent), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldGTE(FieldSpent, v))
|
||||
}
|
||||
|
||||
// SpentLT applies the LT predicate on the "spent" field.
|
||||
func SpentLT(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldSpent), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLT(FieldSpent, v))
|
||||
}
|
||||
|
||||
// SpentLTE applies the LTE predicate on the "spent" field.
|
||||
func SpentLTE(v uint) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldSpent), v))
|
||||
})
|
||||
return predicate.RoundStats(sql.FieldLTE(FieldSpent, v))
|
||||
}
|
||||
|
||||
// HasMatchPlayer applies the HasEdge predicate on the "match_player" edge.
|
||||
@@ -429,7 +238,6 @@ func HasMatchPlayer() predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@@ -439,11 +247,7 @@ func HasMatchPlayer() predicate.RoundStats {
|
||||
// HasMatchPlayerWith applies the HasEdge predicate on the "match_player" edge with a given conditions (other predicates).
|
||||
func HasMatchPlayerWith(preds ...predicate.MatchPlayer) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayerInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayerTable, MatchPlayerColumn),
|
||||
)
|
||||
step := newMatchPlayerStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -454,32 +258,15 @@ func HasMatchPlayerWith(preds ...predicate.MatchPlayer) predicate.RoundStats {
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.RoundStats) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.RoundStats(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.RoundStats) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.RoundStats(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.RoundStats) predicate.RoundStats {
|
||||
return predicate.RoundStats(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
return predicate.RoundStats(sql.NotPredicates(p))
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
)
|
||||
|
||||
// RoundStatsCreate is the builder for creating a RoundStats entity.
|
||||
@@ -21,97 +21,61 @@ type RoundStatsCreate struct {
|
||||
}
|
||||
|
||||
// SetRound sets the "round" field.
|
||||
func (rsc *RoundStatsCreate) SetRound(u uint) *RoundStatsCreate {
|
||||
rsc.mutation.SetRound(u)
|
||||
return rsc
|
||||
func (_c *RoundStatsCreate) SetRound(v uint) *RoundStatsCreate {
|
||||
_c.mutation.SetRound(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetBank sets the "bank" field.
|
||||
func (rsc *RoundStatsCreate) SetBank(u uint) *RoundStatsCreate {
|
||||
rsc.mutation.SetBank(u)
|
||||
return rsc
|
||||
func (_c *RoundStatsCreate) SetBank(v uint) *RoundStatsCreate {
|
||||
_c.mutation.SetBank(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetEquipment sets the "equipment" field.
|
||||
func (rsc *RoundStatsCreate) SetEquipment(u uint) *RoundStatsCreate {
|
||||
rsc.mutation.SetEquipment(u)
|
||||
return rsc
|
||||
func (_c *RoundStatsCreate) SetEquipment(v uint) *RoundStatsCreate {
|
||||
_c.mutation.SetEquipment(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSpent sets the "spent" field.
|
||||
func (rsc *RoundStatsCreate) SetSpent(u uint) *RoundStatsCreate {
|
||||
rsc.mutation.SetSpent(u)
|
||||
return rsc
|
||||
func (_c *RoundStatsCreate) SetSpent(v uint) *RoundStatsCreate {
|
||||
_c.mutation.SetSpent(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (rsc *RoundStatsCreate) SetMatchPlayerID(id int) *RoundStatsCreate {
|
||||
rsc.mutation.SetMatchPlayerID(id)
|
||||
return rsc
|
||||
func (_c *RoundStatsCreate) SetMatchPlayerID(id int) *RoundStatsCreate {
|
||||
_c.mutation.SetMatchPlayerID(id)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (rsc *RoundStatsCreate) SetNillableMatchPlayerID(id *int) *RoundStatsCreate {
|
||||
func (_c *RoundStatsCreate) SetNillableMatchPlayerID(id *int) *RoundStatsCreate {
|
||||
if id != nil {
|
||||
rsc = rsc.SetMatchPlayerID(*id)
|
||||
_c = _c.SetMatchPlayerID(*id)
|
||||
}
|
||||
return rsc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsc *RoundStatsCreate) SetMatchPlayer(m *MatchPlayer) *RoundStatsCreate {
|
||||
return rsc.SetMatchPlayerID(m.ID)
|
||||
func (_c *RoundStatsCreate) SetMatchPlayer(v *MatchPlayer) *RoundStatsCreate {
|
||||
return _c.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the RoundStatsMutation object of the builder.
|
||||
func (rsc *RoundStatsCreate) Mutation() *RoundStatsMutation {
|
||||
return rsc.mutation
|
||||
func (_c *RoundStatsCreate) Mutation() *RoundStatsMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the RoundStats in the database.
|
||||
func (rsc *RoundStatsCreate) Save(ctx context.Context) (*RoundStats, error) {
|
||||
var (
|
||||
err error
|
||||
node *RoundStats
|
||||
)
|
||||
if len(rsc.hooks) == 0 {
|
||||
if err = rsc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = rsc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*RoundStatsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = rsc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rsc.mutation = mutation
|
||||
if node, err = rsc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(rsc.hooks) - 1; i >= 0; i-- {
|
||||
if rsc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = rsc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, rsc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_c *RoundStatsCreate) Save(ctx context.Context) (*RoundStats, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (rsc *RoundStatsCreate) SaveX(ctx context.Context) *RoundStats {
|
||||
v, err := rsc.Save(ctx)
|
||||
func (_c *RoundStatsCreate) SaveX(ctx context.Context) *RoundStats {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -119,92 +83,75 @@ func (rsc *RoundStatsCreate) SaveX(ctx context.Context) *RoundStats {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (rsc *RoundStatsCreate) Exec(ctx context.Context) error {
|
||||
_, err := rsc.Save(ctx)
|
||||
func (_c *RoundStatsCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rsc *RoundStatsCreate) ExecX(ctx context.Context) {
|
||||
if err := rsc.Exec(ctx); err != nil {
|
||||
func (_c *RoundStatsCreate) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (rsc *RoundStatsCreate) check() error {
|
||||
if _, ok := rsc.mutation.Round(); !ok {
|
||||
func (_c *RoundStatsCreate) check() error {
|
||||
if _, ok := _c.mutation.Round(); !ok {
|
||||
return &ValidationError{Name: "round", err: errors.New(`ent: missing required field "RoundStats.round"`)}
|
||||
}
|
||||
if _, ok := rsc.mutation.Bank(); !ok {
|
||||
if _, ok := _c.mutation.Bank(); !ok {
|
||||
return &ValidationError{Name: "bank", err: errors.New(`ent: missing required field "RoundStats.bank"`)}
|
||||
}
|
||||
if _, ok := rsc.mutation.Equipment(); !ok {
|
||||
if _, ok := _c.mutation.Equipment(); !ok {
|
||||
return &ValidationError{Name: "equipment", err: errors.New(`ent: missing required field "RoundStats.equipment"`)}
|
||||
}
|
||||
if _, ok := rsc.mutation.Spent(); !ok {
|
||||
if _, ok := _c.mutation.Spent(); !ok {
|
||||
return &ValidationError{Name: "spent", err: errors.New(`ent: missing required field "RoundStats.spent"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rsc *RoundStatsCreate) sqlSave(ctx context.Context) (*RoundStats, error) {
|
||||
_node, _spec := rsc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, rsc.driver, _spec); err != nil {
|
||||
func (_c *RoundStatsCreate) sqlSave(ctx context.Context) (*RoundStats, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int(id)
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (rsc *RoundStatsCreate) createSpec() (*RoundStats, *sqlgraph.CreateSpec) {
|
||||
func (_c *RoundStatsCreate) createSpec() (*RoundStats, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &RoundStats{config: rsc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: roundstats.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
}
|
||||
_node = &RoundStats{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(roundstats.Table, sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt))
|
||||
)
|
||||
if value, ok := rsc.mutation.Round(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldRound,
|
||||
})
|
||||
if value, ok := _c.mutation.Round(); ok {
|
||||
_spec.SetField(roundstats.FieldRound, field.TypeUint, value)
|
||||
_node.Round = value
|
||||
}
|
||||
if value, ok := rsc.mutation.Bank(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldBank,
|
||||
})
|
||||
if value, ok := _c.mutation.Bank(); ok {
|
||||
_spec.SetField(roundstats.FieldBank, field.TypeUint, value)
|
||||
_node.Bank = value
|
||||
}
|
||||
if value, ok := rsc.mutation.Equipment(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldEquipment,
|
||||
})
|
||||
if value, ok := _c.mutation.Equipment(); ok {
|
||||
_spec.SetField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
_node.Equipment = value
|
||||
}
|
||||
if value, ok := rsc.mutation.Spent(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldSpent,
|
||||
})
|
||||
if value, ok := _c.mutation.Spent(); ok {
|
||||
_spec.SetField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
_node.Spent = value
|
||||
}
|
||||
if nodes := rsc.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _c.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -212,10 +159,7 @@ func (rsc *RoundStatsCreate) createSpec() (*RoundStats, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -230,17 +174,21 @@ func (rsc *RoundStatsCreate) createSpec() (*RoundStats, *sqlgraph.CreateSpec) {
|
||||
// RoundStatsCreateBulk is the builder for creating many RoundStats entities in bulk.
|
||||
type RoundStatsCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*RoundStatsCreate
|
||||
}
|
||||
|
||||
// Save creates the RoundStats entities in the database.
|
||||
func (rscb *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, error) {
|
||||
specs := make([]*sqlgraph.CreateSpec, len(rscb.builders))
|
||||
nodes := make([]*RoundStats, len(rscb.builders))
|
||||
mutators := make([]Mutator, len(rscb.builders))
|
||||
for i := range rscb.builders {
|
||||
func (_c *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*RoundStats, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := rscb.builders[i]
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*RoundStatsMutation)
|
||||
if !ok {
|
||||
@@ -250,16 +198,16 @@ func (rscb *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, erro
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, rscb.builders[i+1].mutation)
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, rscb.driver, spec); err != nil {
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,11 +215,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-- {
|
||||
@@ -281,7 +229,7 @@ func (rscb *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, erro
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, rscb.builders[0].mutation); err != nil {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -289,8 +237,8 @@ func (rscb *RoundStatsCreateBulk) Save(ctx context.Context) ([]*RoundStats, erro
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (rscb *RoundStatsCreateBulk) SaveX(ctx context.Context) []*RoundStats {
|
||||
v, err := rscb.Save(ctx)
|
||||
func (_c *RoundStatsCreateBulk) SaveX(ctx context.Context) []*RoundStats {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -298,14 +246,14 @@ func (rscb *RoundStatsCreateBulk) SaveX(ctx context.Context) []*RoundStats {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (rscb *RoundStatsCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := rscb.Save(ctx)
|
||||
func (_c *RoundStatsCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rscb *RoundStatsCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := rscb.Exec(ctx); err != nil {
|
||||
func (_c *RoundStatsCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
)
|
||||
|
||||
// RoundStatsDelete is the builder for deleting a RoundStats entity.
|
||||
@@ -21,80 +20,56 @@ type RoundStatsDelete struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the RoundStatsDelete builder.
|
||||
func (rsd *RoundStatsDelete) Where(ps ...predicate.RoundStats) *RoundStatsDelete {
|
||||
rsd.mutation.Where(ps...)
|
||||
return rsd
|
||||
func (_d *RoundStatsDelete) Where(ps ...predicate.RoundStats) *RoundStatsDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (rsd *RoundStatsDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(rsd.hooks) == 0 {
|
||||
affected, err = rsd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*RoundStatsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
rsd.mutation = mutation
|
||||
affected, err = rsd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(rsd.hooks) - 1; i >= 0; i-- {
|
||||
if rsd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = rsd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, rsd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_d *RoundStatsDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rsd *RoundStatsDelete) ExecX(ctx context.Context) int {
|
||||
n, err := rsd.Exec(ctx)
|
||||
func (_d *RoundStatsDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (rsd *RoundStatsDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: roundstats.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := rsd.mutation.predicates; len(ps) > 0 {
|
||||
func (_d *RoundStatsDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(roundstats.Table, sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, rsd.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// RoundStatsDeleteOne is the builder for deleting a single RoundStats entity.
|
||||
type RoundStatsDeleteOne struct {
|
||||
rsd *RoundStatsDelete
|
||||
_d *RoundStatsDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the RoundStatsDelete builder.
|
||||
func (_d *RoundStatsDeleteOne) Where(ps ...predicate.RoundStats) *RoundStatsDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (rsdo *RoundStatsDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := rsdo.rsd.Exec(ctx)
|
||||
func (_d *RoundStatsDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
@@ -106,6 +81,8 @@ func (rsdo *RoundStatsDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rsdo *RoundStatsDeleteOne) ExecX(ctx context.Context) {
|
||||
rsdo.rsd.ExecX(ctx)
|
||||
func (_d *RoundStatsDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,150 +1,156 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
)
|
||||
|
||||
// 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.
|
||||
func (rsu *RoundStatsUpdate) Where(ps ...predicate.RoundStats) *RoundStatsUpdate {
|
||||
rsu.mutation.Where(ps...)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) Where(ps ...predicate.RoundStats) *RoundStatsUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRound sets the "round" field.
|
||||
func (rsu *RoundStatsUpdate) SetRound(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetRound()
|
||||
rsu.mutation.SetRound(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetRound(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetRound()
|
||||
_u.mutation.SetRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds u to the "round" field.
|
||||
func (rsu *RoundStatsUpdate) AddRound(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddRound(u)
|
||||
return rsu
|
||||
// SetNillableRound sets the "round" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableRound(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetRound(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds value to the "round" field.
|
||||
func (_u *RoundStatsUpdate) AddRound(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBank sets the "bank" field.
|
||||
func (rsu *RoundStatsUpdate) SetBank(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetBank()
|
||||
rsu.mutation.SetBank(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetBank(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetBank()
|
||||
_u.mutation.SetBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds u to the "bank" field.
|
||||
func (rsu *RoundStatsUpdate) AddBank(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddBank(u)
|
||||
return rsu
|
||||
// SetNillableBank sets the "bank" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableBank(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetBank(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds value to the "bank" field.
|
||||
func (_u *RoundStatsUpdate) AddBank(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEquipment sets the "equipment" field.
|
||||
func (rsu *RoundStatsUpdate) SetEquipment(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetEquipment()
|
||||
rsu.mutation.SetEquipment(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetEquipment(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetEquipment()
|
||||
_u.mutation.SetEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds u to the "equipment" field.
|
||||
func (rsu *RoundStatsUpdate) AddEquipment(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddEquipment(u)
|
||||
return rsu
|
||||
// SetNillableEquipment sets the "equipment" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableEquipment(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetEquipment(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds value to the "equipment" field.
|
||||
func (_u *RoundStatsUpdate) AddEquipment(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSpent sets the "spent" field.
|
||||
func (rsu *RoundStatsUpdate) SetSpent(u uint) *RoundStatsUpdate {
|
||||
rsu.mutation.ResetSpent()
|
||||
rsu.mutation.SetSpent(u)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetSpent(v uint) *RoundStatsUpdate {
|
||||
_u.mutation.ResetSpent()
|
||||
_u.mutation.SetSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds u to the "spent" field.
|
||||
func (rsu *RoundStatsUpdate) AddSpent(u int) *RoundStatsUpdate {
|
||||
rsu.mutation.AddSpent(u)
|
||||
return rsu
|
||||
// SetNillableSpent sets the "spent" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdate) SetNillableSpent(v *uint) *RoundStatsUpdate {
|
||||
if v != nil {
|
||||
_u.SetSpent(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds value to the "spent" field.
|
||||
func (_u *RoundStatsUpdate) AddSpent(v int) *RoundStatsUpdate {
|
||||
_u.mutation.AddSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (rsu *RoundStatsUpdate) SetMatchPlayerID(id int) *RoundStatsUpdate {
|
||||
rsu.mutation.SetMatchPlayerID(id)
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) SetMatchPlayerID(id int) *RoundStatsUpdate {
|
||||
_u.mutation.SetMatchPlayerID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (rsu *RoundStatsUpdate) SetNillableMatchPlayerID(id *int) *RoundStatsUpdate {
|
||||
func (_u *RoundStatsUpdate) SetNillableMatchPlayerID(id *int) *RoundStatsUpdate {
|
||||
if id != nil {
|
||||
rsu = rsu.SetMatchPlayerID(*id)
|
||||
_u = _u.SetMatchPlayerID(*id)
|
||||
}
|
||||
return rsu
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsu *RoundStatsUpdate) SetMatchPlayer(m *MatchPlayer) *RoundStatsUpdate {
|
||||
return rsu.SetMatchPlayerID(m.ID)
|
||||
func (_u *RoundStatsUpdate) SetMatchPlayer(v *MatchPlayer) *RoundStatsUpdate {
|
||||
return _u.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the RoundStatsMutation object of the builder.
|
||||
func (rsu *RoundStatsUpdate) Mutation() *RoundStatsMutation {
|
||||
return rsu.mutation
|
||||
func (_u *RoundStatsUpdate) Mutation() *RoundStatsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayer clears the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsu *RoundStatsUpdate) ClearMatchPlayer() *RoundStatsUpdate {
|
||||
rsu.mutation.ClearMatchPlayer()
|
||||
return rsu
|
||||
func (_u *RoundStatsUpdate) ClearMatchPlayer() *RoundStatsUpdate {
|
||||
_u.mutation.ClearMatchPlayer()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (rsu *RoundStatsUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(rsu.hooks) == 0 {
|
||||
affected, err = rsu.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*RoundStatsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
rsu.mutation = mutation
|
||||
affected, err = rsu.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(rsu.hooks) - 1; i >= 0; i-- {
|
||||
if rsu.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = rsu.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, rsu.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_u *RoundStatsUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (rsu *RoundStatsUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := rsu.Save(ctx)
|
||||
func (_u *RoundStatsUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -152,93 +158,58 @@ func (rsu *RoundStatsUpdate) SaveX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (rsu *RoundStatsUpdate) Exec(ctx context.Context) error {
|
||||
_, err := rsu.Save(ctx)
|
||||
func (_u *RoundStatsUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rsu *RoundStatsUpdate) ExecX(ctx context.Context) {
|
||||
if err := rsu.Exec(ctx); err != nil {
|
||||
func (_u *RoundStatsUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: roundstats.Table,
|
||||
Columns: roundstats.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := rsu.mutation.predicates; len(ps) > 0 {
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *RoundStatsUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdate {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *RoundStatsUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(roundstats.Table, roundstats.Columns, sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := rsu.mutation.Round(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldRound,
|
||||
})
|
||||
if value, ok := _u.mutation.Round(); ok {
|
||||
_spec.SetField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedRound(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldRound,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedRound(); ok {
|
||||
_spec.AddField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.Bank(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldBank,
|
||||
})
|
||||
if value, ok := _u.mutation.Bank(); ok {
|
||||
_spec.SetField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedBank(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldBank,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedBank(); ok {
|
||||
_spec.AddField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.Equipment(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldEquipment,
|
||||
})
|
||||
if value, ok := _u.mutation.Equipment(); ok {
|
||||
_spec.SetField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedEquipment(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldEquipment,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedEquipment(); ok {
|
||||
_spec.AddField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.Spent(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldSpent,
|
||||
})
|
||||
if value, ok := _u.mutation.Spent(); ok {
|
||||
_spec.SetField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsu.mutation.AddedSpent(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldSpent,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedSpent(); ok {
|
||||
_spec.AddField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if rsu.mutation.MatchPlayerCleared() {
|
||||
if _u.mutation.MatchPlayerCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -246,15 +217,12 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := rsu.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -262,10 +230,7 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -273,149 +238,163 @@ func (rsu *RoundStatsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, rsu.driver, _spec); err != nil {
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.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
|
||||
}
|
||||
return n, nil
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (rsuo *RoundStatsUpdateOne) SetRound(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetRound()
|
||||
rsuo.mutation.SetRound(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetRound(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetRound()
|
||||
_u.mutation.SetRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds u to the "round" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddRound(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddRound(u)
|
||||
return rsuo
|
||||
// SetNillableRound sets the "round" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableRound(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRound(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddRound adds value to the "round" field.
|
||||
func (_u *RoundStatsUpdateOne) AddRound(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddRound(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBank sets the "bank" field.
|
||||
func (rsuo *RoundStatsUpdateOne) SetBank(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetBank()
|
||||
rsuo.mutation.SetBank(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetBank(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetBank()
|
||||
_u.mutation.SetBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds u to the "bank" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddBank(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddBank(u)
|
||||
return rsuo
|
||||
// SetNillableBank sets the "bank" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableBank(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetBank(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddBank adds value to the "bank" field.
|
||||
func (_u *RoundStatsUpdateOne) AddBank(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddBank(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEquipment sets the "equipment" field.
|
||||
func (rsuo *RoundStatsUpdateOne) SetEquipment(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetEquipment()
|
||||
rsuo.mutation.SetEquipment(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetEquipment(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetEquipment()
|
||||
_u.mutation.SetEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds u to the "equipment" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddEquipment(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddEquipment(u)
|
||||
return rsuo
|
||||
// SetNillableEquipment sets the "equipment" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableEquipment(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetEquipment(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEquipment adds value to the "equipment" field.
|
||||
func (_u *RoundStatsUpdateOne) AddEquipment(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddEquipment(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSpent sets the "spent" field.
|
||||
func (rsuo *RoundStatsUpdateOne) SetSpent(u uint) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ResetSpent()
|
||||
rsuo.mutation.SetSpent(u)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetSpent(v uint) *RoundStatsUpdateOne {
|
||||
_u.mutation.ResetSpent()
|
||||
_u.mutation.SetSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds u to the "spent" field.
|
||||
func (rsuo *RoundStatsUpdateOne) AddSpent(u int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.AddSpent(u)
|
||||
return rsuo
|
||||
// SetNillableSpent sets the "spent" field if the given value is not nil.
|
||||
func (_u *RoundStatsUpdateOne) SetNillableSpent(v *uint) *RoundStatsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSpent(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSpent adds value to the "spent" field.
|
||||
func (_u *RoundStatsUpdateOne) AddSpent(v int) *RoundStatsUpdateOne {
|
||||
_u.mutation.AddSpent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID.
|
||||
func (rsuo *RoundStatsUpdateOne) SetMatchPlayerID(id int) *RoundStatsUpdateOne {
|
||||
rsuo.mutation.SetMatchPlayerID(id)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) SetMatchPlayerID(id int) *RoundStatsUpdateOne {
|
||||
_u.mutation.SetMatchPlayerID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayerID sets the "match_player" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (rsuo *RoundStatsUpdateOne) SetNillableMatchPlayerID(id *int) *RoundStatsUpdateOne {
|
||||
func (_u *RoundStatsUpdateOne) SetNillableMatchPlayerID(id *int) *RoundStatsUpdateOne {
|
||||
if id != nil {
|
||||
rsuo = rsuo.SetMatchPlayerID(*id)
|
||||
_u = _u.SetMatchPlayerID(*id)
|
||||
}
|
||||
return rsuo
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayer sets the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsuo *RoundStatsUpdateOne) SetMatchPlayer(m *MatchPlayer) *RoundStatsUpdateOne {
|
||||
return rsuo.SetMatchPlayerID(m.ID)
|
||||
func (_u *RoundStatsUpdateOne) SetMatchPlayer(v *MatchPlayer) *RoundStatsUpdateOne {
|
||||
return _u.SetMatchPlayerID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the RoundStatsMutation object of the builder.
|
||||
func (rsuo *RoundStatsUpdateOne) Mutation() *RoundStatsMutation {
|
||||
return rsuo.mutation
|
||||
func (_u *RoundStatsUpdateOne) Mutation() *RoundStatsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayer clears the "match_player" edge to the MatchPlayer entity.
|
||||
func (rsuo *RoundStatsUpdateOne) ClearMatchPlayer() *RoundStatsUpdateOne {
|
||||
rsuo.mutation.ClearMatchPlayer()
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) ClearMatchPlayer() *RoundStatsUpdateOne {
|
||||
_u.mutation.ClearMatchPlayer()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the RoundStatsUpdate builder.
|
||||
func (_u *RoundStatsUpdateOne) Where(ps ...predicate.RoundStats) *RoundStatsUpdateOne {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (rsuo *RoundStatsUpdateOne) Select(field string, fields ...string) *RoundStatsUpdateOne {
|
||||
rsuo.fields = append([]string{field}, fields...)
|
||||
return rsuo
|
||||
func (_u *RoundStatsUpdateOne) Select(field string, fields ...string) *RoundStatsUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated RoundStats entity.
|
||||
func (rsuo *RoundStatsUpdateOne) Save(ctx context.Context) (*RoundStats, error) {
|
||||
var (
|
||||
err error
|
||||
node *RoundStats
|
||||
)
|
||||
if len(rsuo.hooks) == 0 {
|
||||
node, err = rsuo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*RoundStatsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
rsuo.mutation = mutation
|
||||
node, err = rsuo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(rsuo.hooks) - 1; i >= 0; i-- {
|
||||
if rsuo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = rsuo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, rsuo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_u *RoundStatsUpdateOne) Save(ctx context.Context) (*RoundStats, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (rsuo *RoundStatsUpdateOne) SaveX(ctx context.Context) *RoundStats {
|
||||
node, err := rsuo.Save(ctx)
|
||||
func (_u *RoundStatsUpdateOne) SaveX(ctx context.Context) *RoundStats {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -423,35 +402,32 @@ func (rsuo *RoundStatsUpdateOne) SaveX(ctx context.Context) *RoundStats {
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (rsuo *RoundStatsUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := rsuo.Save(ctx)
|
||||
func (_u *RoundStatsUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (rsuo *RoundStatsUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := rsuo.Exec(ctx); err != nil {
|
||||
func (_u *RoundStatsUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: roundstats.Table,
|
||||
Columns: roundstats.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
id, ok := rsuo.mutation.ID()
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *RoundStatsUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *RoundStatsUpdateOne {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(roundstats.Table, roundstats.Columns, sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "RoundStats.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := rsuo.fields; len(fields) > 0 {
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, roundstats.FieldID)
|
||||
for _, f := range fields {
|
||||
@@ -463,70 +439,38 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := rsuo.mutation.predicates; len(ps) > 0 {
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := rsuo.mutation.Round(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldRound,
|
||||
})
|
||||
if value, ok := _u.mutation.Round(); ok {
|
||||
_spec.SetField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedRound(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldRound,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedRound(); ok {
|
||||
_spec.AddField(roundstats.FieldRound, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.Bank(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldBank,
|
||||
})
|
||||
if value, ok := _u.mutation.Bank(); ok {
|
||||
_spec.SetField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedBank(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldBank,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedBank(); ok {
|
||||
_spec.AddField(roundstats.FieldBank, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.Equipment(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldEquipment,
|
||||
})
|
||||
if value, ok := _u.mutation.Equipment(); ok {
|
||||
_spec.SetField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedEquipment(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldEquipment,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedEquipment(); ok {
|
||||
_spec.AddField(roundstats.FieldEquipment, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.Spent(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldSpent,
|
||||
})
|
||||
if value, ok := _u.mutation.Spent(); ok {
|
||||
_spec.SetField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := rsuo.mutation.AddedSpent(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: roundstats.FieldSpent,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedSpent(); ok {
|
||||
_spec.AddField(roundstats.FieldSpent, field.TypeUint, value)
|
||||
}
|
||||
if rsuo.mutation.MatchPlayerCleared() {
|
||||
if _u.mutation.MatchPlayerCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -534,15 +478,12 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := rsuo.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -550,10 +491,7 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
Columns: []string{roundstats.MatchPlayerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -561,16 +499,18 @@ func (rsuo *RoundStatsUpdateOne) sqlSave(ctx context.Context) (_node *RoundStats
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_node = &RoundStats{config: rsuo.config}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
_node = &RoundStats{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, rsuo.driver, _spec); err != nil {
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.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 nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/schema"
|
||||
"time"
|
||||
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/schema"
|
||||
)
|
||||
|
||||
// The init function reads all schema descriptors with runtime code
|
||||
|
||||
@@ -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 csgowtfd/ent/runtime.go
|
||||
// The schema-stitching logic is generated in somegit.dev/csgowtf/csgowtfd/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.10.0" // Version of ent codegen.
|
||||
Sum = "h1:9cBomE1fh+WX34DPYQL7tDNAIvhKa3tXvwxuLyhYCMo=" // Sum of ent codegen.
|
||||
Version = "v0.14.5" // Version of ent codegen.
|
||||
Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen.
|
||||
)
|
||||
|
||||
@@ -28,6 +28,7 @@ func (Match) Fields() []ent.Field {
|
||||
field.Bool("vac_present").Default(false),
|
||||
field.Bool("gameban_present").Default(false),
|
||||
field.Bytes("decryption_key").Optional(),
|
||||
field.Float("tick_rate").Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ func (MatchPlayer) Fields() []ent.Field {
|
||||
field.Uint64("match_stats").Optional(),
|
||||
field.Uint64("player_stats").Optional(),
|
||||
field.Int("flash_assists").Optional(),
|
||||
field.Float("avg_ping").Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
78
ent/spray.go
78
ent/spray.go
@@ -1,14 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/spray"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
)
|
||||
|
||||
// Spray is the model entity for the Spray schema.
|
||||
@@ -24,6 +25,7 @@ type Spray struct {
|
||||
// The values are being populated by the SprayQuery when eager-loading is set.
|
||||
Edges SprayEdges `json:"edges"`
|
||||
match_player_spray *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// SprayEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -38,20 +40,17 @@ type SprayEdges struct {
|
||||
// MatchPlayersOrErr returns the MatchPlayers value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
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.
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
if e.MatchPlayers != nil {
|
||||
return e.MatchPlayers, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "match_players"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Spray) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Spray) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case spray.FieldSpray:
|
||||
@@ -61,7 +60,7 @@ func (*Spray) scanValues(columns []string) ([]interface{}, error) {
|
||||
case spray.ForeignKeys[0]: // match_player_spray
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Spray", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -69,7 +68,7 @@ func (*Spray) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Spray fields.
|
||||
func (s *Spray) assignValues(columns []string, values []interface{}) error {
|
||||
func (_m *Spray) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@@ -80,72 +79,75 @@ func (s *Spray) assignValues(columns []string, values []interface{}) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
s.ID = int(value.Int64)
|
||||
_m.ID = int(value.Int64)
|
||||
case spray.FieldWeapon:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field weapon", values[i])
|
||||
} else if value.Valid {
|
||||
s.Weapon = int(value.Int64)
|
||||
_m.Weapon = int(value.Int64)
|
||||
}
|
||||
case spray.FieldSpray:
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field spray", values[i])
|
||||
} else if value != nil {
|
||||
s.Spray = *value
|
||||
_m.Spray = *value
|
||||
}
|
||||
case spray.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field match_player_spray", value)
|
||||
} else if value.Valid {
|
||||
s.match_player_spray = new(int)
|
||||
*s.match_player_spray = int(value.Int64)
|
||||
_m.match_player_spray = new(int)
|
||||
*_m.match_player_spray = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Spray.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *Spray) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryMatchPlayers queries the "match_players" edge of the Spray entity.
|
||||
func (s *Spray) QueryMatchPlayers() *MatchPlayerQuery {
|
||||
return (&SprayClient{config: s.config}).QueryMatchPlayers(s)
|
||||
func (_m *Spray) QueryMatchPlayers() *MatchPlayerQuery {
|
||||
return NewSprayClient(_m.config).QueryMatchPlayers(_m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Spray.
|
||||
// Note that you need to call Spray.Unwrap() before calling this method if this Spray
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (s *Spray) Update() *SprayUpdateOne {
|
||||
return (&SprayClient{config: s.config}).UpdateOne(s)
|
||||
func (_m *Spray) Update() *SprayUpdateOne {
|
||||
return NewSprayClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// 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)
|
||||
func (_m *Spray) Unwrap() *Spray {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Spray is not a transactional entity")
|
||||
}
|
||||
s.config.driver = tx.drv
|
||||
return s
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (s *Spray) String() string {
|
||||
func (_m *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("%v", s.Weapon))
|
||||
builder.WriteString(", spray=")
|
||||
builder.WriteString(fmt.Sprintf("%v", s.Spray))
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("weapon=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Weapon))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("spray=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Spray))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Sprays is a parsable slice of Spray.
|
||||
type Sprays []*Spray
|
||||
|
||||
func (s Sprays) config(cfg config) {
|
||||
for _i := range s {
|
||||
s[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package spray
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the spray type in the database.
|
||||
Label = "spray"
|
||||
@@ -51,3 +56,30 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Spray queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByWeapon orders the results by the weapon field.
|
||||
func ByWeapon(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldWeapon, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMatchPlayersField orders the results by match_players field.
|
||||
func ByMatchPlayersField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMatchPlayersStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newMatchPlayersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayersTable, MatchPlayersColumn),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,261 +1,146 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package spray
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Spray(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Spray(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Spray(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Spray(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Spray(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Spray(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Spray(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Spray(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Spray(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Weapon applies equality check predicate on the "weapon" field. It's identical to WeaponEQ.
|
||||
func Weapon(v int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldWeapon), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldEQ(FieldWeapon, v))
|
||||
}
|
||||
|
||||
// Spray applies equality check predicate on the "spray" field. It's identical to SprayEQ.
|
||||
func Spray(v []byte) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldSpray), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldEQ(FieldSpray, v))
|
||||
}
|
||||
|
||||
// WeaponEQ applies the EQ predicate on the "weapon" field.
|
||||
func WeaponEQ(v int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldWeapon), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldEQ(FieldWeapon, v))
|
||||
}
|
||||
|
||||
// WeaponNEQ applies the NEQ predicate on the "weapon" field.
|
||||
func WeaponNEQ(v int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldWeapon), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldNEQ(FieldWeapon, v))
|
||||
}
|
||||
|
||||
// WeaponIn applies the In predicate on the "weapon" field.
|
||||
func WeaponIn(vs ...int) predicate.Spray {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Spray(sql.FieldIn(FieldWeapon, vs...))
|
||||
}
|
||||
|
||||
// WeaponNotIn applies the NotIn predicate on the "weapon" field.
|
||||
func WeaponNotIn(vs ...int) predicate.Spray {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Spray(sql.FieldNotIn(FieldWeapon, vs...))
|
||||
}
|
||||
|
||||
// WeaponGT applies the GT predicate on the "weapon" field.
|
||||
func WeaponGT(v int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldWeapon), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldGT(FieldWeapon, v))
|
||||
}
|
||||
|
||||
// WeaponGTE applies the GTE predicate on the "weapon" field.
|
||||
func WeaponGTE(v int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldWeapon), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldGTE(FieldWeapon, v))
|
||||
}
|
||||
|
||||
// WeaponLT applies the LT predicate on the "weapon" field.
|
||||
func WeaponLT(v int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldWeapon), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldLT(FieldWeapon, v))
|
||||
}
|
||||
|
||||
// WeaponLTE applies the LTE predicate on the "weapon" field.
|
||||
func WeaponLTE(v int) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldWeapon), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldLTE(FieldWeapon, v))
|
||||
}
|
||||
|
||||
// SprayEQ applies the EQ predicate on the "spray" field.
|
||||
func SprayEQ(v []byte) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldSpray), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldEQ(FieldSpray, v))
|
||||
}
|
||||
|
||||
// SprayNEQ applies the NEQ predicate on the "spray" field.
|
||||
func SprayNEQ(v []byte) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldSpray), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldNEQ(FieldSpray, v))
|
||||
}
|
||||
|
||||
// SprayIn applies the In predicate on the "spray" field.
|
||||
func SprayIn(vs ...[]byte) predicate.Spray {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Spray(sql.FieldIn(FieldSpray, vs...))
|
||||
}
|
||||
|
||||
// SprayNotIn applies the NotIn predicate on the "spray" field.
|
||||
func SprayNotIn(vs ...[]byte) predicate.Spray {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Spray(sql.FieldNotIn(FieldSpray, vs...))
|
||||
}
|
||||
|
||||
// SprayGT applies the GT predicate on the "spray" field.
|
||||
func SprayGT(v []byte) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldSpray), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldGT(FieldSpray, v))
|
||||
}
|
||||
|
||||
// SprayGTE applies the GTE predicate on the "spray" field.
|
||||
func SprayGTE(v []byte) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldSpray), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldGTE(FieldSpray, v))
|
||||
}
|
||||
|
||||
// SprayLT applies the LT predicate on the "spray" field.
|
||||
func SprayLT(v []byte) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldSpray), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldLT(FieldSpray, v))
|
||||
}
|
||||
|
||||
// SprayLTE applies the LTE predicate on the "spray" field.
|
||||
func SprayLTE(v []byte) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldSpray), v))
|
||||
})
|
||||
return predicate.Spray(sql.FieldLTE(FieldSpray, v))
|
||||
}
|
||||
|
||||
// HasMatchPlayers applies the HasEdge predicate on the "match_players" edge.
|
||||
@@ -263,7 +148,6 @@ func HasMatchPlayers() predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayersTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayersTable, MatchPlayersColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@@ -273,11 +157,7 @@ func HasMatchPlayers() predicate.Spray {
|
||||
// HasMatchPlayersWith applies the HasEdge predicate on the "match_players" edge with a given conditions (other predicates).
|
||||
func HasMatchPlayersWith(preds ...predicate.MatchPlayer) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MatchPlayersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MatchPlayersTable, MatchPlayersColumn),
|
||||
)
|
||||
step := newMatchPlayersStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -288,32 +168,15 @@ func HasMatchPlayersWith(preds ...predicate.MatchPlayer) predicate.Spray {
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Spray) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Spray(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Spray) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Spray(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Spray) predicate.Spray {
|
||||
return predicate.Spray(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
return predicate.Spray(sql.NotPredicates(p))
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/spray"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
)
|
||||
|
||||
// SprayCreate is the builder for creating a Spray entity.
|
||||
@@ -21,85 +21,49 @@ type SprayCreate struct {
|
||||
}
|
||||
|
||||
// SetWeapon sets the "weapon" field.
|
||||
func (sc *SprayCreate) SetWeapon(i int) *SprayCreate {
|
||||
sc.mutation.SetWeapon(i)
|
||||
return sc
|
||||
func (_c *SprayCreate) SetWeapon(v int) *SprayCreate {
|
||||
_c.mutation.SetWeapon(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSpray sets the "spray" field.
|
||||
func (sc *SprayCreate) SetSpray(b []byte) *SprayCreate {
|
||||
sc.mutation.SetSpray(b)
|
||||
return sc
|
||||
func (_c *SprayCreate) SetSpray(v []byte) *SprayCreate {
|
||||
_c.mutation.SetSpray(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMatchPlayersID sets the "match_players" edge to the MatchPlayer entity by ID.
|
||||
func (sc *SprayCreate) SetMatchPlayersID(id int) *SprayCreate {
|
||||
sc.mutation.SetMatchPlayersID(id)
|
||||
return sc
|
||||
func (_c *SprayCreate) SetMatchPlayersID(id int) *SprayCreate {
|
||||
_c.mutation.SetMatchPlayersID(id)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayersID sets the "match_players" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (sc *SprayCreate) SetNillableMatchPlayersID(id *int) *SprayCreate {
|
||||
func (_c *SprayCreate) SetNillableMatchPlayersID(id *int) *SprayCreate {
|
||||
if id != nil {
|
||||
sc = sc.SetMatchPlayersID(*id)
|
||||
_c = _c.SetMatchPlayersID(*id)
|
||||
}
|
||||
return sc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMatchPlayers sets the "match_players" edge to the MatchPlayer entity.
|
||||
func (sc *SprayCreate) SetMatchPlayers(m *MatchPlayer) *SprayCreate {
|
||||
return sc.SetMatchPlayersID(m.ID)
|
||||
func (_c *SprayCreate) SetMatchPlayers(v *MatchPlayer) *SprayCreate {
|
||||
return _c.SetMatchPlayersID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the SprayMutation object of the builder.
|
||||
func (sc *SprayCreate) Mutation() *SprayMutation {
|
||||
return sc.mutation
|
||||
func (_c *SprayCreate) Mutation() *SprayMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the Spray in the database.
|
||||
func (sc *SprayCreate) Save(ctx context.Context) (*Spray, error) {
|
||||
var (
|
||||
err error
|
||||
node *Spray
|
||||
)
|
||||
if len(sc.hooks) == 0 {
|
||||
if err = sc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = sc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SprayMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = sc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sc.mutation = mutation
|
||||
if node, err = sc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(sc.hooks) - 1; i >= 0; i-- {
|
||||
if sc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = sc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, sc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_c *SprayCreate) Save(ctx context.Context) (*Spray, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (sc *SprayCreate) SaveX(ctx context.Context) *Spray {
|
||||
v, err := sc.Save(ctx)
|
||||
func (_c *SprayCreate) SaveX(ctx context.Context) *Spray {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -107,70 +71,61 @@ func (sc *SprayCreate) SaveX(ctx context.Context) *Spray {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (sc *SprayCreate) Exec(ctx context.Context) error {
|
||||
_, err := sc.Save(ctx)
|
||||
func (_c *SprayCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (sc *SprayCreate) ExecX(ctx context.Context) {
|
||||
if err := sc.Exec(ctx); err != nil {
|
||||
func (_c *SprayCreate) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (sc *SprayCreate) check() error {
|
||||
if _, ok := sc.mutation.Weapon(); !ok {
|
||||
func (_c *SprayCreate) check() error {
|
||||
if _, ok := _c.mutation.Weapon(); !ok {
|
||||
return &ValidationError{Name: "weapon", err: errors.New(`ent: missing required field "Spray.weapon"`)}
|
||||
}
|
||||
if _, ok := sc.mutation.Spray(); !ok {
|
||||
if _, ok := _c.mutation.Spray(); !ok {
|
||||
return &ValidationError{Name: "spray", err: errors.New(`ent: missing required field "Spray.spray"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sc *SprayCreate) sqlSave(ctx context.Context) (*Spray, error) {
|
||||
_node, _spec := sc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil {
|
||||
func (_c *SprayCreate) sqlSave(ctx context.Context) (*Spray, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int(id)
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (sc *SprayCreate) createSpec() (*Spray, *sqlgraph.CreateSpec) {
|
||||
func (_c *SprayCreate) createSpec() (*Spray, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Spray{config: sc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: spray.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
}
|
||||
_node = &Spray{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(spray.Table, sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt))
|
||||
)
|
||||
if value, ok := sc.mutation.Weapon(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: spray.FieldWeapon,
|
||||
})
|
||||
if value, ok := _c.mutation.Weapon(); ok {
|
||||
_spec.SetField(spray.FieldWeapon, field.TypeInt, value)
|
||||
_node.Weapon = value
|
||||
}
|
||||
if value, ok := sc.mutation.Spray(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: spray.FieldSpray,
|
||||
})
|
||||
if value, ok := _c.mutation.Spray(); ok {
|
||||
_spec.SetField(spray.FieldSpray, field.TypeBytes, value)
|
||||
_node.Spray = value
|
||||
}
|
||||
if nodes := sc.mutation.MatchPlayersIDs(); len(nodes) > 0 {
|
||||
if nodes := _c.mutation.MatchPlayersIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -178,10 +133,7 @@ func (sc *SprayCreate) createSpec() (*Spray, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -196,17 +148,21 @@ func (sc *SprayCreate) createSpec() (*Spray, *sqlgraph.CreateSpec) {
|
||||
// SprayCreateBulk is the builder for creating many Spray entities in bulk.
|
||||
type SprayCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*SprayCreate
|
||||
}
|
||||
|
||||
// Save creates the Spray entities in the database.
|
||||
func (scb *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) {
|
||||
specs := make([]*sqlgraph.CreateSpec, len(scb.builders))
|
||||
nodes := make([]*Spray, len(scb.builders))
|
||||
mutators := make([]Mutator, len(scb.builders))
|
||||
for i := range scb.builders {
|
||||
func (_c *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*Spray, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := scb.builders[i]
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SprayMutation)
|
||||
if !ok {
|
||||
@@ -216,16 +172,16 @@ func (scb *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, scb.builders[i+1].mutation)
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, scb.driver, spec); err != nil {
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -233,11 +189,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-- {
|
||||
@@ -247,7 +203,7 @@ func (scb *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) {
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, scb.builders[0].mutation); err != nil {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -255,8 +211,8 @@ func (scb *SprayCreateBulk) Save(ctx context.Context) ([]*Spray, error) {
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (scb *SprayCreateBulk) SaveX(ctx context.Context) []*Spray {
|
||||
v, err := scb.Save(ctx)
|
||||
func (_c *SprayCreateBulk) SaveX(ctx context.Context) []*Spray {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -264,14 +220,14 @@ func (scb *SprayCreateBulk) SaveX(ctx context.Context) []*Spray {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (scb *SprayCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := scb.Save(ctx)
|
||||
func (_c *SprayCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (scb *SprayCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := scb.Exec(ctx); err != nil {
|
||||
func (_c *SprayCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/spray"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
)
|
||||
|
||||
// SprayDelete is the builder for deleting a Spray entity.
|
||||
@@ -21,80 +20,56 @@ type SprayDelete struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the SprayDelete builder.
|
||||
func (sd *SprayDelete) Where(ps ...predicate.Spray) *SprayDelete {
|
||||
sd.mutation.Where(ps...)
|
||||
return sd
|
||||
func (_d *SprayDelete) Where(ps ...predicate.Spray) *SprayDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (sd *SprayDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(sd.hooks) == 0 {
|
||||
affected, err = sd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SprayMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
sd.mutation = mutation
|
||||
affected, err = sd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(sd.hooks) - 1; i >= 0; i-- {
|
||||
if sd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = sd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, sd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_d *SprayDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (sd *SprayDelete) ExecX(ctx context.Context) int {
|
||||
n, err := sd.Exec(ctx)
|
||||
func (_d *SprayDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (sd *SprayDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: spray.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := sd.mutation.predicates; len(ps) > 0 {
|
||||
func (_d *SprayDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(spray.Table, sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, sd.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// SprayDeleteOne is the builder for deleting a single Spray entity.
|
||||
type SprayDeleteOne struct {
|
||||
sd *SprayDelete
|
||||
_d *SprayDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the SprayDelete builder.
|
||||
func (_d *SprayDeleteOne) Where(ps ...predicate.Spray) *SprayDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (sdo *SprayDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := sdo.sd.Exec(ctx)
|
||||
func (_d *SprayDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
@@ -106,6 +81,8 @@ func (sdo *SprayDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (sdo *SprayDeleteOne) ExecX(ctx context.Context) {
|
||||
sdo.sd.ExecX(ctx)
|
||||
func (_d *SprayDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,117 +1,99 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/spray"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
)
|
||||
|
||||
// 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.
|
||||
func (su *SprayUpdate) Where(ps ...predicate.Spray) *SprayUpdate {
|
||||
su.mutation.Where(ps...)
|
||||
return su
|
||||
func (_u *SprayUpdate) Where(ps ...predicate.Spray) *SprayUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetWeapon sets the "weapon" field.
|
||||
func (su *SprayUpdate) SetWeapon(i int) *SprayUpdate {
|
||||
su.mutation.ResetWeapon()
|
||||
su.mutation.SetWeapon(i)
|
||||
return su
|
||||
func (_u *SprayUpdate) SetWeapon(v int) *SprayUpdate {
|
||||
_u.mutation.ResetWeapon()
|
||||
_u.mutation.SetWeapon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddWeapon adds i to the "weapon" field.
|
||||
func (su *SprayUpdate) AddWeapon(i int) *SprayUpdate {
|
||||
su.mutation.AddWeapon(i)
|
||||
return su
|
||||
// SetNillableWeapon sets the "weapon" field if the given value is not nil.
|
||||
func (_u *SprayUpdate) SetNillableWeapon(v *int) *SprayUpdate {
|
||||
if v != nil {
|
||||
_u.SetWeapon(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddWeapon adds value to the "weapon" field.
|
||||
func (_u *SprayUpdate) AddWeapon(v int) *SprayUpdate {
|
||||
_u.mutation.AddWeapon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSpray sets the "spray" field.
|
||||
func (su *SprayUpdate) SetSpray(b []byte) *SprayUpdate {
|
||||
su.mutation.SetSpray(b)
|
||||
return su
|
||||
func (_u *SprayUpdate) SetSpray(v []byte) *SprayUpdate {
|
||||
_u.mutation.SetSpray(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayersID sets the "match_players" edge to the MatchPlayer entity by ID.
|
||||
func (su *SprayUpdate) SetMatchPlayersID(id int) *SprayUpdate {
|
||||
su.mutation.SetMatchPlayersID(id)
|
||||
return su
|
||||
func (_u *SprayUpdate) SetMatchPlayersID(id int) *SprayUpdate {
|
||||
_u.mutation.SetMatchPlayersID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayersID sets the "match_players" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (su *SprayUpdate) SetNillableMatchPlayersID(id *int) *SprayUpdate {
|
||||
func (_u *SprayUpdate) SetNillableMatchPlayersID(id *int) *SprayUpdate {
|
||||
if id != nil {
|
||||
su = su.SetMatchPlayersID(*id)
|
||||
_u = _u.SetMatchPlayersID(*id)
|
||||
}
|
||||
return su
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayers sets the "match_players" edge to the MatchPlayer entity.
|
||||
func (su *SprayUpdate) SetMatchPlayers(m *MatchPlayer) *SprayUpdate {
|
||||
return su.SetMatchPlayersID(m.ID)
|
||||
func (_u *SprayUpdate) SetMatchPlayers(v *MatchPlayer) *SprayUpdate {
|
||||
return _u.SetMatchPlayersID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the SprayMutation object of the builder.
|
||||
func (su *SprayUpdate) Mutation() *SprayMutation {
|
||||
return su.mutation
|
||||
func (_u *SprayUpdate) Mutation() *SprayMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayers clears the "match_players" edge to the MatchPlayer entity.
|
||||
func (su *SprayUpdate) ClearMatchPlayers() *SprayUpdate {
|
||||
su.mutation.ClearMatchPlayers()
|
||||
return su
|
||||
func (_u *SprayUpdate) ClearMatchPlayers() *SprayUpdate {
|
||||
_u.mutation.ClearMatchPlayers()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (su *SprayUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(su.hooks) == 0 {
|
||||
affected, err = su.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SprayMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
su.mutation = mutation
|
||||
affected, err = su.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(su.hooks) - 1; i >= 0; i-- {
|
||||
if su.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = su.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, su.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_u *SprayUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (su *SprayUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := su.Save(ctx)
|
||||
func (_u *SprayUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -119,58 +101,43 @@ func (su *SprayUpdate) SaveX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (su *SprayUpdate) Exec(ctx context.Context) error {
|
||||
_, err := su.Save(ctx)
|
||||
func (_u *SprayUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (su *SprayUpdate) ExecX(ctx context.Context) {
|
||||
if err := su.Exec(ctx); err != nil {
|
||||
func (_u *SprayUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: spray.Table,
|
||||
Columns: spray.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := su.mutation.predicates; len(ps) > 0 {
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *SprayUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SprayUpdate {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *SprayUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(spray.Table, spray.Columns, sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := su.mutation.Weapon(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: spray.FieldWeapon,
|
||||
})
|
||||
if value, ok := _u.mutation.Weapon(); ok {
|
||||
_spec.SetField(spray.FieldWeapon, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := su.mutation.AddedWeapon(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: spray.FieldWeapon,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedWeapon(); ok {
|
||||
_spec.AddField(spray.FieldWeapon, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := su.mutation.Spray(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: spray.FieldSpray,
|
||||
})
|
||||
if value, ok := _u.mutation.Spray(); ok {
|
||||
_spec.SetField(spray.FieldSpray, field.TypeBytes, value)
|
||||
}
|
||||
if su.mutation.MatchPlayersCleared() {
|
||||
if _u.mutation.MatchPlayersCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -178,15 +145,12 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := su.mutation.MatchPlayersIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayersIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -194,10 +158,7 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -205,116 +166,106 @@ func (su *SprayUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil {
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.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
|
||||
}
|
||||
return n, nil
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (suo *SprayUpdateOne) SetWeapon(i int) *SprayUpdateOne {
|
||||
suo.mutation.ResetWeapon()
|
||||
suo.mutation.SetWeapon(i)
|
||||
return suo
|
||||
func (_u *SprayUpdateOne) SetWeapon(v int) *SprayUpdateOne {
|
||||
_u.mutation.ResetWeapon()
|
||||
_u.mutation.SetWeapon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddWeapon adds i to the "weapon" field.
|
||||
func (suo *SprayUpdateOne) AddWeapon(i int) *SprayUpdateOne {
|
||||
suo.mutation.AddWeapon(i)
|
||||
return suo
|
||||
// SetNillableWeapon sets the "weapon" field if the given value is not nil.
|
||||
func (_u *SprayUpdateOne) SetNillableWeapon(v *int) *SprayUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetWeapon(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddWeapon adds value to the "weapon" field.
|
||||
func (_u *SprayUpdateOne) AddWeapon(v int) *SprayUpdateOne {
|
||||
_u.mutation.AddWeapon(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSpray sets the "spray" field.
|
||||
func (suo *SprayUpdateOne) SetSpray(b []byte) *SprayUpdateOne {
|
||||
suo.mutation.SetSpray(b)
|
||||
return suo
|
||||
func (_u *SprayUpdateOne) SetSpray(v []byte) *SprayUpdateOne {
|
||||
_u.mutation.SetSpray(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayersID sets the "match_players" edge to the MatchPlayer entity by ID.
|
||||
func (suo *SprayUpdateOne) SetMatchPlayersID(id int) *SprayUpdateOne {
|
||||
suo.mutation.SetMatchPlayersID(id)
|
||||
return suo
|
||||
func (_u *SprayUpdateOne) SetMatchPlayersID(id int) *SprayUpdateOne {
|
||||
_u.mutation.SetMatchPlayersID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMatchPlayersID sets the "match_players" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (suo *SprayUpdateOne) SetNillableMatchPlayersID(id *int) *SprayUpdateOne {
|
||||
func (_u *SprayUpdateOne) SetNillableMatchPlayersID(id *int) *SprayUpdateOne {
|
||||
if id != nil {
|
||||
suo = suo.SetMatchPlayersID(*id)
|
||||
_u = _u.SetMatchPlayersID(*id)
|
||||
}
|
||||
return suo
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMatchPlayers sets the "match_players" edge to the MatchPlayer entity.
|
||||
func (suo *SprayUpdateOne) SetMatchPlayers(m *MatchPlayer) *SprayUpdateOne {
|
||||
return suo.SetMatchPlayersID(m.ID)
|
||||
func (_u *SprayUpdateOne) SetMatchPlayers(v *MatchPlayer) *SprayUpdateOne {
|
||||
return _u.SetMatchPlayersID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the SprayMutation object of the builder.
|
||||
func (suo *SprayUpdateOne) Mutation() *SprayMutation {
|
||||
return suo.mutation
|
||||
func (_u *SprayUpdateOne) Mutation() *SprayMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearMatchPlayers clears the "match_players" edge to the MatchPlayer entity.
|
||||
func (suo *SprayUpdateOne) ClearMatchPlayers() *SprayUpdateOne {
|
||||
suo.mutation.ClearMatchPlayers()
|
||||
return suo
|
||||
func (_u *SprayUpdateOne) ClearMatchPlayers() *SprayUpdateOne {
|
||||
_u.mutation.ClearMatchPlayers()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the SprayUpdate builder.
|
||||
func (_u *SprayUpdateOne) Where(ps ...predicate.Spray) *SprayUpdateOne {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (suo *SprayUpdateOne) Select(field string, fields ...string) *SprayUpdateOne {
|
||||
suo.fields = append([]string{field}, fields...)
|
||||
return suo
|
||||
func (_u *SprayUpdateOne) Select(field string, fields ...string) *SprayUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated Spray entity.
|
||||
func (suo *SprayUpdateOne) Save(ctx context.Context) (*Spray, error) {
|
||||
var (
|
||||
err error
|
||||
node *Spray
|
||||
)
|
||||
if len(suo.hooks) == 0 {
|
||||
node, err = suo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*SprayMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
suo.mutation = mutation
|
||||
node, err = suo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(suo.hooks) - 1; i >= 0; i-- {
|
||||
if suo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = suo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, suo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_u *SprayUpdateOne) Save(ctx context.Context) (*Spray, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (suo *SprayUpdateOne) SaveX(ctx context.Context) *Spray {
|
||||
node, err := suo.Save(ctx)
|
||||
func (_u *SprayUpdateOne) SaveX(ctx context.Context) *Spray {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -322,35 +273,32 @@ func (suo *SprayUpdateOne) SaveX(ctx context.Context) *Spray {
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (suo *SprayUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := suo.Save(ctx)
|
||||
func (_u *SprayUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (suo *SprayUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := suo.Exec(ctx); err != nil {
|
||||
func (_u *SprayUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: spray.Table,
|
||||
Columns: spray.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: spray.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
id, ok := suo.mutation.ID()
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *SprayUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *SprayUpdateOne {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(spray.Table, spray.Columns, sqlgraph.NewFieldSpec(spray.FieldID, field.TypeInt))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Spray.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := suo.fields; len(fields) > 0 {
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, spray.FieldID)
|
||||
for _, f := range fields {
|
||||
@@ -362,35 +310,23 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := suo.mutation.predicates; len(ps) > 0 {
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := suo.mutation.Weapon(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: spray.FieldWeapon,
|
||||
})
|
||||
if value, ok := _u.mutation.Weapon(); ok {
|
||||
_spec.SetField(spray.FieldWeapon, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := suo.mutation.AddedWeapon(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: spray.FieldWeapon,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedWeapon(); ok {
|
||||
_spec.AddField(spray.FieldWeapon, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := suo.mutation.Spray(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeBytes,
|
||||
Value: value,
|
||||
Column: spray.FieldSpray,
|
||||
})
|
||||
if value, ok := _u.mutation.Spray(); ok {
|
||||
_spec.SetField(spray.FieldSpray, field.TypeBytes, value)
|
||||
}
|
||||
if suo.mutation.MatchPlayersCleared() {
|
||||
if _u.mutation.MatchPlayersCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -398,15 +334,12 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := suo.mutation.MatchPlayersIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.MatchPlayersIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -414,10 +347,7 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error
|
||||
Columns: []string{spray.MatchPlayersColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -425,16 +355,18 @@ func (suo *SprayUpdateOne) sqlSave(ctx context.Context) (_node *Spray, err error
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_node = &Spray{config: suo.config}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
_node = &Spray{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, suo.driver, _spec); err != nil {
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.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 nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
42
ent/tx.go
42
ent/tx.go
@@ -1,4 +1,4 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
@@ -30,12 +30,6 @@ type Tx struct {
|
||||
// lazily loaded.
|
||||
client *Client
|
||||
clientOnce sync.Once
|
||||
|
||||
// completion callbacks.
|
||||
mu sync.Mutex
|
||||
onCommit []CommitHook
|
||||
onRollback []RollbackHook
|
||||
|
||||
// ctx lives for the life of the transaction. It is
|
||||
// the same context used by the underlying connection.
|
||||
ctx context.Context
|
||||
@@ -80,9 +74,9 @@ func (tx *Tx) Commit() error {
|
||||
var fn Committer = CommitFunc(func(context.Context, *Tx) error {
|
||||
return txDriver.tx.Commit()
|
||||
})
|
||||
tx.mu.Lock()
|
||||
hooks := append([]CommitHook(nil), tx.onCommit...)
|
||||
tx.mu.Unlock()
|
||||
txDriver.mu.Lock()
|
||||
hooks := append([]CommitHook(nil), txDriver.onCommit...)
|
||||
txDriver.mu.Unlock()
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
fn = hooks[i](fn)
|
||||
}
|
||||
@@ -91,9 +85,10 @@ func (tx *Tx) Commit() error {
|
||||
|
||||
// OnCommit adds a hook to call on commit.
|
||||
func (tx *Tx) OnCommit(f CommitHook) {
|
||||
tx.mu.Lock()
|
||||
defer tx.mu.Unlock()
|
||||
tx.onCommit = append(tx.onCommit, f)
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
txDriver.mu.Lock()
|
||||
txDriver.onCommit = append(txDriver.onCommit, f)
|
||||
txDriver.mu.Unlock()
|
||||
}
|
||||
|
||||
type (
|
||||
@@ -135,9 +130,9 @@ func (tx *Tx) Rollback() error {
|
||||
var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error {
|
||||
return txDriver.tx.Rollback()
|
||||
})
|
||||
tx.mu.Lock()
|
||||
hooks := append([]RollbackHook(nil), tx.onRollback...)
|
||||
tx.mu.Unlock()
|
||||
txDriver.mu.Lock()
|
||||
hooks := append([]RollbackHook(nil), txDriver.onRollback...)
|
||||
txDriver.mu.Unlock()
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
fn = hooks[i](fn)
|
||||
}
|
||||
@@ -146,9 +141,10 @@ func (tx *Tx) Rollback() error {
|
||||
|
||||
// OnRollback adds a hook to call on rollback.
|
||||
func (tx *Tx) OnRollback(f RollbackHook) {
|
||||
tx.mu.Lock()
|
||||
defer tx.mu.Unlock()
|
||||
tx.onRollback = append(tx.onRollback, f)
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
txDriver.mu.Lock()
|
||||
txDriver.onRollback = append(txDriver.onRollback, f)
|
||||
txDriver.mu.Unlock()
|
||||
}
|
||||
|
||||
// Client returns a Client that binds to current transaction.
|
||||
@@ -186,6 +182,10 @@ type txDriver struct {
|
||||
drv dialect.Driver
|
||||
// tx is the underlying transaction.
|
||||
tx dialect.Tx
|
||||
// completion hooks.
|
||||
mu sync.Mutex
|
||||
onCommit []CommitHook
|
||||
onRollback []RollbackHook
|
||||
}
|
||||
|
||||
// newTx creates a new transactional driver.
|
||||
@@ -216,12 +216,12 @@ func (*txDriver) Commit() error { return nil }
|
||||
func (*txDriver) Rollback() error { return nil }
|
||||
|
||||
// Exec calls tx.Exec.
|
||||
func (tx *txDriver) Exec(ctx context.Context, query string, args, v interface{}) error {
|
||||
func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Exec(ctx, query, args, v)
|
||||
}
|
||||
|
||||
// Query calls tx.Query.
|
||||
func (tx *txDriver) Query(ctx context.Context, query string, args, v interface{}) error {
|
||||
func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Query(ctx, query, args, v)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/weapon"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
)
|
||||
|
||||
// Weapon is the model entity for the Weapon schema.
|
||||
@@ -28,6 +29,7 @@ type Weapon struct {
|
||||
// The values are being populated by the WeaponQuery when eager-loading is set.
|
||||
Edges WeaponEdges `json:"edges"`
|
||||
match_player_weapon_stats *int
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// WeaponEdges holds the relations/edges for other nodes in the graph.
|
||||
@@ -42,20 +44,17 @@ type WeaponEdges struct {
|
||||
// StatOrErr returns the Stat value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
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.
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
if e.Stat != nil {
|
||||
return e.Stat, nil
|
||||
} else if e.loadedTypes[0] {
|
||||
return nil, &NotFoundError{label: matchplayer.Label}
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "stat"}
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Weapon) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Weapon) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case weapon.FieldID, weapon.FieldVictim, weapon.FieldDmg, weapon.FieldEqType, weapon.FieldHitGroup:
|
||||
@@ -63,7 +62,7 @@ func (*Weapon) scanValues(columns []string) ([]interface{}, error) {
|
||||
case weapon.ForeignKeys[0]: // match_player_weapon_stats
|
||||
values[i] = new(sql.NullInt64)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type Weapon", columns[i])
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
@@ -71,7 +70,7 @@ func (*Weapon) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Weapon fields.
|
||||
func (w *Weapon) assignValues(columns []string, values []interface{}) error {
|
||||
func (_m *Weapon) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
@@ -82,88 +81,93 @@ func (w *Weapon) assignValues(columns []string, values []interface{}) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
w.ID = int(value.Int64)
|
||||
_m.ID = int(value.Int64)
|
||||
case weapon.FieldVictim:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field victim", values[i])
|
||||
} else if value.Valid {
|
||||
w.Victim = uint64(value.Int64)
|
||||
_m.Victim = uint64(value.Int64)
|
||||
}
|
||||
case weapon.FieldDmg:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field dmg", values[i])
|
||||
} else if value.Valid {
|
||||
w.Dmg = uint(value.Int64)
|
||||
_m.Dmg = uint(value.Int64)
|
||||
}
|
||||
case weapon.FieldEqType:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field eq_type", values[i])
|
||||
} else if value.Valid {
|
||||
w.EqType = int(value.Int64)
|
||||
_m.EqType = int(value.Int64)
|
||||
}
|
||||
case weapon.FieldHitGroup:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hit_group", values[i])
|
||||
} else if value.Valid {
|
||||
w.HitGroup = int(value.Int64)
|
||||
_m.HitGroup = int(value.Int64)
|
||||
}
|
||||
case weapon.ForeignKeys[0]:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for edge-field match_player_weapon_stats", value)
|
||||
} else if value.Valid {
|
||||
w.match_player_weapon_stats = new(int)
|
||||
*w.match_player_weapon_stats = int(value.Int64)
|
||||
_m.match_player_weapon_stats = new(int)
|
||||
*_m.match_player_weapon_stats = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the Weapon.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *Weapon) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// QueryStat queries the "stat" edge of the Weapon entity.
|
||||
func (w *Weapon) QueryStat() *MatchPlayerQuery {
|
||||
return (&WeaponClient{config: w.config}).QueryStat(w)
|
||||
func (_m *Weapon) QueryStat() *MatchPlayerQuery {
|
||||
return NewWeaponClient(_m.config).QueryStat(_m)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this Weapon.
|
||||
// Note that you need to call Weapon.Unwrap() before calling this method if this Weapon
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (w *Weapon) Update() *WeaponUpdateOne {
|
||||
return (&WeaponClient{config: w.config}).UpdateOne(w)
|
||||
func (_m *Weapon) Update() *WeaponUpdateOne {
|
||||
return NewWeaponClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// 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)
|
||||
func (_m *Weapon) Unwrap() *Weapon {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: Weapon is not a transactional entity")
|
||||
}
|
||||
w.config.driver = tx.drv
|
||||
return w
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (w *Weapon) String() string {
|
||||
func (_m *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("%v", w.Victim))
|
||||
builder.WriteString(", dmg=")
|
||||
builder.WriteString(fmt.Sprintf("%v", w.Dmg))
|
||||
builder.WriteString(", eq_type=")
|
||||
builder.WriteString(fmt.Sprintf("%v", w.EqType))
|
||||
builder.WriteString(", hit_group=")
|
||||
builder.WriteString(fmt.Sprintf("%v", w.HitGroup))
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("victim=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Victim))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("dmg=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Dmg))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("eq_type=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.EqType))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hit_group=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.HitGroup))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Weapons is a parsable slice of Weapon.
|
||||
type Weapons []*Weapon
|
||||
|
||||
func (w Weapons) config(cfg config) {
|
||||
for _i := range w {
|
||||
w[_i].config = cfg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package weapon
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the weapon type in the database.
|
||||
Label = "weapon"
|
||||
@@ -57,3 +62,45 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Weapon queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVictim orders the results by the victim field.
|
||||
func ByVictim(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVictim, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDmg orders the results by the dmg field.
|
||||
func ByDmg(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDmg, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEqType orders the results by the eq_type field.
|
||||
func ByEqType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEqType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHitGroup orders the results by the hit_group field.
|
||||
func ByHitGroup(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHitGroup, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatField orders the results by stat field.
|
||||
func ByStatField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newStatStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newStatStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, StatTable, StatColumn),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,427 +1,236 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package weapon
|
||||
|
||||
import (
|
||||
"csgowtfd/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// 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]
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Victim applies equality check predicate on the "victim" field. It's identical to VictimEQ.
|
||||
func Victim(v uint64) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldVictim), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldVictim, v))
|
||||
}
|
||||
|
||||
// Dmg applies equality check predicate on the "dmg" field. It's identical to DmgEQ.
|
||||
func Dmg(v uint) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldDmg), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldDmg, v))
|
||||
}
|
||||
|
||||
// EqType applies equality check predicate on the "eq_type" field. It's identical to EqTypeEQ.
|
||||
func EqType(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldEqType), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldEqType, v))
|
||||
}
|
||||
|
||||
// HitGroup applies equality check predicate on the "hit_group" field. It's identical to HitGroupEQ.
|
||||
func HitGroup(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldHitGroup), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldHitGroup, v))
|
||||
}
|
||||
|
||||
// VictimEQ applies the EQ predicate on the "victim" field.
|
||||
func VictimEQ(v uint64) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldVictim), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldVictim, v))
|
||||
}
|
||||
|
||||
// VictimNEQ applies the NEQ predicate on the "victim" field.
|
||||
func VictimNEQ(v uint64) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldVictim), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNEQ(FieldVictim, v))
|
||||
}
|
||||
|
||||
// VictimIn applies the In predicate on the "victim" field.
|
||||
func VictimIn(vs ...uint64) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldIn(FieldVictim, vs...))
|
||||
}
|
||||
|
||||
// VictimNotIn applies the NotIn predicate on the "victim" field.
|
||||
func VictimNotIn(vs ...uint64) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNotIn(FieldVictim, vs...))
|
||||
}
|
||||
|
||||
// VictimGT applies the GT predicate on the "victim" field.
|
||||
func VictimGT(v uint64) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldVictim), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGT(FieldVictim, v))
|
||||
}
|
||||
|
||||
// VictimGTE applies the GTE predicate on the "victim" field.
|
||||
func VictimGTE(v uint64) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldVictim), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGTE(FieldVictim, v))
|
||||
}
|
||||
|
||||
// VictimLT applies the LT predicate on the "victim" field.
|
||||
func VictimLT(v uint64) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldVictim), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLT(FieldVictim, v))
|
||||
}
|
||||
|
||||
// VictimLTE applies the LTE predicate on the "victim" field.
|
||||
func VictimLTE(v uint64) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldVictim), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLTE(FieldVictim, v))
|
||||
}
|
||||
|
||||
// DmgEQ applies the EQ predicate on the "dmg" field.
|
||||
func DmgEQ(v uint) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldDmg), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldDmg, v))
|
||||
}
|
||||
|
||||
// DmgNEQ applies the NEQ predicate on the "dmg" field.
|
||||
func DmgNEQ(v uint) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldDmg), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNEQ(FieldDmg, v))
|
||||
}
|
||||
|
||||
// DmgIn applies the In predicate on the "dmg" field.
|
||||
func DmgIn(vs ...uint) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldIn(FieldDmg, vs...))
|
||||
}
|
||||
|
||||
// DmgNotIn applies the NotIn predicate on the "dmg" field.
|
||||
func DmgNotIn(vs ...uint) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNotIn(FieldDmg, vs...))
|
||||
}
|
||||
|
||||
// DmgGT applies the GT predicate on the "dmg" field.
|
||||
func DmgGT(v uint) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldDmg), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGT(FieldDmg, v))
|
||||
}
|
||||
|
||||
// DmgGTE applies the GTE predicate on the "dmg" field.
|
||||
func DmgGTE(v uint) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldDmg), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGTE(FieldDmg, v))
|
||||
}
|
||||
|
||||
// DmgLT applies the LT predicate on the "dmg" field.
|
||||
func DmgLT(v uint) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldDmg), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLT(FieldDmg, v))
|
||||
}
|
||||
|
||||
// DmgLTE applies the LTE predicate on the "dmg" field.
|
||||
func DmgLTE(v uint) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldDmg), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLTE(FieldDmg, v))
|
||||
}
|
||||
|
||||
// EqTypeEQ applies the EQ predicate on the "eq_type" field.
|
||||
func EqTypeEQ(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldEqType), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldEqType, v))
|
||||
}
|
||||
|
||||
// EqTypeNEQ applies the NEQ predicate on the "eq_type" field.
|
||||
func EqTypeNEQ(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldEqType), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNEQ(FieldEqType, v))
|
||||
}
|
||||
|
||||
// EqTypeIn applies the In predicate on the "eq_type" field.
|
||||
func EqTypeIn(vs ...int) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldIn(FieldEqType, vs...))
|
||||
}
|
||||
|
||||
// EqTypeNotIn applies the NotIn predicate on the "eq_type" field.
|
||||
func EqTypeNotIn(vs ...int) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNotIn(FieldEqType, vs...))
|
||||
}
|
||||
|
||||
// EqTypeGT applies the GT predicate on the "eq_type" field.
|
||||
func EqTypeGT(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldEqType), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGT(FieldEqType, v))
|
||||
}
|
||||
|
||||
// EqTypeGTE applies the GTE predicate on the "eq_type" field.
|
||||
func EqTypeGTE(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldEqType), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGTE(FieldEqType, v))
|
||||
}
|
||||
|
||||
// EqTypeLT applies the LT predicate on the "eq_type" field.
|
||||
func EqTypeLT(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldEqType), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLT(FieldEqType, v))
|
||||
}
|
||||
|
||||
// EqTypeLTE applies the LTE predicate on the "eq_type" field.
|
||||
func EqTypeLTE(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldEqType), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLTE(FieldEqType, v))
|
||||
}
|
||||
|
||||
// HitGroupEQ applies the EQ predicate on the "hit_group" field.
|
||||
func HitGroupEQ(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldHitGroup), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldEQ(FieldHitGroup, v))
|
||||
}
|
||||
|
||||
// HitGroupNEQ applies the NEQ predicate on the "hit_group" field.
|
||||
func HitGroupNEQ(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldHitGroup), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNEQ(FieldHitGroup, v))
|
||||
}
|
||||
|
||||
// HitGroupIn applies the In predicate on the "hit_group" field.
|
||||
func HitGroupIn(vs ...int) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldIn(FieldHitGroup, vs...))
|
||||
}
|
||||
|
||||
// HitGroupNotIn applies the NotIn predicate on the "hit_group" field.
|
||||
func HitGroupNotIn(vs ...int) predicate.Weapon {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
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...))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldNotIn(FieldHitGroup, vs...))
|
||||
}
|
||||
|
||||
// HitGroupGT applies the GT predicate on the "hit_group" field.
|
||||
func HitGroupGT(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldHitGroup), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGT(FieldHitGroup, v))
|
||||
}
|
||||
|
||||
// HitGroupGTE applies the GTE predicate on the "hit_group" field.
|
||||
func HitGroupGTE(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldHitGroup), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldGTE(FieldHitGroup, v))
|
||||
}
|
||||
|
||||
// HitGroupLT applies the LT predicate on the "hit_group" field.
|
||||
func HitGroupLT(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldHitGroup), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLT(FieldHitGroup, v))
|
||||
}
|
||||
|
||||
// HitGroupLTE applies the LTE predicate on the "hit_group" field.
|
||||
func HitGroupLTE(v int) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldHitGroup), v))
|
||||
})
|
||||
return predicate.Weapon(sql.FieldLTE(FieldHitGroup, v))
|
||||
}
|
||||
|
||||
// HasStat applies the HasEdge predicate on the "stat" edge.
|
||||
@@ -429,7 +238,6 @@ func HasStat() predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, StatTable, StatColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
@@ -439,11 +247,7 @@ func HasStat() predicate.Weapon {
|
||||
// HasStatWith applies the HasEdge predicate on the "stat" edge with a given conditions (other predicates).
|
||||
func HasStatWith(preds ...predicate.MatchPlayer) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StatInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, StatTable, StatColumn),
|
||||
)
|
||||
step := newStatStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
@@ -454,32 +258,15 @@ func HasStatWith(preds ...predicate.MatchPlayer) predicate.Weapon {
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Weapon) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for _, p := range predicates {
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Weapon(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Weapon) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
s1 := s.Clone().SetP(nil)
|
||||
for i, p := range predicates {
|
||||
if i > 0 {
|
||||
s1.Or()
|
||||
}
|
||||
p(s1)
|
||||
}
|
||||
s.Where(s1.P())
|
||||
})
|
||||
return predicate.Weapon(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Weapon) predicate.Weapon {
|
||||
return predicate.Weapon(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
return predicate.Weapon(sql.NotPredicates(p))
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/weapon"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
)
|
||||
|
||||
// WeaponCreate is the builder for creating a Weapon entity.
|
||||
@@ -21,97 +21,61 @@ type WeaponCreate struct {
|
||||
}
|
||||
|
||||
// SetVictim sets the "victim" field.
|
||||
func (wc *WeaponCreate) SetVictim(u uint64) *WeaponCreate {
|
||||
wc.mutation.SetVictim(u)
|
||||
return wc
|
||||
func (_c *WeaponCreate) SetVictim(v uint64) *WeaponCreate {
|
||||
_c.mutation.SetVictim(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDmg sets the "dmg" field.
|
||||
func (wc *WeaponCreate) SetDmg(u uint) *WeaponCreate {
|
||||
wc.mutation.SetDmg(u)
|
||||
return wc
|
||||
func (_c *WeaponCreate) SetDmg(v uint) *WeaponCreate {
|
||||
_c.mutation.SetDmg(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetEqType sets the "eq_type" field.
|
||||
func (wc *WeaponCreate) SetEqType(i int) *WeaponCreate {
|
||||
wc.mutation.SetEqType(i)
|
||||
return wc
|
||||
func (_c *WeaponCreate) SetEqType(v int) *WeaponCreate {
|
||||
_c.mutation.SetEqType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHitGroup sets the "hit_group" field.
|
||||
func (wc *WeaponCreate) SetHitGroup(i int) *WeaponCreate {
|
||||
wc.mutation.SetHitGroup(i)
|
||||
return wc
|
||||
func (_c *WeaponCreate) SetHitGroup(v int) *WeaponCreate {
|
||||
_c.mutation.SetHitGroup(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetStatID sets the "stat" edge to the MatchPlayer entity by ID.
|
||||
func (wc *WeaponCreate) SetStatID(id int) *WeaponCreate {
|
||||
wc.mutation.SetStatID(id)
|
||||
return wc
|
||||
func (_c *WeaponCreate) SetStatID(id int) *WeaponCreate {
|
||||
_c.mutation.SetStatID(id)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableStatID sets the "stat" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (wc *WeaponCreate) SetNillableStatID(id *int) *WeaponCreate {
|
||||
func (_c *WeaponCreate) SetNillableStatID(id *int) *WeaponCreate {
|
||||
if id != nil {
|
||||
wc = wc.SetStatID(*id)
|
||||
_c = _c.SetStatID(*id)
|
||||
}
|
||||
return wc
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetStat sets the "stat" edge to the MatchPlayer entity.
|
||||
func (wc *WeaponCreate) SetStat(m *MatchPlayer) *WeaponCreate {
|
||||
return wc.SetStatID(m.ID)
|
||||
func (_c *WeaponCreate) SetStat(v *MatchPlayer) *WeaponCreate {
|
||||
return _c.SetStatID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the WeaponMutation object of the builder.
|
||||
func (wc *WeaponCreate) Mutation() *WeaponMutation {
|
||||
return wc.mutation
|
||||
func (_c *WeaponCreate) Mutation() *WeaponMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the Weapon in the database.
|
||||
func (wc *WeaponCreate) Save(ctx context.Context) (*Weapon, error) {
|
||||
var (
|
||||
err error
|
||||
node *Weapon
|
||||
)
|
||||
if len(wc.hooks) == 0 {
|
||||
if err = wc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = wc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*WeaponMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = wc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
wc.mutation = mutation
|
||||
if node, err = wc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(wc.hooks) - 1; i >= 0; i-- {
|
||||
if wc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = wc.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, wc.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_c *WeaponCreate) Save(ctx context.Context) (*Weapon, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (wc *WeaponCreate) SaveX(ctx context.Context) *Weapon {
|
||||
v, err := wc.Save(ctx)
|
||||
func (_c *WeaponCreate) SaveX(ctx context.Context) *Weapon {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -119,92 +83,75 @@ func (wc *WeaponCreate) SaveX(ctx context.Context) *Weapon {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (wc *WeaponCreate) Exec(ctx context.Context) error {
|
||||
_, err := wc.Save(ctx)
|
||||
func (_c *WeaponCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wc *WeaponCreate) ExecX(ctx context.Context) {
|
||||
if err := wc.Exec(ctx); err != nil {
|
||||
func (_c *WeaponCreate) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (wc *WeaponCreate) check() error {
|
||||
if _, ok := wc.mutation.Victim(); !ok {
|
||||
func (_c *WeaponCreate) check() error {
|
||||
if _, ok := _c.mutation.Victim(); !ok {
|
||||
return &ValidationError{Name: "victim", err: errors.New(`ent: missing required field "Weapon.victim"`)}
|
||||
}
|
||||
if _, ok := wc.mutation.Dmg(); !ok {
|
||||
if _, ok := _c.mutation.Dmg(); !ok {
|
||||
return &ValidationError{Name: "dmg", err: errors.New(`ent: missing required field "Weapon.dmg"`)}
|
||||
}
|
||||
if _, ok := wc.mutation.EqType(); !ok {
|
||||
if _, ok := _c.mutation.EqType(); !ok {
|
||||
return &ValidationError{Name: "eq_type", err: errors.New(`ent: missing required field "Weapon.eq_type"`)}
|
||||
}
|
||||
if _, ok := wc.mutation.HitGroup(); !ok {
|
||||
if _, ok := _c.mutation.HitGroup(); !ok {
|
||||
return &ValidationError{Name: "hit_group", err: errors.New(`ent: missing required field "Weapon.hit_group"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (wc *WeaponCreate) sqlSave(ctx context.Context) (*Weapon, error) {
|
||||
_node, _spec := wc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, wc.driver, _spec); err != nil {
|
||||
func (_c *WeaponCreate) sqlSave(ctx context.Context) (*Weapon, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int(id)
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (wc *WeaponCreate) createSpec() (*Weapon, *sqlgraph.CreateSpec) {
|
||||
func (_c *WeaponCreate) createSpec() (*Weapon, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &Weapon{config: wc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: weapon.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
}
|
||||
_node = &Weapon{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(weapon.Table, sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt))
|
||||
)
|
||||
if value, ok := wc.mutation.Victim(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Value: value,
|
||||
Column: weapon.FieldVictim,
|
||||
})
|
||||
if value, ok := _c.mutation.Victim(); ok {
|
||||
_spec.SetField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
_node.Victim = value
|
||||
}
|
||||
if value, ok := wc.mutation.Dmg(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: weapon.FieldDmg,
|
||||
})
|
||||
if value, ok := _c.mutation.Dmg(); ok {
|
||||
_spec.SetField(weapon.FieldDmg, field.TypeUint, value)
|
||||
_node.Dmg = value
|
||||
}
|
||||
if value, ok := wc.mutation.EqType(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldEqType,
|
||||
})
|
||||
if value, ok := _c.mutation.EqType(); ok {
|
||||
_spec.SetField(weapon.FieldEqType, field.TypeInt, value)
|
||||
_node.EqType = value
|
||||
}
|
||||
if value, ok := wc.mutation.HitGroup(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldHitGroup,
|
||||
})
|
||||
if value, ok := _c.mutation.HitGroup(); ok {
|
||||
_spec.SetField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
_node.HitGroup = value
|
||||
}
|
||||
if nodes := wc.mutation.StatIDs(); len(nodes) > 0 {
|
||||
if nodes := _c.mutation.StatIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -212,10 +159,7 @@ func (wc *WeaponCreate) createSpec() (*Weapon, *sqlgraph.CreateSpec) {
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -230,17 +174,21 @@ func (wc *WeaponCreate) createSpec() (*Weapon, *sqlgraph.CreateSpec) {
|
||||
// WeaponCreateBulk is the builder for creating many Weapon entities in bulk.
|
||||
type WeaponCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*WeaponCreate
|
||||
}
|
||||
|
||||
// Save creates the Weapon entities in the database.
|
||||
func (wcb *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) {
|
||||
specs := make([]*sqlgraph.CreateSpec, len(wcb.builders))
|
||||
nodes := make([]*Weapon, len(wcb.builders))
|
||||
mutators := make([]Mutator, len(wcb.builders))
|
||||
for i := range wcb.builders {
|
||||
func (_c *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*Weapon, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := wcb.builders[i]
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*WeaponMutation)
|
||||
if !ok {
|
||||
@@ -250,16 +198,16 @@ func (wcb *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, wcb.builders[i+1].mutation)
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, wcb.driver, spec); err != nil {
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{err.Error(), err}
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,11 +215,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-- {
|
||||
@@ -281,7 +229,7 @@ func (wcb *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) {
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, wcb.builders[0].mutation); err != nil {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -289,8 +237,8 @@ func (wcb *WeaponCreateBulk) Save(ctx context.Context) ([]*Weapon, error) {
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (wcb *WeaponCreateBulk) SaveX(ctx context.Context) []*Weapon {
|
||||
v, err := wcb.Save(ctx)
|
||||
func (_c *WeaponCreateBulk) SaveX(ctx context.Context) []*Weapon {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -298,14 +246,14 @@ func (wcb *WeaponCreateBulk) SaveX(ctx context.Context) []*Weapon {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (wcb *WeaponCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := wcb.Save(ctx)
|
||||
func (_c *WeaponCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wcb *WeaponCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := wcb.Exec(ctx); err != nil {
|
||||
func (_c *WeaponCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/weapon"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
)
|
||||
|
||||
// WeaponDelete is the builder for deleting a Weapon entity.
|
||||
@@ -21,80 +20,56 @@ type WeaponDelete struct {
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the WeaponDelete builder.
|
||||
func (wd *WeaponDelete) Where(ps ...predicate.Weapon) *WeaponDelete {
|
||||
wd.mutation.Where(ps...)
|
||||
return wd
|
||||
func (_d *WeaponDelete) Where(ps ...predicate.Weapon) *WeaponDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (wd *WeaponDelete) Exec(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(wd.hooks) == 0 {
|
||||
affected, err = wd.sqlExec(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*WeaponMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
wd.mutation = mutation
|
||||
affected, err = wd.sqlExec(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(wd.hooks) - 1; i >= 0; i-- {
|
||||
if wd.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = wd.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, wd.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_d *WeaponDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wd *WeaponDelete) ExecX(ctx context.Context) int {
|
||||
n, err := wd.Exec(ctx)
|
||||
func (_d *WeaponDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (wd *WeaponDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := &sqlgraph.DeleteSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: weapon.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := wd.mutation.predicates; len(ps) > 0 {
|
||||
func (_d *WeaponDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(weapon.Table, sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlgraph.DeleteNodes(ctx, wd.driver, _spec)
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// WeaponDeleteOne is the builder for deleting a single Weapon entity.
|
||||
type WeaponDeleteOne struct {
|
||||
wd *WeaponDelete
|
||||
_d *WeaponDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the WeaponDelete builder.
|
||||
func (_d *WeaponDeleteOne) Where(ps ...predicate.Weapon) *WeaponDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (wdo *WeaponDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := wdo.wd.Exec(ctx)
|
||||
func (_d *WeaponDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
@@ -106,6 +81,8 @@ func (wdo *WeaponDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wdo *WeaponDeleteOne) ExecX(ctx context.Context) {
|
||||
wdo.wd.ExecX(ctx)
|
||||
func (_d *WeaponDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,150 +1,156 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/predicate"
|
||||
"csgowtfd/ent/weapon"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/predicate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
)
|
||||
|
||||
// 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.
|
||||
func (wu *WeaponUpdate) Where(ps ...predicate.Weapon) *WeaponUpdate {
|
||||
wu.mutation.Where(ps...)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) Where(ps ...predicate.Weapon) *WeaponUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetVictim sets the "victim" field.
|
||||
func (wu *WeaponUpdate) SetVictim(u uint64) *WeaponUpdate {
|
||||
wu.mutation.ResetVictim()
|
||||
wu.mutation.SetVictim(u)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetVictim(v uint64) *WeaponUpdate {
|
||||
_u.mutation.ResetVictim()
|
||||
_u.mutation.SetVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds u to the "victim" field.
|
||||
func (wu *WeaponUpdate) AddVictim(u int64) *WeaponUpdate {
|
||||
wu.mutation.AddVictim(u)
|
||||
return wu
|
||||
// SetNillableVictim sets the "victim" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableVictim(v *uint64) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetVictim(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds value to the "victim" field.
|
||||
func (_u *WeaponUpdate) AddVictim(v int64) *WeaponUpdate {
|
||||
_u.mutation.AddVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDmg sets the "dmg" field.
|
||||
func (wu *WeaponUpdate) SetDmg(u uint) *WeaponUpdate {
|
||||
wu.mutation.ResetDmg()
|
||||
wu.mutation.SetDmg(u)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetDmg(v uint) *WeaponUpdate {
|
||||
_u.mutation.ResetDmg()
|
||||
_u.mutation.SetDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds u to the "dmg" field.
|
||||
func (wu *WeaponUpdate) AddDmg(u int) *WeaponUpdate {
|
||||
wu.mutation.AddDmg(u)
|
||||
return wu
|
||||
// SetNillableDmg sets the "dmg" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableDmg(v *uint) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetDmg(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds value to the "dmg" field.
|
||||
func (_u *WeaponUpdate) AddDmg(v int) *WeaponUpdate {
|
||||
_u.mutation.AddDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEqType sets the "eq_type" field.
|
||||
func (wu *WeaponUpdate) SetEqType(i int) *WeaponUpdate {
|
||||
wu.mutation.ResetEqType()
|
||||
wu.mutation.SetEqType(i)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetEqType(v int) *WeaponUpdate {
|
||||
_u.mutation.ResetEqType()
|
||||
_u.mutation.SetEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds i to the "eq_type" field.
|
||||
func (wu *WeaponUpdate) AddEqType(i int) *WeaponUpdate {
|
||||
wu.mutation.AddEqType(i)
|
||||
return wu
|
||||
// SetNillableEqType sets the "eq_type" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableEqType(v *int) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetEqType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds value to the "eq_type" field.
|
||||
func (_u *WeaponUpdate) AddEqType(v int) *WeaponUpdate {
|
||||
_u.mutation.AddEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHitGroup sets the "hit_group" field.
|
||||
func (wu *WeaponUpdate) SetHitGroup(i int) *WeaponUpdate {
|
||||
wu.mutation.ResetHitGroup()
|
||||
wu.mutation.SetHitGroup(i)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetHitGroup(v int) *WeaponUpdate {
|
||||
_u.mutation.ResetHitGroup()
|
||||
_u.mutation.SetHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds i to the "hit_group" field.
|
||||
func (wu *WeaponUpdate) AddHitGroup(i int) *WeaponUpdate {
|
||||
wu.mutation.AddHitGroup(i)
|
||||
return wu
|
||||
// SetNillableHitGroup sets the "hit_group" field if the given value is not nil.
|
||||
func (_u *WeaponUpdate) SetNillableHitGroup(v *int) *WeaponUpdate {
|
||||
if v != nil {
|
||||
_u.SetHitGroup(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds value to the "hit_group" field.
|
||||
func (_u *WeaponUpdate) AddHitGroup(v int) *WeaponUpdate {
|
||||
_u.mutation.AddHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatID sets the "stat" edge to the MatchPlayer entity by ID.
|
||||
func (wu *WeaponUpdate) SetStatID(id int) *WeaponUpdate {
|
||||
wu.mutation.SetStatID(id)
|
||||
return wu
|
||||
func (_u *WeaponUpdate) SetStatID(id int) *WeaponUpdate {
|
||||
_u.mutation.SetStatID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatID sets the "stat" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (wu *WeaponUpdate) SetNillableStatID(id *int) *WeaponUpdate {
|
||||
func (_u *WeaponUpdate) SetNillableStatID(id *int) *WeaponUpdate {
|
||||
if id != nil {
|
||||
wu = wu.SetStatID(*id)
|
||||
_u = _u.SetStatID(*id)
|
||||
}
|
||||
return wu
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStat sets the "stat" edge to the MatchPlayer entity.
|
||||
func (wu *WeaponUpdate) SetStat(m *MatchPlayer) *WeaponUpdate {
|
||||
return wu.SetStatID(m.ID)
|
||||
func (_u *WeaponUpdate) SetStat(v *MatchPlayer) *WeaponUpdate {
|
||||
return _u.SetStatID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the WeaponMutation object of the builder.
|
||||
func (wu *WeaponUpdate) Mutation() *WeaponMutation {
|
||||
return wu.mutation
|
||||
func (_u *WeaponUpdate) Mutation() *WeaponMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearStat clears the "stat" edge to the MatchPlayer entity.
|
||||
func (wu *WeaponUpdate) ClearStat() *WeaponUpdate {
|
||||
wu.mutation.ClearStat()
|
||||
return wu
|
||||
func (_u *WeaponUpdate) ClearStat() *WeaponUpdate {
|
||||
_u.mutation.ClearStat()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (wu *WeaponUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
if len(wu.hooks) == 0 {
|
||||
affected, err = wu.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*WeaponMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
wu.mutation = mutation
|
||||
affected, err = wu.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(wu.hooks) - 1; i >= 0; i-- {
|
||||
if wu.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = wu.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, wu.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
func (_u *WeaponUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (wu *WeaponUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := wu.Save(ctx)
|
||||
func (_u *WeaponUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -152,93 +158,58 @@ func (wu *WeaponUpdate) SaveX(ctx context.Context) int {
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (wu *WeaponUpdate) Exec(ctx context.Context) error {
|
||||
_, err := wu.Save(ctx)
|
||||
func (_u *WeaponUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wu *WeaponUpdate) ExecX(ctx context.Context) {
|
||||
if err := wu.Exec(ctx); err != nil {
|
||||
func (_u *WeaponUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: weapon.Table,
|
||||
Columns: weapon.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
if ps := wu.mutation.predicates; len(ps) > 0 {
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *WeaponUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdate {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *WeaponUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(weapon.Table, weapon.Columns, sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := wu.mutation.Victim(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Value: value,
|
||||
Column: weapon.FieldVictim,
|
||||
})
|
||||
if value, ok := _u.mutation.Victim(); ok {
|
||||
_spec.SetField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedVictim(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Value: value,
|
||||
Column: weapon.FieldVictim,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedVictim(); ok {
|
||||
_spec.AddField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wu.mutation.Dmg(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: weapon.FieldDmg,
|
||||
})
|
||||
if value, ok := _u.mutation.Dmg(); ok {
|
||||
_spec.SetField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedDmg(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: weapon.FieldDmg,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedDmg(); ok {
|
||||
_spec.AddField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wu.mutation.EqType(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldEqType,
|
||||
})
|
||||
if value, ok := _u.mutation.EqType(); ok {
|
||||
_spec.SetField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedEqType(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldEqType,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedEqType(); ok {
|
||||
_spec.AddField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wu.mutation.HitGroup(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldHitGroup,
|
||||
})
|
||||
if value, ok := _u.mutation.HitGroup(); ok {
|
||||
_spec.SetField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wu.mutation.AddedHitGroup(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldHitGroup,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedHitGroup(); ok {
|
||||
_spec.AddField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if wu.mutation.StatCleared() {
|
||||
if _u.mutation.StatCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -246,15 +217,12 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := wu.mutation.StatIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.StatIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -262,10 +230,7 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -273,149 +238,163 @@ func (wu *WeaponUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, wu.driver, _spec); err != nil {
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.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
|
||||
}
|
||||
return n, nil
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (wuo *WeaponUpdateOne) SetVictim(u uint64) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetVictim()
|
||||
wuo.mutation.SetVictim(u)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetVictim(v uint64) *WeaponUpdateOne {
|
||||
_u.mutation.ResetVictim()
|
||||
_u.mutation.SetVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds u to the "victim" field.
|
||||
func (wuo *WeaponUpdateOne) AddVictim(u int64) *WeaponUpdateOne {
|
||||
wuo.mutation.AddVictim(u)
|
||||
return wuo
|
||||
// SetNillableVictim sets the "victim" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableVictim(v *uint64) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetVictim(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddVictim adds value to the "victim" field.
|
||||
func (_u *WeaponUpdateOne) AddVictim(v int64) *WeaponUpdateOne {
|
||||
_u.mutation.AddVictim(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDmg sets the "dmg" field.
|
||||
func (wuo *WeaponUpdateOne) SetDmg(u uint) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetDmg()
|
||||
wuo.mutation.SetDmg(u)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetDmg(v uint) *WeaponUpdateOne {
|
||||
_u.mutation.ResetDmg()
|
||||
_u.mutation.SetDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds u to the "dmg" field.
|
||||
func (wuo *WeaponUpdateOne) AddDmg(u int) *WeaponUpdateOne {
|
||||
wuo.mutation.AddDmg(u)
|
||||
return wuo
|
||||
// SetNillableDmg sets the "dmg" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableDmg(v *uint) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDmg(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDmg adds value to the "dmg" field.
|
||||
func (_u *WeaponUpdateOne) AddDmg(v int) *WeaponUpdateOne {
|
||||
_u.mutation.AddDmg(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEqType sets the "eq_type" field.
|
||||
func (wuo *WeaponUpdateOne) SetEqType(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetEqType()
|
||||
wuo.mutation.SetEqType(i)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetEqType(v int) *WeaponUpdateOne {
|
||||
_u.mutation.ResetEqType()
|
||||
_u.mutation.SetEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds i to the "eq_type" field.
|
||||
func (wuo *WeaponUpdateOne) AddEqType(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.AddEqType(i)
|
||||
return wuo
|
||||
// SetNillableEqType sets the "eq_type" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableEqType(v *int) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetEqType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddEqType adds value to the "eq_type" field.
|
||||
func (_u *WeaponUpdateOne) AddEqType(v int) *WeaponUpdateOne {
|
||||
_u.mutation.AddEqType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHitGroup sets the "hit_group" field.
|
||||
func (wuo *WeaponUpdateOne) SetHitGroup(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.ResetHitGroup()
|
||||
wuo.mutation.SetHitGroup(i)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetHitGroup(v int) *WeaponUpdateOne {
|
||||
_u.mutation.ResetHitGroup()
|
||||
_u.mutation.SetHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds i to the "hit_group" field.
|
||||
func (wuo *WeaponUpdateOne) AddHitGroup(i int) *WeaponUpdateOne {
|
||||
wuo.mutation.AddHitGroup(i)
|
||||
return wuo
|
||||
// SetNillableHitGroup sets the "hit_group" field if the given value is not nil.
|
||||
func (_u *WeaponUpdateOne) SetNillableHitGroup(v *int) *WeaponUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHitGroup(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHitGroup adds value to the "hit_group" field.
|
||||
func (_u *WeaponUpdateOne) AddHitGroup(v int) *WeaponUpdateOne {
|
||||
_u.mutation.AddHitGroup(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatID sets the "stat" edge to the MatchPlayer entity by ID.
|
||||
func (wuo *WeaponUpdateOne) SetStatID(id int) *WeaponUpdateOne {
|
||||
wuo.mutation.SetStatID(id)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) SetStatID(id int) *WeaponUpdateOne {
|
||||
_u.mutation.SetStatID(id)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatID sets the "stat" edge to the MatchPlayer entity by ID if the given value is not nil.
|
||||
func (wuo *WeaponUpdateOne) SetNillableStatID(id *int) *WeaponUpdateOne {
|
||||
func (_u *WeaponUpdateOne) SetNillableStatID(id *int) *WeaponUpdateOne {
|
||||
if id != nil {
|
||||
wuo = wuo.SetStatID(*id)
|
||||
_u = _u.SetStatID(*id)
|
||||
}
|
||||
return wuo
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStat sets the "stat" edge to the MatchPlayer entity.
|
||||
func (wuo *WeaponUpdateOne) SetStat(m *MatchPlayer) *WeaponUpdateOne {
|
||||
return wuo.SetStatID(m.ID)
|
||||
func (_u *WeaponUpdateOne) SetStat(v *MatchPlayer) *WeaponUpdateOne {
|
||||
return _u.SetStatID(v.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the WeaponMutation object of the builder.
|
||||
func (wuo *WeaponUpdateOne) Mutation() *WeaponMutation {
|
||||
return wuo.mutation
|
||||
func (_u *WeaponUpdateOne) Mutation() *WeaponMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// ClearStat clears the "stat" edge to the MatchPlayer entity.
|
||||
func (wuo *WeaponUpdateOne) ClearStat() *WeaponUpdateOne {
|
||||
wuo.mutation.ClearStat()
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) ClearStat() *WeaponUpdateOne {
|
||||
_u.mutation.ClearStat()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the WeaponUpdate builder.
|
||||
func (_u *WeaponUpdateOne) Where(ps ...predicate.Weapon) *WeaponUpdateOne {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (wuo *WeaponUpdateOne) Select(field string, fields ...string) *WeaponUpdateOne {
|
||||
wuo.fields = append([]string{field}, fields...)
|
||||
return wuo
|
||||
func (_u *WeaponUpdateOne) Select(field string, fields ...string) *WeaponUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated Weapon entity.
|
||||
func (wuo *WeaponUpdateOne) Save(ctx context.Context) (*Weapon, error) {
|
||||
var (
|
||||
err error
|
||||
node *Weapon
|
||||
)
|
||||
if len(wuo.hooks) == 0 {
|
||||
node, err = wuo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*WeaponMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
wuo.mutation = mutation
|
||||
node, err = wuo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(wuo.hooks) - 1; i >= 0; i-- {
|
||||
if wuo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = wuo.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, wuo.mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return node, err
|
||||
func (_u *WeaponUpdateOne) Save(ctx context.Context) (*Weapon, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (wuo *WeaponUpdateOne) SaveX(ctx context.Context) *Weapon {
|
||||
node, err := wuo.Save(ctx)
|
||||
func (_u *WeaponUpdateOne) SaveX(ctx context.Context) *Weapon {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -423,35 +402,32 @@ func (wuo *WeaponUpdateOne) SaveX(ctx context.Context) *Weapon {
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (wuo *WeaponUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := wuo.Save(ctx)
|
||||
func (_u *WeaponUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (wuo *WeaponUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := wuo.Exec(ctx); err != nil {
|
||||
func (_u *WeaponUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err error) {
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: weapon.Table,
|
||||
Columns: weapon.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: weapon.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
id, ok := wuo.mutation.ID()
|
||||
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
||||
func (_u *WeaponUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *WeaponUpdateOne {
|
||||
_u.modifiers = append(_u.modifiers, modifiers...)
|
||||
return _u
|
||||
}
|
||||
|
||||
func (_u *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err error) {
|
||||
_spec := sqlgraph.NewUpdateSpec(weapon.Table, weapon.Columns, sqlgraph.NewFieldSpec(weapon.FieldID, field.TypeInt))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Weapon.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := wuo.fields; len(fields) > 0 {
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, weapon.FieldID)
|
||||
for _, f := range fields {
|
||||
@@ -463,70 +439,38 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := wuo.mutation.predicates; len(ps) > 0 {
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := wuo.mutation.Victim(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Value: value,
|
||||
Column: weapon.FieldVictim,
|
||||
})
|
||||
if value, ok := _u.mutation.Victim(); ok {
|
||||
_spec.SetField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedVictim(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Value: value,
|
||||
Column: weapon.FieldVictim,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedVictim(); ok {
|
||||
_spec.AddField(weapon.FieldVictim, field.TypeUint64, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.Dmg(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: weapon.FieldDmg,
|
||||
})
|
||||
if value, ok := _u.mutation.Dmg(); ok {
|
||||
_spec.SetField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedDmg(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint,
|
||||
Value: value,
|
||||
Column: weapon.FieldDmg,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedDmg(); ok {
|
||||
_spec.AddField(weapon.FieldDmg, field.TypeUint, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.EqType(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldEqType,
|
||||
})
|
||||
if value, ok := _u.mutation.EqType(); ok {
|
||||
_spec.SetField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedEqType(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldEqType,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedEqType(); ok {
|
||||
_spec.AddField(weapon.FieldEqType, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.HitGroup(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldHitGroup,
|
||||
})
|
||||
if value, ok := _u.mutation.HitGroup(); ok {
|
||||
_spec.SetField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := wuo.mutation.AddedHitGroup(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
Column: weapon.FieldHitGroup,
|
||||
})
|
||||
if value, ok := _u.mutation.AddedHitGroup(); ok {
|
||||
_spec.AddField(weapon.FieldHitGroup, field.TypeInt, value)
|
||||
}
|
||||
if wuo.mutation.StatCleared() {
|
||||
if _u.mutation.StatCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -534,15 +478,12 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||
}
|
||||
if nodes := wuo.mutation.StatIDs(); len(nodes) > 0 {
|
||||
if nodes := _u.mutation.StatIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
Inverse: true,
|
||||
@@ -550,10 +491,7 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
Columns: []string{weapon.StatColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: matchplayer.FieldID,
|
||||
},
|
||||
IDSpec: sqlgraph.NewFieldSpec(matchplayer.FieldID, field.TypeInt),
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
@@ -561,16 +499,18 @@ func (wuo *WeaponUpdateOne) sqlSave(ctx context.Context) (_node *Weapon, err err
|
||||
}
|
||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||
}
|
||||
_node = &Weapon{config: wuo.config}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
_node = &Weapon{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, wuo.driver, _spec); err != nil {
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.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 nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
120
go.mod
120
go.mod
@@ -1,64 +1,92 @@
|
||||
module csgowtfd
|
||||
module somegit.dev/csgowtf/csgowtfd
|
||||
|
||||
go 1.17
|
||||
go 1.24.6
|
||||
|
||||
require (
|
||||
entgo.io/ent v0.10.0
|
||||
github.com/an0nfunc/go-steam/v3 v3.0.6
|
||||
github.com/an0nfunc/go-steamapi v1.1.0
|
||||
github.com/go-redis/cache/v8 v8.4.3
|
||||
github.com/go-redis/redis/v8 v8.11.4
|
||||
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
|
||||
github.com/gorilla/handlers v1.5.1
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/jackc/pgx/v4 v4.14.1
|
||||
github.com/markus-wa/demoinfocs-golang/v2 v2.13.0
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3
|
||||
go.uber.org/ratelimit v0.2.0
|
||||
google.golang.org/protobuf v1.27.1
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
entgo.io/ent v0.14.5
|
||||
github.com/aclements/go-moremath v0.0.0-20241023150245-c8bbc672ef66
|
||||
github.com/an0nfunc/go-steam/v3 v3.1.1
|
||||
github.com/an0nfunc/go-steamapi v1.1.3
|
||||
github.com/gin-contrib/cors v1.7.6
|
||||
github.com/gin-gonic/gin v1.11.0
|
||||
github.com/go-redis/cache/v8 v8.4.4
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/golang/geo v0.0.0-20251020193347-f750d7aa221b
|
||||
github.com/jackc/pgx/v4 v4.18.3
|
||||
github.com/markus-wa/demoinfocs-golang/v5 v5.0.3
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sethvargo/go-retry v0.3.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117
|
||||
golang.org/x/text v0.30.0
|
||||
golang.org/x/time v0.14.0
|
||||
google.golang.org/protobuf v1.36.10
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
somegit.dev/anonfunc/gositemap v0.1.3
|
||||
)
|
||||
|
||||
require (
|
||||
ariga.io/atlas v0.3.2 // indirect
|
||||
ariga.io/atlas v0.37.0 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/bmatcuk/doublestar v1.3.4 // indirect
|
||||
github.com/bytedance/gopkg v0.1.3 // indirect
|
||||
github.com/bytedance/sonic v1.14.1 // indirect
|
||||
github.com/bytedance/sonic/loader v0.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.6 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/felixge/httpsnoop v1.0.2 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/google/go-cmp v0.5.7 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.11.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
||||
github.com/gin-contrib/sse v1.1.0 // indirect
|
||||
github.com/go-openapi/inflect v0.21.3 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.28.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/goccy/go-yaml v1.18.0 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.24.0 // indirect
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
|
||||
github.com/jackc/pgconn v1.10.1 // indirect
|
||||
github.com/jackc/pgconn v1.14.3 // 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/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
|
||||
github.com/jackc/pgtype v1.9.1 // indirect
|
||||
github.com/klauspost/compress v1.14.2 // indirect
|
||||
github.com/kr/pretty v0.2.0 // indirect
|
||||
github.com/markus-wa/go-unassert v0.1.2 // indirect
|
||||
github.com/markus-wa/gobitread v0.2.3 // indirect
|
||||
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/pgtype v1.14.4 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.18.1 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/markus-wa/go-unassert v0.1.3 // indirect
|
||||
github.com/markus-wa/gobitread v0.2.5-0.20241202000432-3c3e0bc797c6 // 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/markus-wa/quickhull-go/v2 v2.2.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/oklog/ulid/v2 v2.1.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.55.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.3.0 // indirect
|
||||
github.com/vmihailenco/go-tinylfu v0.2.2 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // 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-20220128200615-198e4374d7ed // indirect
|
||||
golang.org/x/exp v0.0.0-20220128181451-c853b6ddb95e // 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-20220128215802-99c3d69c2c27 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
github.com/zclconf/go-cty v1.17.0 // indirect
|
||||
github.com/zclconf/go-cty-yaml v1.1.0 // indirect
|
||||
go.uber.org/mock v0.6.0 // indirect
|
||||
golang.org/x/arch v0.22.0 // indirect
|
||||
golang.org/x/crypto v0.43.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
|
||||
golang.org/x/mod v0.29.0 // indirect
|
||||
golang.org/x/net v0.46.0 // indirect
|
||||
golang.org/x/sync v0.17.0 // indirect
|
||||
golang.org/x/sys v0.37.0 // indirect
|
||||
golang.org/x/tools v0.38.0 // indirect
|
||||
)
|
||||
|
||||
640
go.sum
640
go.sum
@@ -1,141 +1,92 @@
|
||||
ariga.io/atlas v0.3.2 h1:rE0OMGK08+5fg2Q8ukFkKSjygJx7pyH7UsJveCQ62Rw=
|
||||
ariga.io/atlas v0.3.2/go.mod h1:XcLUpQX7Cq4qtagEHIleq3MJaBeeJ76BS8doc4gkOJk=
|
||||
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.0 h1:9cBomE1fh+WX34DPYQL7tDNAIvhKa3tXvwxuLyhYCMo=
|
||||
entgo.io/ent v0.10.0/go.mod h1:5bjIYdTizykmdtPY3knXrrGpxAh0cMjFfxdNnlNiUGU=
|
||||
ariga.io/atlas v0.37.0 h1:MvbQ25CAHFslttEKEySwYNFrFUdLAPhtU1izOzjXV+o=
|
||||
ariga.io/atlas v0.37.0/go.mod h1:mHE83ptCxEkd3rO3c7Rvkk6Djf6mVhEiSVhoiNu96CI=
|
||||
entgo.io/ent v0.14.5 h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=
|
||||
entgo.io/ent v0.14.5/go.mod h1:zTzLmWtPvGpmSwtkaayM2cm5m819NdM7z7tYPq3vN0U=
|
||||
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=
|
||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
|
||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||
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/aclements/go-moremath v0.0.0-20241023150245-c8bbc672ef66 h1:siNQlUMcFUDZWCOt0p+RHl7et5Nnwwyq/sFZmr4iG1I=
|
||||
github.com/aclements/go-moremath v0.0.0-20241023150245-c8bbc672ef66/go.mod h1:FDw7qicTbJ1y1SZcNnOvym2BogPdC3lY9Z1iUM4MVhw=
|
||||
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=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/an0nfunc/go-steam/v3 v3.0.6 h1:HKkbSokGzoM5W+CsRlzOkmPayLgksW4UekmEaq98lRU=
|
||||
github.com/an0nfunc/go-steam/v3 v3.0.6/go.mod h1:HnlYcTVnAJbSlyzC5lxft9jQOu2mjTw8LHfN/bYuDEs=
|
||||
github.com/an0nfunc/go-steamapi v1.1.0 h1:sBOSAKO0zEmzKrkMX2bVhoFiErA+Gyx9hRl+7Bb9dCk=
|
||||
github.com/an0nfunc/go-steamapi v1.1.0/go.mod h1:tInHdrGkh0gaXuPnvhMG4BoW9S5gVcWOY9gJ9gCBKOI=
|
||||
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI=
|
||||
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129/go.mod h1:rFgpPQZYZ8vdbc+48xibu8ALc3yeyd64IhHS+PU6Yyg=
|
||||
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=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
|
||||
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
|
||||
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/an0nfunc/go-steam/v3 v3.1.1 h1:e87bnbsnEL28TIYxg06U3Bdyhg5BhZVbQVHz9WGaaag=
|
||||
github.com/an0nfunc/go-steam/v3 v3.1.1/go.mod h1:F9tAmlBGedlLdQkW12qqNTcZhDu1x0Cj07KRaXiC6AU=
|
||||
github.com/an0nfunc/go-steamapi v1.1.3 h1:xJSeaIcZoEmpRi24DZJ7zVxhiqBAoqzvYqF7FQUVlOQ=
|
||||
github.com/an0nfunc/go-steamapi v1.1.3/go.mod h1:76PULrtacpYOZF6WbddaU7aopPwwpBJDrMFPFNKokmI=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||
github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=
|
||||
github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
|
||||
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
|
||||
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
|
||||
github.com/bytedance/sonic v1.14.1 h1:FBMC0zVz5XUmE4z9wF4Jey0An5FueFvOsTKKKtwIl7w=
|
||||
github.com/bytedance/sonic v1.14.1/go.mod h1:gi6uhQLMbTdeP0muCnrjHLeCUPyb70ujhnNlhOylAFc=
|
||||
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
|
||||
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
|
||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
|
||||
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
|
||||
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
|
||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
|
||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU=
|
||||
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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=
|
||||
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
|
||||
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
|
||||
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
|
||||
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
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/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/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=
|
||||
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY=
|
||||
github.com/gin-contrib/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||
github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
|
||||
github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls=
|
||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||
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-openapi/inflect v0.21.3 h1:TmQvw+9eLrsNp4X0BBQacEZZtAnzk2z1FaLdQQJsDiU=
|
||||
github.com/go-openapi/inflect v0.21.3/go.mod h1:INezMuUu7SJQc2AyR3WO0DqqYUJSj8Kb4hBd7WtjlAw=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.28.0 h1:Q7ibns33JjyW48gHkuFT91qX48KG0ktULL6FgHdG688=
|
||||
github.com/go-playground/validator/v10 v10.28.0/go.mod h1:GoI6I1SjPBh9p7ykNE/yj3fFYbyDOpwMn5KXd+m2hUU=
|
||||
github.com/go-redis/cache/v8 v8.4.4 h1:Rm0wZ55X22BA2JMqVtRQNHYyzDd0I5f+Ec/C9Xx3mXY=
|
||||
github.com/go-redis/cache/v8 v8.4.4/go.mod h1:JM6CkupsPvAu/LYEVGQy6UB4WDAzQSXkR0lUCbeIcKc=
|
||||
github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc=
|
||||
github.com/go-redis/redis/v8 v8.11.4 h1:kHoYkfZP6+pe04aFTnhDH6GDROa5yJdHJVNxV3F46Tg=
|
||||
github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w=
|
||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
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.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
|
||||
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
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=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
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/geo v0.0.0-20251020193347-f750d7aa221b h1:cwGXba7hinTTzhlNQW2qbBqSktSP+KSvrKPbn3d7S0g=
|
||||
github.com/golang/geo v0.0.0-20251020193347-f750d7aa221b/go.mod h1:AN0OjM34c3PbjAsX+QNma1nYtJtRxl+s9MZNV7S+efw=
|
||||
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.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=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
@@ -144,60 +95,22 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
|
||||
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/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=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
||||
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
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.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
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=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
|
||||
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
|
||||
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||
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/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=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQxvE=
|
||||
github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
|
||||
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
|
||||
@@ -208,8 +121,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.10.1 h1:DzdIHIjG1AxGwoEEqS+mGsURyjt4enSmqzACXvVzOT8=
|
||||
github.com/jackc/pgconn v1.10.1/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
|
||||
github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w=
|
||||
github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM=
|
||||
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=
|
||||
@@ -225,427 +138,298 @@ 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/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
|
||||
github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag=
|
||||
github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
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.9.1 h1:MJc2s0MFS8C3ok1wQTdQxWuXQcB6+HwAm5x1CzW7mf0=
|
||||
github.com/jackc/pgtype v1.9.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
|
||||
github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
|
||||
github.com/jackc/pgtype v1.14.4 h1:fKuNiCumbKTAIxQwXfB/nsrnkEI6bPJrrSiMKgbJ2j8=
|
||||
github.com/jackc/pgtype v1.14.4/go.mod h1:aKeozOde08iifGosdJpz9MBZonJOUJxqNpPBcMJTlVA=
|
||||
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.14.1 h1:71oo1KAGI6mXhLiTMn6iDFcp3e7+zon/capWjl2OEFU=
|
||||
github.com/jackc/pgx/v4 v4.14.1/go.mod h1:RgDuE4Z34o7XE92RpLsvFiOEfrAUT0Xt2KxvX73W06M=
|
||||
github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw=
|
||||
github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA=
|
||||
github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw=
|
||||
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=
|
||||
github.com/jackc/puddle v1.2.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
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/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/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
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/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.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=
|
||||
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
|
||||
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
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=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
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/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
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 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
|
||||
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk=
|
||||
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.0 h1:WwmNt9BfYYlJb6xG3DFULAfj86/bHPn95MkAFsbfTgI=
|
||||
github.com/markus-wa/demoinfocs-golang/v2 v2.13.0/go.mod h1:2mL3quPmFnXa8WkrsQTEFUm/iDBuzq5I3AeJ6SsMIn4=
|
||||
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=
|
||||
github.com/markus-wa/gobitread v0.2.3/go.mod h1:PcWXMH4gx7o2CKslbkFkLyJB/aHW7JVRG3MRZe3PINg=
|
||||
github.com/markus-wa/demoinfocs-golang/v5 v5.0.3 h1:rgCboTLVZalfUW01hsJ249YpkbEdemPD83urls/uCTs=
|
||||
github.com/markus-wa/demoinfocs-golang/v5 v5.0.3/go.mod h1:TEsVblv03oy8at+VG+/DiDowTeTN5BiVmyL78kNesz8=
|
||||
github.com/markus-wa/go-unassert v0.1.3 h1:4N2fPLUS3929Rmkv94jbWskjsLiyNT2yQpCulTFFWfM=
|
||||
github.com/markus-wa/go-unassert v0.1.3/go.mod h1:/pqt7a0LRmdsRNYQ2nU3SGrXfw3bLXrvIkakY/6jpPY=
|
||||
github.com/markus-wa/gobitread v0.2.5-0.20241202000432-3c3e0bc797c6 h1:VNn0S4GFv6y2d2W4PGDs1eEfWPyEQbmld9QUFSsVILg=
|
||||
github.com/markus-wa/gobitread v0.2.5-0.20241202000432-3c3e0bc797c6/go.mod h1:PcWXMH4gx7o2CKslbkFkLyJB/aHW7JVRG3MRZe3PINg=
|
||||
github.com/markus-wa/godispatch v1.4.1 h1:Cdff5x33ShuX3sDmUbYWejk7tOuoHErFYMhUc2h7sLc=
|
||||
github.com/markus-wa/godispatch v1.4.1/go.mod h1:tk8L0yzLO4oAcFwM2sABMge0HRDJMdE8E7xm4gK/+xM=
|
||||
github.com/markus-wa/ice-cipher-go v0.0.0-20220126215401-a6adadccc817 h1:VB4ANo078mbGQNBgauLOzJkoHpIqrMygbPHVW0jjql0=
|
||||
github.com/markus-wa/ice-cipher-go v0.0.0-20220126215401-a6adadccc817/go.mod h1:JIsht5Oa9P50VnGJTvH2a6nkOqDFJbUeU1YRZYvdplw=
|
||||
github.com/markus-wa/quickhull-go/v2 v2.1.0 h1:DA2pzEzH0k5CEnlUsouRqNdD+jzNFb4DBhrX4Hpa5So=
|
||||
github.com/markus-wa/quickhull-go/v2 v2.1.0/go.mod h1:bOlBUpIzGSMMhHX0f9N8CQs0VZD4nnPeta0OocH7m4o=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/markus-wa/quickhull-go/v2 v2.2.0 h1:rB99NLYeUHoZQ/aNRcGOGqjNBGmrOaRxdtqTnsTUPTA=
|
||||
github.com/markus-wa/quickhull-go/v2 v2.2.0/go.mod h1:EuLMucfr4B+62eipXm335hOs23LTnO62W7Psn3qvU2k=
|
||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
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.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
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/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
|
||||
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
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=
|
||||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
|
||||
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
|
||||
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
|
||||
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
|
||||
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
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/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s=
|
||||
github.com/oklog/ulid/v2 v2.1.1/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ=
|
||||
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=
|
||||
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
|
||||
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
|
||||
github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c=
|
||||
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
|
||||
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
|
||||
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
|
||||
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
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/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=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
|
||||
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
|
||||
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
||||
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||
github.com/quic-go/quic-go v0.55.0 h1:zccPQIqYCXDt5NmcEabyYvOnomjs8Tlwl7tISjJh9Mk=
|
||||
github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8zUl5Ss1U=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
||||
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||
github.com/rs/zerolog v1.21.0/go.mod h1:ZPhntP/xmq1nnND05hhpAh2QMhSsA4UN3MGZ6O2J3hM=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
|
||||
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
|
||||
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/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
|
||||
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
|
||||
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=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
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/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/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
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/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
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/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
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/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
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/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
|
||||
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
|
||||
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=
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
|
||||
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
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/wercker/journalhook v0.0.0-20230927020745-64542ffa4117 h1:67A5tweHp3C7osHjrYsy6pQZ00bYkTTttZ7kiOwwHeA=
|
||||
github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg=
|
||||
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/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/zclconf/go-cty v1.17.0 h1:seZvECve6XX4tmnvRzWtJNHdscMtYEx5R7bnnVyd/d0=
|
||||
github.com/zclconf/go-cty v1.17.0/go.mod h1:wqFzcImaLTI6A5HfsRwB0nj5n0MRZFwmey8YoFPPs3U=
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
|
||||
github.com/zclconf/go-cty-yaml v1.1.0 h1:nP+jp0qPHv2IhUVqmQSzjvqAWcObN0KBkUl2rWBdig0=
|
||||
github.com/zclconf/go-cty-yaml v1.1.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs=
|
||||
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=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo=
|
||||
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
|
||||
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
|
||||
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
|
||||
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
|
||||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA=
|
||||
go.uber.org/ratelimit v0.2.0/go.mod h1:YYBV4e4naJvhpitQrWJu1vCpgB7CboMe0qhltKt6mUg=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
||||
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/arch v0.22.0 h1:c/Zle32i5ttqRXjdLyyHZESLD/bB90DCU1g9l/0YBDI=
|
||||
golang.org/x/arch v0.22.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
||||
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=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
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-20220128200615-198e4374d7ed h1:YoWVYYAfvQ4ddHv3OKmIvX7NCAhFGTj62VP2l2kfBbA=
|
||||
golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/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-20220128181451-c853b6ddb95e h1:FmsvSkPHPBTboKvYBUtHbHvkQGxq+XSrqPXKDQf2W3s=
|
||||
golang.org/x/exp v0.0.0-20220128181451-c853b6ddb95e/go.mod h1:M50CtfS+xv2iy/epuEazynj250ScQ0/DOjcsin9UE8k=
|
||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
||||
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=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
|
||||
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
|
||||
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
|
||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY=
|
||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
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/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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
|
||||
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
|
||||
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=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
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/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/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
|
||||
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
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/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/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
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=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
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-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo=
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/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-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
|
||||
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
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/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
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/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/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
|
||||
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
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.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
|
||||
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
|
||||
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=
|
||||
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
@@ -654,36 +438,26 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
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 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
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=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
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/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=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
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.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=
|
||||
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=
|
||||
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.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
|
||||
somegit.dev/anonfunc/gositemap v0.1.3 h1:3rsj+cejR6qdihXq6ZlFqwTDNefOXoSOYmvHrXkw+DE=
|
||||
somegit.dev/anonfunc/gositemap v0.1.3/go.mod h1:2v84uOYv0OQyfvQu9Fq1WI4zr/EjDOoxry5JrMZVEqo=
|
||||
|
||||
386
utils/utils.go
386
utils/utils.go
@@ -2,50 +2,52 @@ package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"csgowtfd/ent"
|
||||
"csgowtfd/ent/match"
|
||||
"csgowtfd/ent/matchplayer"
|
||||
"csgowtfd/ent/player"
|
||||
"csgowtfd/ent/roundstats"
|
||||
"csgowtfd/ent/spray"
|
||||
"csgowtfd/ent/weapon"
|
||||
"encoding/json"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/an0nfunc/go-steamapi"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"go.uber.org/ratelimit"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/an0nfunc/go-steamapi"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/time/rate"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/match"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/player"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/roundstats"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/spray"
|
||||
"somegit.dev/csgowtf/csgowtfd/ent/weapon"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
Logging struct {
|
||||
Level string
|
||||
}
|
||||
Db struct {
|
||||
DB struct {
|
||||
Driver string
|
||||
ConnectTo string `yaml:"connect_to"`
|
||||
}
|
||||
} `yaml:"db"`
|
||||
Parser struct {
|
||||
Worker int
|
||||
}
|
||||
Steam struct {
|
||||
Username string
|
||||
Password string
|
||||
AuthCode string `yaml:"auth_code"`
|
||||
APIKey string `yaml:"api_key"`
|
||||
RatePerSecond int `yaml:"rate_per_sec"`
|
||||
AuthCode string `yaml:"auth_code"`
|
||||
APIKey string `yaml:"api_key"`
|
||||
RatePerSecond float64 `yaml:"rate_per_sec"`
|
||||
Sentry string
|
||||
LoginKey string `yaml:"login_key"`
|
||||
MaxRetryWait int `yaml:"max_retry_wait"`
|
||||
}
|
||||
Redis struct {
|
||||
Address string
|
||||
@@ -64,7 +66,17 @@ type Conf struct {
|
||||
SharecodeUpdate string `yaml:"sharecode_update"`
|
||||
DemosExpire int `yaml:"demos_expire"`
|
||||
SprayTimeout int `yaml:"spray_timeout"`
|
||||
Timeout struct {
|
||||
Read int
|
||||
Write int
|
||||
Idle int
|
||||
}
|
||||
}
|
||||
DeepL struct {
|
||||
BaseURL string `yaml:"base_url"`
|
||||
APIKey string `yaml:"api_key"`
|
||||
Timeout int `yaml:"timeout"`
|
||||
} `yaml:"deepl"`
|
||||
}
|
||||
|
||||
type CommunityXML struct {
|
||||
@@ -82,6 +94,13 @@ type ShareCodeResponse struct {
|
||||
} `json:"result"`
|
||||
}
|
||||
|
||||
type DeepLResponse struct {
|
||||
Translations []struct {
|
||||
DetectedSourceLanguage string `json:"detected_source_language"`
|
||||
Text string `json:"text"`
|
||||
} `json:"translations"`
|
||||
}
|
||||
|
||||
type MatchStats struct {
|
||||
Win int `json:"win,omitempty"`
|
||||
Tie int `json:"tie,omitempty"`
|
||||
@@ -156,10 +175,12 @@ type MateResponse struct {
|
||||
}
|
||||
|
||||
type ChatResponse struct {
|
||||
Player *PlayerResponse `json:"player,omitempty"`
|
||||
Message string `json:"message"`
|
||||
AllChat bool `json:"all_chat"`
|
||||
Tick int `json:"tick"`
|
||||
Player *PlayerResponse `json:"player,omitempty"`
|
||||
Message string `json:"message"`
|
||||
AllChat bool `json:"all_chat"`
|
||||
Tick int `json:"tick"`
|
||||
TranslatedFrom string `json:"translated_from,omitempty"`
|
||||
TranslatedTo string `json:"translated_to,omitempty"`
|
||||
}
|
||||
|
||||
type WeaponDmg struct {
|
||||
@@ -179,7 +200,7 @@ type MetaStatsResponse struct {
|
||||
}
|
||||
|
||||
type MatchResponse struct {
|
||||
MatchId uint64 `json:"match_id,string"`
|
||||
MatchID uint64 `json:"match_id,string"`
|
||||
ShareCode string `json:"share_code,omitempty"`
|
||||
Map string `json:"map"`
|
||||
Date int64 `json:"date"`
|
||||
@@ -193,47 +214,32 @@ type MatchResponse struct {
|
||||
GameBan bool `json:"game_ban"`
|
||||
Stats interface{} `json:"stats,omitempty"`
|
||||
AvgRank float64 `json:"avg_rank,omitempty"`
|
||||
TickRate float64 `json:"tick_rate,omitempty"`
|
||||
}
|
||||
|
||||
type (
|
||||
AuthcodeUnauthorizedError struct {
|
||||
error
|
||||
}
|
||||
AuthcodeRateLimitError struct {
|
||||
error
|
||||
}
|
||||
SharecodeNoMatchError struct {
|
||||
error
|
||||
}
|
||||
var (
|
||||
ErrorSharecodeNoMatch = errors.New("sharecode not provided")
|
||||
ErrorAuthcodeRateLimit = errors.New("temporary rate-limited")
|
||||
ErrorAuthcodeUnavailable = errors.New("temporary unavailable")
|
||||
ErrorAuthcodeUnauthorized = errors.New("authcode unauthorized")
|
||||
ErrorNoMatch = errors.New("no match found")
|
||||
)
|
||||
|
||||
const (
|
||||
shareCodeURLEntry = "https://api.steampowered.com/ICSGOPlayers_730/GetNextMatchSharingCode/v1?key=%s&steamid=%d&steamidkey=%s&knowncode=%s"
|
||||
SideMetaCacheKey = "csgowtfd_side_meta_%d"
|
||||
CachePrefix = "csgowtfd_"
|
||||
SideMetaCacheKey = CachePrefix + "side_meta_%d"
|
||||
MatchChatCacheKey = CachePrefix + "chat_%d_%s"
|
||||
)
|
||||
|
||||
//goland:noinspection SpellCheckingInspection
|
||||
var (
|
||||
SteamId64RegEx = regexp.MustCompile(`^\d{17}$`)
|
||||
SteamID64RegEx = regexp.MustCompile(`^\d{17}$`)
|
||||
ShareCodeRegEx = regexp.MustCompile(`^CSGO(?:-?[ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789]{5}){5}$`)
|
||||
AuthCodeRegEx = regexp.MustCompile(`^[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{5}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}$`)
|
||||
AuthCodeRegEx = regexp.MustCompile(
|
||||
`^[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{5}-[ABCDEFGHJKLMNOPQRSTUVWXYZ23456789]{4}$`)
|
||||
)
|
||||
|
||||
func SendJSON(data interface{}, w http.ResponseWriter) error {
|
||||
w.Header().Set("content-type", "application/json")
|
||||
playerJson, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, err = w.Write(playerJson)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetMetaStats(dbPlayer *ent.Player) (*MetaStatsResponse, error) {
|
||||
mResponse := new(MetaStatsResponse)
|
||||
mResponse.Player = &PlayerResponse{SteamID64: dbPlayer.ID}
|
||||
@@ -269,7 +275,7 @@ func GetMetaStats(dbPlayer *ent.Player) (*MetaStatsResponse, error) {
|
||||
pMatches, err := s.QueryMatches().
|
||||
Select(match.FieldID, match.FieldMatchResult, match.FieldMap).
|
||||
Where(match.IDIn(matchIDs...)).
|
||||
WithStats().
|
||||
WithStats(). // TODO: limit fields returned
|
||||
Where(match.HasStatsWith(matchplayer.Or(matchplayer.PlayerStats(dbPlayer.ID), matchplayer.PlayerStats(s.ID)))).
|
||||
All(context.Background())
|
||||
if err != nil {
|
||||
@@ -427,7 +433,7 @@ func DeleteMatch(matchDel *ent.Match, db *ent.Client) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetWinLossTieForPlayer(dbPlayer *ent.Player) (wins int, looses int, ties int, err error) {
|
||||
func GetWinLossTieForPlayer(dbPlayer *ent.Player) (wins, looses, ties int, err error) {
|
||||
var res []struct {
|
||||
MatchResult int `json:"match_result"`
|
||||
Count int `json:"count"`
|
||||
@@ -470,60 +476,66 @@ func GetWinLossTieForPlayer(dbPlayer *ent.Player) (wins int, looses int, ties in
|
||||
return
|
||||
}
|
||||
|
||||
func IsAuthCodeValid(player *ent.Player, apiKey string, shareCode string, authCode string, rl ratelimit.Limiter) (bool, error) {
|
||||
func IsAuthCodeValid(tPlayer *ent.Player, apiKey, shareCode, authCode string, rl *rate.Limiter) (bool, error) {
|
||||
var tMatch *ent.Match
|
||||
var err error
|
||||
if shareCode == "" {
|
||||
tMatch, err = player.QueryMatches().Order(ent.Asc(match.FieldDate)).First(context.Background())
|
||||
tMatch, err = tPlayer.QueryMatches().Order(ent.Asc(match.FieldDate)).First(context.Background())
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, ErrorSharecodeNoMatch
|
||||
}
|
||||
|
||||
_, err := getNextShareCode(tMatch.ShareCode, apiKey, authCode, player.ID, rl)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
} else {
|
||||
_, err := getNextShareCode(shareCode, apiKey, authCode, player.ID, rl)
|
||||
_, err := getNextShareCode(tMatch.ShareCode, apiKey, authCode, tPlayer.ID, rl)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
_, err = getNextShareCode(shareCode, apiKey, authCode, tPlayer.ID, rl)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func GetNewShareCodesForPlayer(player *ent.Player, apiKey string, rl ratelimit.Limiter) ([]string, error) {
|
||||
latestMatch, err := player.QueryMatches().Order(ent.Desc(match.FieldDate)).First(context.Background())
|
||||
func GetNewShareCodesForPlayer(tPlayer *ent.Player, apiKey string, rl *rate.Limiter) ([]string, error) {
|
||||
latestMatch, err := tPlayer.QueryMatches().Order(ent.Desc(match.FieldDate)).First(context.Background())
|
||||
if err != nil {
|
||||
if ent.IsNotFound(err) {
|
||||
return nil, ErrorNoMatch
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
oldestMatch, err := player.QueryMatches().Order(ent.Asc(match.FieldDate)).First(context.Background())
|
||||
oldestMatch, err := tPlayer.QueryMatches().Order(ent.Asc(match.FieldDate)).First(context.Background())
|
||||
if err != nil {
|
||||
if ent.IsNotFound(err) {
|
||||
return nil, ErrorNoMatch
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var newShareCode string
|
||||
if oldestMatch.ShareCode == player.OldestSharecodeSeen {
|
||||
newShareCode, err = getNextShareCode(latestMatch.ShareCode, apiKey, player.AuthCode, player.ID, rl)
|
||||
var newShareCode *string
|
||||
if oldestMatch.ShareCode == tPlayer.OldestSharecodeSeen {
|
||||
newShareCode, err = getNextShareCode(latestMatch.ShareCode, apiKey, tPlayer.AuthCode, tPlayer.ID, rl)
|
||||
} else {
|
||||
newShareCode, err = getNextShareCode(oldestMatch.ShareCode, apiKey, player.AuthCode, player.ID, rl)
|
||||
newShareCode, err = getNextShareCode(oldestMatch.ShareCode, apiKey, tPlayer.AuthCode, tPlayer.ID, rl)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var rCodes []string
|
||||
for newShareCode != "n/a" {
|
||||
rCodes = append(rCodes, newShareCode)
|
||||
newShareCode, err = getNextShareCode(rCodes[len(rCodes)-1], apiKey, player.AuthCode, player.ID, rl)
|
||||
for newShareCode != nil {
|
||||
rCodes = append(rCodes, *newShareCode)
|
||||
newShareCode, err = getNextShareCode(rCodes[len(rCodes)-1], apiKey, tPlayer.AuthCode, tPlayer.ID, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
err = player.Update().SetSharecodeUpdated(time.Now().UTC()).SetOldestSharecodeSeen(oldestMatch.ShareCode).Exec(context.Background())
|
||||
err = tPlayer.Update().SetSharecodeUpdated(time.Now().UTC()).SetOldestSharecodeSeen(oldestMatch.ShareCode).Exec(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -531,60 +543,61 @@ func GetNewShareCodesForPlayer(player *ent.Player, apiKey string, rl ratelimit.L
|
||||
return rCodes, nil
|
||||
}
|
||||
|
||||
func getNextShareCode(lastCode string, apiKey string, authCode string, steamId uint64, rl ratelimit.Limiter) (string, error) {
|
||||
if lastCode == "" || apiKey == "" || authCode == "" || steamId == 0 {
|
||||
return "", fmt.Errorf("invalid arguments")
|
||||
func getNextShareCode(lastCode, apiKey, authCode string, steamID uint64, rl *rate.Limiter) (*string, error) {
|
||||
if lastCode == "" || apiKey == "" || authCode == "" || steamID == 0 {
|
||||
return nil, errors.New("invalid arguments")
|
||||
}
|
||||
|
||||
if rl != nil {
|
||||
rl.Take()
|
||||
err := rl.Wait(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
log.Debugf("[SC] STEAMPI with %s", fmt.Sprintf(shareCodeURLEntry, "REDACTED", steamId, "REDACTED", lastCode))
|
||||
r, err := http.Get(fmt.Sprintf(shareCodeURLEntry, apiKey, steamId, authCode, lastCode))
|
||||
log.Debugf("[SC] STEAMPI with %s", fmt.Sprintf(shareCodeURLEntry, "REDACTED", steamID, "REDACTED", lastCode))
|
||||
r, err := http.Get(fmt.Sprintf(shareCodeURLEntry, apiKey, steamID, authCode, lastCode)) //nolint:noctx
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch r.StatusCode {
|
||||
case http.StatusAccepted:
|
||||
return "n/a", nil
|
||||
return nil, nil //nolint:nilnil
|
||||
case http.StatusTooManyRequests:
|
||||
return "", AuthcodeRateLimitError{errors.New("temporary ratelimited")}
|
||||
return nil, ErrorAuthcodeRateLimit
|
||||
case http.StatusServiceUnavailable:
|
||||
return "", AuthcodeRateLimitError{errors.New("temporary unavailable")}
|
||||
return nil, ErrorAuthcodeUnavailable
|
||||
case http.StatusPreconditionFailed:
|
||||
return "", SharecodeNoMatchError{errors.New("sharecode not from player history")}
|
||||
return nil, ErrorSharecodeNoMatch
|
||||
case http.StatusForbidden:
|
||||
return "", AuthcodeUnauthorizedError{errors.New("authcode unauthorized")}
|
||||
return nil, ErrorAuthcodeUnauthorized
|
||||
case http.StatusOK:
|
||||
break
|
||||
default:
|
||||
return "", errors.New("temporary steamapi error")
|
||||
return nil, fmt.Errorf("temporary steamapi error (HTTP %d)", r.StatusCode)
|
||||
}
|
||||
|
||||
defer func(Body io.ReadCloser) {
|
||||
_ = Body.Close()
|
||||
}(r.Body)
|
||||
bJson, err := ioutil.ReadAll(r.Body)
|
||||
bJSON, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
_ = r.Body.Close()
|
||||
|
||||
rJson := new(ShareCodeResponse)
|
||||
err = json.Unmarshal(bJson, rJson)
|
||||
rJSON := new(ShareCodeResponse)
|
||||
err = json.Unmarshal(bJSON, rJSON)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return rJson.Result.Code, nil
|
||||
return &rJSON.Result.Code, nil
|
||||
}
|
||||
|
||||
func Player(db *ent.Client, id interface{}, apiKey string, rl ratelimit.Limiter) (*ent.Player, error) {
|
||||
func Player(db *ent.Client, id interface{}, apiKey string, rl *rate.Limiter) (*ent.Player, error) {
|
||||
switch e := id.(type) {
|
||||
case uint64:
|
||||
return PlayerFromSteamID64(db, e, apiKey, rl)
|
||||
case string:
|
||||
if SteamId64RegEx.MatchString(e) {
|
||||
if SteamID64RegEx.MatchString(e) {
|
||||
steamID64, err := strconv.ParseUint(e, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -595,132 +608,152 @@ func Player(db *ent.Client, id interface{}, apiKey string, rl ratelimit.Limiter)
|
||||
|
||||
return PlayerFromVanityURL(db, e, apiKey, rl)
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid arguments")
|
||||
return nil, errors.New("invalid arguments")
|
||||
}
|
||||
}
|
||||
|
||||
func PlayerFromVanityURL(db *ent.Client, id string, apiKey string, rl ratelimit.Limiter) (*ent.Player, error) {
|
||||
func PlayerFromVanityURL(db *ent.Client, id, apiKey string, rl *rate.Limiter) (*ent.Player, error) {
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("invalid arguments")
|
||||
return nil, errors.New("invalid arguments")
|
||||
}
|
||||
|
||||
tPlayer, err := db.Player.Query().Where(player.VanityURL(strings.ToLower(id))).Only(context.Background())
|
||||
if err == nil {
|
||||
return tPlayer, nil
|
||||
} else {
|
||||
if rl != nil {
|
||||
rl.Take()
|
||||
}
|
||||
resp, err := steamapi.ResolveVanityURL(id, apiKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if resp.Success != 1 {
|
||||
return nil, fmt.Errorf("vanity url not found")
|
||||
}
|
||||
resp, err := steamapi.ResolveVanityURL(id, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nPlayer, err := PlayerFromSteamID64(db, resp.SteamID, apiKey, rl)
|
||||
if resp.Success != 1 {
|
||||
return nil, errors.New("vanity url not found")
|
||||
}
|
||||
|
||||
nPlayer, err := PlayerFromSteamID64(db, resp.SteamID, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nPlayer, nil
|
||||
}
|
||||
|
||||
func PlayerFromSteamID64(db *ent.Client, steamID uint64, apiKey string, rl *rate.Limiter) (*ent.Player, error) {
|
||||
tPlayer, err := db.Player.Get(context.Background(), steamID)
|
||||
if err == nil {
|
||||
return tPlayer, nil
|
||||
}
|
||||
|
||||
nPlayer := &ent.Player{ID: steamID}
|
||||
uPlayer, err := PlayerFromSteam([]*ent.Player{nPlayer}, nil, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(uPlayer) > 0 {
|
||||
nPlayer, err = db.Player.Create().
|
||||
SetID(steamID).
|
||||
SetName(uPlayer[0].Name).
|
||||
SetAvatar(uPlayer[0].Avatar).
|
||||
SetSteamUpdated(uPlayer[0].SteamUpdated).
|
||||
SetVanityURL(uPlayer[0].VanityURL).
|
||||
SetVanityURLReal(uPlayer[0].VanityURLReal).
|
||||
SetProfileCreated(uPlayer[0].ProfileCreated).
|
||||
SetGameBanCount(uPlayer[0].GameBanCount).
|
||||
SetVacCount(uPlayer[0].VacCount).
|
||||
SetVacDate(uPlayer[0].VacDate).
|
||||
SetGameBanDate(uPlayer[0].GameBanDate).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nPlayer, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("player %d not found", steamID)
|
||||
}
|
||||
|
||||
func PlayerFromSteamID64(db *ent.Client, steamID uint64, apiKey string, rl ratelimit.Limiter) (*ent.Player, error) {
|
||||
tPlayer, err := db.Player.Get(context.Background(), steamID)
|
||||
if err == nil {
|
||||
return tPlayer, nil
|
||||
} else {
|
||||
nPlayer := &ent.Player{ID: steamID}
|
||||
uPlayer, err := PlayerFromSteam([]*ent.Player{nPlayer}, nil, apiKey, rl)
|
||||
func TranslateWithDeepL(text, language, baseURL, apiKey string, timeout int) (translated, detectedLanguage string, err error) {
|
||||
c := &http.Client{
|
||||
Timeout: time.Duration(timeout) * time.Second,
|
||||
}
|
||||
v := url.Values{}
|
||||
v.Set("auth_key", apiKey)
|
||||
v.Set("text", text)
|
||||
v.Set("target_lang", language)
|
||||
dlResp, err := c.PostForm("https://"+baseURL+"/v2/translate", v) //nolint:noctx
|
||||
switch {
|
||||
case err != nil:
|
||||
return "", "", fmt.Errorf("deepl response: %w", err)
|
||||
case dlResp.StatusCode != http.StatusOK:
|
||||
return "", "", fmt.Errorf("deepl response %d", dlResp.StatusCode)
|
||||
default:
|
||||
respBytes, err := io.ReadAll(dlResp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", "", fmt.Errorf("error reading deepl response: %w", err)
|
||||
}
|
||||
|
||||
if len(uPlayer) > 0 {
|
||||
nPlayer, err = db.Player.Create().
|
||||
SetID(steamID).
|
||||
SetName(uPlayer[0].Name).
|
||||
SetAvatar(uPlayer[0].Avatar).
|
||||
SetSteamUpdated(uPlayer[0].SteamUpdated).
|
||||
SetVanityURL(uPlayer[0].VanityURL).
|
||||
SetVanityURLReal(uPlayer[0].VanityURLReal).
|
||||
SetProfileCreated(uPlayer[0].ProfileCreated).
|
||||
SetGameBanCount(uPlayer[0].GameBanCount).
|
||||
SetVacCount(uPlayer[0].VacCount).
|
||||
SetVacDate(uPlayer[0].VacDate).
|
||||
SetGameBanDate(uPlayer[0].GameBanDate).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nPlayer, nil
|
||||
_ = dlResp.Body.Close()
|
||||
dlRespJSON := new(DeepLResponse)
|
||||
err = json.Unmarshal(respBytes, &dlRespJSON)
|
||||
if err != nil {
|
||||
return "", "", fmt.Errorf("error decoding json from deepl: %w", err)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("player %d not found", steamID)
|
||||
return dlRespJSON.Translations[0].Text, strings.ToLower(dlRespJSON.Translations[0].DetectedSourceLanguage), nil
|
||||
}
|
||||
}
|
||||
|
||||
func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl ratelimit.Limiter) ([]*ent.Player, error) {
|
||||
var idsToUpdate []uint64
|
||||
func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl *rate.Limiter) ([]*ent.Player, error) {
|
||||
idsToUpdate := make([]uint64, 0, len(players))
|
||||
|
||||
for _, updatePlayer := range players {
|
||||
idsToUpdate = append(idsToUpdate, updatePlayer.ID)
|
||||
}
|
||||
|
||||
if rl != nil {
|
||||
rl.Take()
|
||||
}
|
||||
playerSum, err := steamapi.GetPlayerSummaries(idsToUpdate, apiKey)
|
||||
playerSum, err := steamapi.GetPlayerSummaries(idsToUpdate, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: what happens if a player deleted their profile?
|
||||
var nPlayers []*ent.Player
|
||||
for _, pS := range playerSum {
|
||||
var nPlayers []*ent.Player //nolint:prealloc
|
||||
for i := range playerSum {
|
||||
// check for vanityURL
|
||||
if SteamId64RegEx.MatchString(path.Base(pS.ProfileURL)) {
|
||||
pS.ProfileURL = ""
|
||||
if SteamID64RegEx.MatchString(path.Base(playerSum[i].ProfileURL)) {
|
||||
playerSum[i].ProfileURL = ""
|
||||
} else {
|
||||
pS.ProfileURL = path.Base(pS.ProfileURL)
|
||||
playerSum[i].ProfileURL = path.Base(playerSum[i].ProfileURL)
|
||||
}
|
||||
|
||||
var tPlayer *ent.Player
|
||||
if db != nil {
|
||||
tPlayer, err = db.Player.UpdateOneID(pS.SteamID).
|
||||
SetName(pS.PersonaName).
|
||||
SetAvatar(pS.AvatarHash).
|
||||
SetVanityURL(strings.ToLower(pS.ProfileURL)).
|
||||
SetVanityURLReal(pS.ProfileURL).
|
||||
tPlayer, err = db.Player.UpdateOneID(playerSum[i].SteamID).
|
||||
SetName(playerSum[i].PersonaName).
|
||||
SetAvatar(playerSum[i].AvatarHash).
|
||||
SetVanityURL(strings.ToLower(playerSum[i].ProfileURL)).
|
||||
SetVanityURLReal(playerSum[i].ProfileURL).
|
||||
SetSteamUpdated(time.Now().UTC()).
|
||||
SetProfileCreated(time.Unix(pS.TimeCreated, 0).UTC()).
|
||||
SetProfileCreated(time.Unix(playerSum[i].TimeCreated, 0).UTC()).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
tPlayer = &ent.Player{
|
||||
ID: pS.SteamID,
|
||||
Name: pS.PersonaName,
|
||||
Avatar: pS.AvatarHash,
|
||||
VanityURL: strings.ToLower(pS.ProfileURL),
|
||||
VanityURLReal: pS.ProfileURL,
|
||||
ID: playerSum[i].SteamID,
|
||||
Name: playerSum[i].PersonaName,
|
||||
Avatar: playerSum[i].AvatarHash,
|
||||
VanityURL: strings.ToLower(playerSum[i].ProfileURL),
|
||||
VanityURLReal: playerSum[i].ProfileURL,
|
||||
SteamUpdated: time.Now().UTC(),
|
||||
ProfileCreated: time.Unix(pS.TimeCreated, 0),
|
||||
ProfileCreated: time.Unix(playerSum[i].TimeCreated, 0),
|
||||
}
|
||||
}
|
||||
nPlayers = append(nPlayers, tPlayer)
|
||||
}
|
||||
|
||||
if rl != nil {
|
||||
rl.Take()
|
||||
}
|
||||
bans, err := steamapi.GetPlayerBans(idsToUpdate, apiKey)
|
||||
bans, err := steamapi.GetPlayerBans(idsToUpdate, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -760,3 +793,18 @@ func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl ra
|
||||
|
||||
return nPlayers, nil
|
||||
}
|
||||
|
||||
func RealIP(header *http.Header, fallback string) string {
|
||||
if header.Get("X-Forwarded-For") != "" {
|
||||
return header.Get("X-Forwarded-For")
|
||||
}
|
||||
|
||||
return fallback
|
||||
}
|
||||
|
||||
func Rollback(tx *ent.Tx, err error) error {
|
||||
if rErr := tx.Rollback(); rErr != nil {
|
||||
err = fmt.Errorf("%w: %w", err, rErr)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user