diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c1da5df45..4a9b1dde1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ stages: - task: GoTool@0 displayName: "Install Go" inputs: - version: '1.25.1' + version: '1.26.1' - pwsh: | choco install -y make diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 3ce54826d..0c2ac81e3 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/golang:1.25-alpine3.21 AS build +FROM docker.io/golang:1.26-alpine3.23 AS build ARG BUILD_VERSION @@ -28,11 +28,11 @@ RUN make clean release DOCKER_BUILD=1 BUILD_STATIC=1 CGO_CFLAGS="-D_LARGEFILE64_ cscli parsers install crowdsecurity/whitelists && \ echo '{"source": "file", "filename": "/does/not/exist", "labels": {"type": "syslog"}}' > /etc/crowdsec/acquis.yaml - # we create a useless acquis.yaml, which will be overridden by a mounted volume - # in most cases, but is still required for the container to start during tests +# we create a useless acquis.yaml, which will be overridden by a mounted volume +# in most cases, but is still required for the container to start during tests - # In case we need to remove agents here.. - # cscli machines list -o json | yq '.[].machineId' | xargs -r cscli machines delete +# In case we need to remove agents here.. +# cscli machines list -o json | yq '.[].machineId' | xargs -r cscli machines delete FROM docker.io/alpine:3.21 AS slim diff --git a/build/docker/Dockerfile.debian b/build/docker/Dockerfile.debian index 0b7db0349..311368f28 100644 --- a/build/docker/Dockerfile.debian +++ b/build/docker/Dockerfile.debian @@ -1,4 +1,4 @@ -FROM docker.io/golang:1.25-bookworm AS build +FROM docker.io/golang:1.26-trixie AS build ARG BUILD_VERSION @@ -33,12 +33,12 @@ RUN make clean release DOCKER_BUILD=1 BUILD_STATIC=1 && \ cscli parsers install crowdsecurity/whitelists && \ echo '{"source": "file", "filename": "/does/not/exist", "labels": {"type": "syslog"}}' > /etc/crowdsec/acquis.yaml - # we create a useless acquis.yaml, which will be overridden by a mounted volume - # in most cases, but is still required for the container to start during tests +# we create a useless acquis.yaml, which will be overridden by a mounted volume +# in most cases, but is still required for the container to start during tests - # In case we need to remove agents here.. - # cscli machines list -o json | yq '.[].machineId' | xargs -r cscli machines delete +# In case we need to remove agents here.. +# cscli machines list -o json | yq '.[].machineId' | xargs -r cscli machines delete FROM docker.io/debian:bookworm-slim AS slim diff --git a/cmd/crowdsec-cli/cliconsole/console.go b/cmd/crowdsec-cli/cliconsole/console.go index fcee388ee..1256bd5c0 100644 --- a/cmd/crowdsec-cli/cliconsole/console.go +++ b/cmd/crowdsec-cli/cliconsole/console.go @@ -19,7 +19,6 @@ import ( "github.com/spf13/cobra" "gopkg.in/yaml.v3" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/go-cs-lib/slicetools" "github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args" @@ -399,7 +398,7 @@ func (cli *cliConsole) setConsoleOpts(args []string, wanted bool) error { log.Debugf("%s already set to %t", csconfig.CONSOLE_MANAGEMENT, wanted) } else { log.Infof("%s set to %t", csconfig.CONSOLE_MANAGEMENT, wanted) - consoleCfg.ConsoleManagement = ptr.Of(wanted) + consoleCfg.ConsoleManagement = new(wanted) } if cfg.API.Server.OnlineClient.Credentials != nil { @@ -432,7 +431,7 @@ func (cli *cliConsole) setConsoleOpts(args []string, wanted bool) error { log.Debugf("%s already set to %t", csconfig.SEND_CUSTOM_SCENARIOS, wanted) } else { log.Infof("%s set to %t", csconfig.SEND_CUSTOM_SCENARIOS, wanted) - consoleCfg.ShareCustomScenarios = ptr.Of(wanted) + consoleCfg.ShareCustomScenarios = new(wanted) } case csconfig.SEND_TAINTED_SCENARIOS: // for each flag check if it's already set before setting it @@ -440,7 +439,7 @@ func (cli *cliConsole) setConsoleOpts(args []string, wanted bool) error { log.Debugf("%s already set to %t", csconfig.SEND_TAINTED_SCENARIOS, wanted) } else { log.Infof("%s set to %t", csconfig.SEND_TAINTED_SCENARIOS, wanted) - consoleCfg.ShareTaintedScenarios = ptr.Of(wanted) + consoleCfg.ShareTaintedScenarios = new(wanted) } case csconfig.SEND_MANUAL_SCENARIOS: // for each flag check if it's already set before setting it @@ -448,7 +447,7 @@ func (cli *cliConsole) setConsoleOpts(args []string, wanted bool) error { log.Debugf("%s already set to %t", csconfig.SEND_MANUAL_SCENARIOS, wanted) } else { log.Infof("%s set to %t", csconfig.SEND_MANUAL_SCENARIOS, wanted) - consoleCfg.ShareManualDecisions = ptr.Of(wanted) + consoleCfg.ShareManualDecisions = new(wanted) } case csconfig.SEND_CONTEXT: // for each flag check if it's already set before setting it @@ -456,7 +455,7 @@ func (cli *cliConsole) setConsoleOpts(args []string, wanted bool) error { log.Debugf("%s already set to %t", csconfig.SEND_CONTEXT, wanted) } else { log.Infof("%s set to %t", csconfig.SEND_CONTEXT, wanted) - consoleCfg.ShareContext = ptr.Of(wanted) + consoleCfg.ShareContext = new(wanted) } default: return fmt.Errorf("unknown flag %s", arg) diff --git a/cmd/crowdsec-cli/clidecision/import.go b/cmd/crowdsec-cli/clidecision/import.go index ba13918b1..5974d1b48 100644 --- a/cmd/crowdsec-cli/clidecision/import.go +++ b/cmd/crowdsec-cli/clidecision/import.go @@ -18,8 +18,6 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args" "github.com/crowdsecurity/crowdsec/pkg/models" "github.com/crowdsecurity/crowdsec/pkg/types" @@ -171,13 +169,13 @@ func (cli *cliDecisions) import_(ctx context.Context, input string, duration str } decisions[i] = &models.Decision{ - Value: ptr.Of(d.Value), - Duration: ptr.Of(d.Duration), - Origin: ptr.Of(types.CscliImportOrigin), - Scenario: ptr.Of(d.Scenario), - Type: ptr.Of(d.Type), - Scope: ptr.Of(d.Scope), - Simulated: ptr.Of(false), + Value: new(d.Value), + Duration: new(d.Duration), + Origin: new(types.CscliImportOrigin), + Scenario: new(d.Scenario), + Type: new(d.Type), + Scope: new(d.Scope), + Simulated: new(false), } } @@ -227,22 +225,22 @@ func (cli *cliDecisions) import_(ctx context.Context, input string, duration str for chunk := range slices.Chunk(actualDecisions, batch) { importAlert := models.Alert{ CreatedAt: time.Now().UTC().Format(time.RFC3339), - Scenario: ptr.Of(fmt.Sprintf("import %s: %d IPs", input, len(chunk))), + Scenario: new(fmt.Sprintf("import %s: %d IPs", input, len(chunk))), - Message: ptr.Of(""), + Message: new(""), Events: []*models.Event{}, Source: &models.Source{ - Scope: ptr.Of(""), - Value: ptr.Of(""), + Scope: new(""), + Value: new(""), }, - StartAt: ptr.Of(time.Now().UTC().Format(time.RFC3339)), - StopAt: ptr.Of(time.Now().UTC().Format(time.RFC3339)), - Capacity: ptr.Of(int32(0)), - Simulated: ptr.Of(false), - EventsCount: ptr.Of(int32(len(chunk))), - Leakspeed: ptr.Of(""), - ScenarioHash: ptr.Of(""), - ScenarioVersion: ptr.Of(""), + StartAt: new(time.Now().UTC().Format(time.RFC3339)), + StopAt: new(time.Now().UTC().Format(time.RFC3339)), + Capacity: new(int32(0)), + Simulated: new(false), + EventsCount: new(int32(len(chunk))), + Leakspeed: new(""), + ScenarioHash: new(""), + ScenarioVersion: new(""), Decisions: chunk, Kind: types.CscliAlertKind.String(), } diff --git a/cmd/crowdsec-cli/clinotifications/notifications.go b/cmd/crowdsec-cli/clinotifications/notifications.go index d0f2234d8..da8aef095 100644 --- a/cmd/crowdsec-cli/clinotifications/notifications.go +++ b/cmd/crowdsec-cli/clinotifications/notifications.go @@ -22,8 +22,6 @@ import ( "gopkg.in/tomb.v2" "gopkg.in/yaml.v3" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/args" "github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/core/require" "github.com/crowdsecurity/crowdsec/pkg/apiclient" @@ -321,34 +319,34 @@ func (cli *cliNotifications) newTestCmd() *cobra.Command { return nil }) alert := &models.Alert{ - Capacity: ptr.Of(int32(0)), + Capacity: new(int32(0)), Decisions: []*models.Decision{{ - Duration: ptr.Of("4h"), - Scope: ptr.Of("Ip"), - Value: ptr.Of("10.10.10.10"), - Type: ptr.Of("ban"), - Scenario: ptr.Of("test alert"), - Origin: ptr.Of(types.CscliOrigin), + Duration: new("4h"), + Scope: new("Ip"), + Value: new("10.10.10.10"), + Type: new("ban"), + Scenario: new("test alert"), + Origin: new(types.CscliOrigin), }}, Events: []*models.Event{}, - EventsCount: ptr.Of(int32(1)), - Leakspeed: ptr.Of("0"), - Message: ptr.Of("test alert"), - ScenarioHash: ptr.Of(""), - Scenario: ptr.Of("test alert"), - ScenarioVersion: ptr.Of(""), - Simulated: ptr.Of(false), + EventsCount: new(int32(1)), + Leakspeed: new("0"), + Message: new("test alert"), + ScenarioHash: new(""), + Scenario: new("test alert"), + ScenarioVersion: new(""), + Simulated: new(false), Source: &models.Source{ AsName: "", AsNumber: "", Cn: "", IP: "10.10.10.10", Range: "", - Scope: ptr.Of("Ip"), - Value: ptr.Of("10.10.10.10"), + Scope: new("Ip"), + Value: new("10.10.10.10"), }, - StartAt: ptr.Of(time.Now().UTC().Format(time.RFC3339)), - StopAt: ptr.Of(time.Now().UTC().Format(time.RFC3339)), + StartAt: new(time.Now().UTC().Format(time.RFC3339)), + StopAt: new(time.Now().UTC().Format(time.RFC3339)), CreatedAt: time.Now().UTC().Format(time.RFC3339), } if err := yaml.Unmarshal([]byte(alertOverride), alert); err != nil { @@ -368,8 +366,8 @@ func (cli *cliNotifications) newTestCmd() *cobra.Command { }, } cmd.Flags().StringVarP(&alertOverride, "alert", "a", "", - "JSON string used to override alert fields in the generic alert " + - "(see crowdsec/pkg/models/alert.go in the source tree for the full definition of the object)") + "JSON string used to override alert fields in the generic alert "+ + "(see crowdsec/pkg/models/alert.go in the source tree for the full definition of the object)") return cmd } @@ -489,8 +487,8 @@ cscli notifications reinject -a '{"remediation": true,"scenario":"not }, } cmd.Flags().StringVarP(&alertOverride, "alert", "a", "", - "JSON string used to override alert fields in the reinjected alert " + - "(see crowdsec/pkg/models/alert.go in the source tree for the full definition of the object)") + "JSON string used to override alert fields in the reinjected alert "+ + "(see crowdsec/pkg/models/alert.go in the source tree for the full definition of the object)") return cmd } diff --git a/cmd/crowdsec/lpmetrics.go b/cmd/crowdsec/lpmetrics.go index 536dc0dfa..135929656 100644 --- a/cmd/crowdsec/lpmetrics.go +++ b/cmd/crowdsec/lpmetrics.go @@ -14,7 +14,6 @@ import ( "github.com/sirupsen/logrus" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/go-cs-lib/version" acquisitionTypes "github.com/crowdsecurity/crowdsec/pkg/acquisition/types" @@ -213,10 +212,10 @@ func (m *MetricsProvider) gatherPromMetrics(metricsName []string, labelsMap labe } item := &models.MetricsDetailItem{ - Name: ptr.Of(metricName), - Unit: ptr.Of(unitType), + Name: new(metricName), + Unit: new(unitType), Labels: metricsLabels, - Value: ptr.Of(value), + Value: new(value), } m.logger.Debugf("Gathered metric: %s, item: %+v", metricFamily.GetName(), item) items = append(items, item) @@ -301,14 +300,14 @@ func (m *MetricsProvider) getAppsecBlockedMetrics() []*models.MetricsDetailItem func (m *MetricsProvider) metricsPayload() *models.AllMetrics { os := &models.OSversion{ - Name: ptr.Of(m.static.osName), - Version: ptr.Of(m.static.osVersion), + Name: new(m.static.osName), + Version: new(m.static.osVersion), } base := models.BaseMetrics{ - UtcStartupTimestamp: ptr.Of(m.static.startupTS), + UtcStartupTimestamp: new(m.static.startupTS), Os: os, - Version: ptr.Of(version.String()), + Version: new(version.String()), FeatureFlags: m.static.featureFlags, Metrics: make([]*models.DetailedMetrics, 0), } @@ -321,8 +320,8 @@ func (m *MetricsProvider) metricsPayload() *models.AllMetrics { met.Metrics = append(met.Metrics, &models.DetailedMetrics{ Meta: &models.MetricsMeta{ - UtcNowTimestamp: ptr.Of(time.Now().Unix()), - WindowSizeSeconds: ptr.Of(int64(m.interval.Seconds())), + UtcNowTimestamp: new(time.Now().Unix()), + WindowSizeSeconds: new(int64(m.interval.Seconds())), }, Items: make([]*models.MetricsDetailItem, 0), }) diff --git a/go.mod b/go.mod index b77dbc299..35fb0b5de 100644 --- a/go.mod +++ b/go.mod @@ -1,256 +1,268 @@ module github.com/crowdsecurity/crowdsec -go 1.25.1 +go 1.26.1 require ( - entgo.io/ent v0.14.2 + entgo.io/ent v0.14.6 github.com/AlecAivazis/survey/v2 v2.3.7 - github.com/Masterminds/semver/v3 v3.2.1 - github.com/Masterminds/sprig/v3 v3.2.3 + github.com/Masterminds/semver/v3 v3.4.0 + github.com/Masterminds/sprig/v3 v3.3.0 github.com/agext/levenshtein v1.2.3 github.com/alexliesenfeld/health v0.8.1 github.com/appleboy/gin-jwt/v2 v2.10.3 github.com/aws/aws-lambda-go v1.54.0 github.com/aws/aws-sdk-go-v2 v1.41.5 - github.com/aws/aws-sdk-go-v2/config v1.31.6 - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.19.4 - github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.57.2 - github.com/aws/aws-sdk-go-v2/service/kinesis v1.40.1 - github.com/aws/aws-sdk-go-v2/service/s3 v1.87.3 + github.com/aws/aws-sdk-go-v2/config v1.32.14 + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.12 + github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.68.0 + github.com/aws/aws-sdk-go-v2/service/kinesis v1.43.5 + github.com/aws/aws-sdk-go-v2/service/s3 v1.98.0 github.com/aws/aws-sdk-go-v2/service/sqs v1.42.25 - github.com/beevik/etree v1.4.1 + github.com/beevik/etree v1.6.0 github.com/bluele/gcache v0.0.2 github.com/buger/jsonparser v1.1.2 github.com/cenkalti/backoff/v5 v5.0.3 github.com/cespare/xxhash/v2 v2.3.0 github.com/containerd/errdefs v1.0.0 - github.com/corazawaf/coraza/v3 v3.3.3 - github.com/corazawaf/libinjection-go v0.2.2 + github.com/corazawaf/coraza/v3 v3.7.0 + github.com/corazawaf/libinjection-go v0.3.2 github.com/crowdsecurity/dlog v0.0.2 github.com/crowdsecurity/go-cs-lib v0.0.25 github.com/crowdsecurity/grokky v0.2.2 github.com/crowdsecurity/machineid v1.0.3 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc - github.com/expr-lang/expr v1.17.7 - github.com/fatih/color v1.18.0 + github.com/expr-lang/expr v1.17.8 + github.com/fatih/color v1.19.0 github.com/fsnotify/fsnotify v1.9.0 github.com/gin-contrib/gzip v1.2.3 github.com/gin-gonic/gin v1.10.0 - github.com/go-co-op/gocron/v2 v2.19.1 - github.com/go-openapi/errors v0.22.2 - github.com/go-openapi/strfmt v0.23.0 - github.com/go-openapi/swag v0.23.1 - github.com/go-openapi/validate v0.24.0 + github.com/go-co-op/gocron/v2 v2.20.0 + github.com/go-openapi/errors v0.22.7 + github.com/go-openapi/strfmt v0.26.1 + github.com/go-openapi/swag v0.25.5 + github.com/go-openapi/validate v0.25.2 github.com/go-sql-driver/mysql v1.9.3 - github.com/goccy/go-yaml v1.18.0 + github.com/goccy/go-yaml v1.19.2 github.com/golang-jwt/jwt/v4 v4.5.2 github.com/google/go-querystring v1.2.0 github.com/google/uuid v1.6.0 - github.com/google/winops v0.0.0-20230712152054-af9b550d0601 + github.com/google/winops v0.0.0-20260218212338-878c3f651658 github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e - github.com/gorilla/websocket v1.5.0 - github.com/hashicorp/go-hclog v1.5.0 - github.com/hashicorp/go-plugin v1.6.3 - github.com/hashicorp/go-version v1.7.0 + github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 + github.com/hashicorp/go-hclog v1.6.3 + github.com/hashicorp/go-plugin v1.7.0 + github.com/hashicorp/go-version v1.9.0 github.com/hexops/gotextdiff v1.0.3 github.com/ivanpirog/coloredcobra v1.0.1 - github.com/jackc/pgx/v4 v4.18.2 + github.com/jackc/pgx/v4 v4.18.3 github.com/jarcoal/httpmock v1.1.0 - github.com/jedib0t/go-pretty/v6 v6.6.7 - github.com/jszwec/csvutil v1.5.1 + github.com/jedib0t/go-pretty/v6 v6.7.9 + github.com/jszwec/csvutil v1.10.0 github.com/mattn/go-isatty v0.0.20 - github.com/mattn/go-sqlite3 v1.14.24 - github.com/moby/moby/api v1.52.1-0.20251116162601-e9ff10bf365a - github.com/moby/moby/client v0.1.1-0.20251116162601-e9ff10bf365a + github.com/mattn/go-sqlite3 v1.14.41 + github.com/moby/moby/api v1.54.1 + github.com/moby/moby/client v0.4.0 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/nxadm/tail v1.4.11 - github.com/oschwald/geoip2-golang v1.9.0 - github.com/oschwald/maxminddb-golang v1.12.0 + github.com/oschwald/geoip2-golang v1.13.0 + github.com/oschwald/maxminddb-golang v1.13.1 github.com/petar-dambovaliev/aho-corasick v0.0.0-20250424160509-463d218d4745 github.com/prometheus/client_golang v1.23.2 github.com/prometheus/client_model v0.6.2 - github.com/prometheus/common v0.66.1 + github.com/prometheus/common v0.67.5 github.com/r3labs/diff/v2 v2.15.1 github.com/sanity-io/litter v1.5.8 github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 - github.com/segmentio/kafka-go v0.4.48 - github.com/shirou/gopsutil/v4 v4.25.8 - github.com/sirupsen/logrus v1.9.3 - github.com/slack-go/slack v0.16.0 - github.com/spf13/cobra v1.10.1 + github.com/segmentio/kafka-go v0.4.50 + github.com/shirou/gopsutil/v4 v4.26.3 + github.com/sirupsen/logrus v1.9.4 + github.com/slack-go/slack v0.21.0 + github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 github.com/umahmood/haversine v0.0.0-20151105152445-808ab04add26 github.com/wasilibs/go-re2 v1.10.0 github.com/xhit/go-simple-mail/v2 v2.16.0 - golang.org/x/crypto v0.46.0 - golang.org/x/mod v0.30.0 - golang.org/x/net v0.48.0 - golang.org/x/sync v0.19.0 - golang.org/x/sys v0.39.0 - golang.org/x/text v0.32.0 - golang.org/x/time v0.13.0 - google.golang.org/grpc v1.79.3 - google.golang.org/protobuf v1.36.10 + golang.org/x/crypto v0.49.0 + golang.org/x/mod v0.34.0 + golang.org/x/net v0.52.0 + golang.org/x/sync v0.20.0 + golang.org/x/sys v0.42.0 + golang.org/x/text v0.35.0 + golang.org/x/time v0.15.0 + google.golang.org/grpc v1.80.0 + google.golang.org/protobuf v1.36.11 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/apiserver v0.28.4 - modernc.org/sqlite v1.42.2 + k8s.io/apiserver v0.35.3 + modernc.org/sqlite v1.48.1 ) require ( - ariga.io/atlas v0.31.1-0.20250212144724-069be8033e83 // indirect - filippo.io/edwards25519 v1.1.1 // indirect + ariga.io/atlas v1.1.0 // indirect + dario.cat/mergo v1.0.2 // indirect + filippo.io/edwards25519 v1.2.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect - github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.1 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.18.10 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.6 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.19.14 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.6 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.8.6 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.6 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.6 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.29.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.2 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.38.2 // indirect - github.com/aws/smithy-go v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect + github.com/aws/smithy-go v1.24.3 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bmatcuk/doublestar v1.3.4 // indirect - github.com/bytedance/sonic v1.13.2 // indirect - github.com/bytedance/sonic/loader v0.2.4 // indirect - github.com/cloudwego/base64x v0.1.5 // indirect + github.com/bytedance/gopkg v0.1.4 // indirect + github.com/bytedance/sonic v1.15.0 // indirect + github.com/bytedance/sonic/loader v0.5.1 // indirect + github.com/clipperhouse/uax29/v2 v2.7.0 // indirect + github.com/cloudwego/base64x v0.1.6 // indirect github.com/containerd/errdefs/pkg v0.3.0 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/docker/go-connections v0.6.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/ebitengine/purego v0.8.4 // indirect + github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/gabriel-vasile/mimetype v1.4.8 // indirect - github.com/gin-contrib/sse v1.0.0 // indirect + github.com/fxamacker/cbor/v2 v2.9.1 // indirect + github.com/gabriel-vasile/mimetype v1.4.13 // indirect + github.com/gin-contrib/sse v1.1.1 // indirect + github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-openapi/analysis v0.23.0 // indirect - github.com/go-openapi/inflect v0.19.0 // indirect - github.com/go-openapi/jsonpointer v0.21.0 // indirect - github.com/go-openapi/jsonreference v0.21.0 // indirect - github.com/go-openapi/loads v0.22.0 // indirect - github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-openapi/analysis v0.25.0 // indirect + github.com/go-openapi/inflect v0.21.5 // indirect + github.com/go-openapi/jsonpointer v0.22.5 // indirect + github.com/go-openapi/jsonreference v0.21.5 // indirect + github.com/go-openapi/loads v0.23.3 // indirect + github.com/go-openapi/spec v0.22.4 // indirect + github.com/go-openapi/swag/cmdutils v0.25.5 // indirect + github.com/go-openapi/swag/conv v0.25.5 // indirect + github.com/go-openapi/swag/fileutils v0.25.5 // indirect + github.com/go-openapi/swag/jsonname v0.25.5 // indirect + github.com/go-openapi/swag/jsonutils v0.25.5 // indirect + github.com/go-openapi/swag/loading v0.25.5 // indirect + github.com/go-openapi/swag/mangling v0.25.5 // indirect + github.com/go-openapi/swag/netutils v0.25.5 // indirect + github.com/go-openapi/swag/stringutils v0.25.5 // indirect + github.com/go-openapi/swag/typeutils v0.25.5 // indirect + github.com/go-openapi/swag/yamlutils v0.25.5 // 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.26.0 // indirect - github.com/goccy/go-json v0.10.5 // indirect - github.com/gogo/protobuf v1.3.2 // indirect + github.com/go-playground/validator/v10 v10.30.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/goccy/go-json v0.10.6 // indirect github.com/golang/glog v1.2.5 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/gotnospirit/makeplural v0.0.0-20180622080156-a5f48d94d976 // indirect - github.com/gotnospirit/messageformat v0.0.0-20221001023931-dfe49f1eb092 // indirect - github.com/hashicorp/hcl/v2 v2.13.0 // indirect - github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hashicorp/hcl/v2 v2.24.0 // indirect + github.com/hashicorp/yamux v0.1.2 // indirect github.com/huandu/xstrings v1.5.0 // indirect - github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/chunkreader/v2 v2.0.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.3.3 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgtype v1.14.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/pgtype v1.14.4 // indirect github.com/jonboulle/clockwork v0.5.0 // indirect - github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kaptinlin/go-i18n v0.1.4 // indirect - github.com/kaptinlin/jsonschema v0.4.6 // indirect + github.com/kaptinlin/go-i18n v0.3.1 // indirect + github.com/kaptinlin/jsonpointer v0.4.17 // indirect + github.com/kaptinlin/jsonschema v0.7.7 // indirect + github.com/kaptinlin/messageformat-go v0.4.19 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/compress v1.18.0 // indirect - github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/klauspost/compress v1.18.5 // indirect + github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect - github.com/magefile/mage v1.15.1-0.20250615140142-78acbaf2e3ae // indirect - github.com/mailru/easyjson v0.9.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect + github.com/magefile/mage v1.17.1 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-runewidth v0.0.22 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/ncruces/go-strftime v0.1.9 // indirect - github.com/oklog/run v1.0.0 // indirect - github.com/oklog/ulid v1.3.1 // indirect + github.com/ncruces/go-strftime v1.0.0 // indirect + github.com/oklog/run v1.2.0 // indirect + github.com/oklog/ulid/v2 v2.1.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect - github.com/pelletier/go-toml/v2 v2.2.4 // indirect - github.com/pierrec/lz4/v4 v4.1.18 // indirect + github.com/pelletier/go-toml/v2 v2.3.0 // indirect + github.com/pierrec/lz4/v4 v4.1.26 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/procfs v0.20.1 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/rivo/uniseg v0.4.7 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sergi/go-diff v1.3.1 // indirect github.com/shopspring/decimal v1.4.0 // indirect - github.com/spf13/cast v1.7.0 // indirect - github.com/spf13/pflag v1.0.9 // indirect - github.com/tetratelabs/wazero v1.9.0 // indirect + github.com/spf13/cast v1.10.0 // indirect + github.com/spf13/pflag v1.0.10 // indirect + github.com/tetratelabs/wazero v1.11.0 // indirect github.com/tidwall/gjson v1.18.0 // indirect - github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/match v1.2.0 // indirect github.com/tidwall/pretty v1.2.1 // indirect - github.com/tklauser/go-sysconf v0.3.15 // indirect - github.com/tklauser/numcpus v0.10.0 // indirect - github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 // indirect + github.com/tklauser/go-sysconf v0.3.16 // indirect + github.com/tklauser/numcpus v0.11.0 // indirect + github.com/toorop/go-dkim v0.0.0-20250226130143-9025cce95817 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.12 // indirect + github.com/ugorji/go/codec v1.3.1 // indirect github.com/valllabh/ocsf-schema-golang v1.0.3 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/wasilibs/wazero-helpers v0.0.0-20250123031827-cd30c44769bb // indirect + github.com/x448/float16 v0.8.4 // indirect + github.com/xdg-go/scram v1.2.0 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - github.com/zclconf/go-cty v1.14.4 // indirect - github.com/zclconf/go-cty-yaml v1.1.0 // indirect - go.mongodb.org/mongo-driver v1.14.0 // indirect + github.com/zclconf/go-cty v1.18.0 // indirect + github.com/zclconf/go-cty-yaml v1.2.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect - go.opentelemetry.io/otel v1.39.0 // indirect - go.opentelemetry.io/otel/metric v1.39.0 // indirect - go.opentelemetry.io/otel/trace v1.39.0 // indirect - go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/arch v0.15.0 // indirect - golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect - golang.org/x/term v0.38.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect + go.opentelemetry.io/otel v1.43.0 // indirect + go.opentelemetry.io/otel/metric v1.43.0 // indirect + go.opentelemetry.io/otel/trace v1.43.0 // indirect + go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/arch v0.25.0 // indirect + golang.org/x/term v0.41.0 // indirect + golang.org/x/tools v0.43.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260406210006-6f92a3bedf2d // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect - k8s.io/api v0.28.4 // indirect - k8s.io/apimachinery v0.28.4 // indirect - k8s.io/klog/v2 v2.100.1 // indirect - k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect - modernc.org/libc v1.66.10 // indirect + k8s.io/api v0.35.3 // indirect + k8s.io/apimachinery v0.35.3 // indirect + k8s.io/klog/v2 v2.140.0 // indirect + k8s.io/kube-openapi v0.0.0-20260330154417-16be699c7b31 // indirect + k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 // indirect + modernc.org/libc v1.70.0 // indirect modernc.org/mathutil v1.7.1 // indirect modernc.org/memory v1.11.0 // indirect rsc.io/binaryregexp v0.2.0 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect + sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect ) replace golang.org/x/time => github.com/crowdsecurity/time v0.13.0-crowdsec.20250912 diff --git a/go.sum b/go.sum index b1c7faebc..9fe19854a 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,13 @@ -ariga.io/atlas v0.31.1-0.20250212144724-069be8033e83 h1:nX4HXncwIdvQ8/8sIUIf1nyCkK8qdBaHQ7EtzPpuiGE= -ariga.io/atlas v0.31.1-0.20250212144724-069be8033e83/go.mod h1:Oe1xWPuu5q9LzyrWfbZmEZxFYeu4BHTyzfjeW2aZp/w= +ariga.io/atlas v1.1.0 h1:Dk9Xemh6pr5RogNCsFylf/9ozhSPWDqzHb8EkR2rA78= +ariga.io/atlas v1.1.0/go.mod h1:esBbk3F+pi/mM2PvbCymDm+kWhaOk4PaaiegQdNELk8= bitbucket.org/creachadair/stringset v0.0.9 h1:L4vld9nzPt90UZNrXjNelTshD74ps4P5NGs3Iq6yN3o= bitbucket.org/creachadair/stringset v0.0.9/go.mod h1:t+4WcQ4+PXTa8aQdNKe40ZP6iwesoMFWAxPGd3UGjyY= -entgo.io/ent v0.14.2 h1:ywld/j2Rx4EmnIKs8eZ29cbFA1zpB+DA9TLL5l3rlq0= -entgo.io/ent v0.14.2/go.mod h1:aDPE/OziPEu8+OWbzy4UlvWmD2/kbRuWfK2A40hcxJM= -filippo.io/edwards25519 v1.1.1 h1:YpjwWWlNmGIDyXOn8zLzqiD+9TyIlPhGFG96P39uBpw= -filippo.io/edwards25519 v1.1.1/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= +dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= +entgo.io/ent v0.14.6 h1:/f2696BpwuWAEEG6PVGWflg6+Inrpq4pRWuNlWz/Skk= +entgo.io/ent v0.14.6/go.mod h1:z46QBUdGC+BATwsedbDuREfSS0oSCV+csdEYlL4p73s= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -14,11 +16,10 @@ github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= +github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= +github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= @@ -27,86 +28,86 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/alexliesenfeld/health v0.8.1 h1:wdE3vt+cbJotiR8DGDBZPKHDFoJbAoWEfQTcqrmedUg= github.com/alexliesenfeld/health v0.8.1/go.mod h1:TfNP0f+9WQVWMQRzvMUjlws4ceXKEL3WR+6Hp95HUFc= -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/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/appleboy/gin-jwt/v2 v2.10.3 h1:KNcPC+XPRNpuoBh+j+rgs5bQxN+SwG/0tHbIqpRoBGc= github.com/appleboy/gin-jwt/v2 v2.10.3/go.mod h1:LDUaQ8mF2W6LyXIbd5wqlV2SFebuyYs4RDwqMNgpsp8= github.com/appleboy/gofight/v2 v2.1.2 h1:VOy3jow4vIK8BRQJoC/I9muxyYlJ2yb9ht2hZoS3rf4= github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-lambda-go v1.54.0 h1:EGYpdyRGF88xszqlGcBewz811mJeRS+maNlLZXFheII= github.com/aws/aws-lambda-go v1.54.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A= github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY= github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.1 h1:i8p8P4diljCr60PpJp6qZXNlgX4m2yQFpYk+9ZT+J4E= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.1/go.mod h1:ddqbooRZYNoJ2dsTwOty16rM+/Aqmk/GOXrK8cg7V00= -github.com/aws/aws-sdk-go-v2/config v1.31.6 h1:a1t8fXY4GT4xjyJExz4knbuoxSCacB5hT/WgtfPyLjo= -github.com/aws/aws-sdk-go-v2/config v1.31.6/go.mod h1:5ByscNi7R+ztvOGzeUaIu49vkMk2soq5NaH5PYe33MQ= -github.com/aws/aws-sdk-go-v2/credentials v1.18.10 h1:xdJnXCouCx8Y0NncgoptztUocIYLKeQxrCgN6x9sdhg= -github.com/aws/aws-sdk-go-v2/credentials v1.18.10/go.mod h1:7tQk08ntj914F/5i9jC4+2HQTAuJirq7m1vZVIhEkWs= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.6 h1:wbjnrrMnKew78/juW7I2BtKQwa1qlf6EjQgS69uYY14= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.6/go.mod h1:AtiqqNrDioJXuUgz3+3T0mBWN7Hro2n9wll2zRUc0ww= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.19.4 h1:BTl+TXrpnrpPWb/J3527GsJ/lMkn7z3GO12j6OlsbRg= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.19.4/go.mod h1:cG2tenc/fscpChiZE29a2crG9uo2t6nQGflFllFL8M8= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 h1:eBMB84YGghSocM7PsjmmPffTa+1FBUeNvGvFou6V/4o= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI= +github.com/aws/aws-sdk-go-v2/config v1.32.14 h1:opVIRo/ZbbI8OIqSOKmpFaY7IwfFUOCCXBsUpJOwDdI= +github.com/aws/aws-sdk-go-v2/config v1.32.14/go.mod h1:U4/V0uKxh0Tl5sxmCBZ3AecYny4UNlVmObYjKuuaiOo= +github.com/aws/aws-sdk-go-v2/credentials v1.19.14 h1:n+UcGWAIZHkXzYt87uMFBv/l8THYELoX6gVcUvgl6fI= +github.com/aws/aws-sdk-go-v2/credentials v1.19.14/go.mod h1:cJKuyWB59Mqi0jM3nFYQRmnHVQIcgoxjEMAbLkpr62w= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 h1:NUS3K4BTDArQqNu2ih7yeDLaS3bmHD0YndtA6UP884g= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21/go.mod h1:YWNWJQNjKigKY1RHVJCuupeWDrrHjRqHm0N9rdrWzYI= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.12 h1:vhbHvVM9Til68SOR3Dds7zi51PaUlzexmh4Lf/uv+Ok= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.12/go.mod h1:jq4soyz7xX5bfkxVKQu1BwkopF2QbQUTs5n7iIg3D8Q= github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4= github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21/go.mod h1:p+hz+PRAYlY3zcpJhPwXlLC4C+kqn70WIHwnzAfs6ps= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d2KyU5X/BZxjOkRo= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.6 h1:R0tNFJqfjHL3900cqhXuwQ+1K4G0xc9Yf8EDbFXCKEw= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.6/go.mod h1:y/7sDdu+aJvPtGXr4xYosdpq9a6T9Z0jkXfugmti0rI= -github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.57.2 h1:TSNLZXt7ipIV+Q+GZAQ8dUxYUDsMX2/Atrn/YuPF3zI= -github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.57.2/go.mod h1:mSt0uBAxUj2dnagbjc7p+Jh68SSwgDTNzMKUjchDiOY= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 h1:oegbebPEMA/1Jny7kvwejowCaHz1FWZAQ94WXFNCyTM= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1/go.mod h1:kemo5Myr9ac0U9JfSjMo9yHLtw+pECEHsFtJ9tqCEI8= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.8.6 h1:hncKj/4gR+TPauZgTAsxOxNcvBayhUlYZ6LO/BYiQ30= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.8.6/go.mod h1:OiIh45tp6HdJDDJGnja0mw8ihQGz3VGrUflLqSL0SmM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.6 h1:LHS1YAIJXJ4K9zS+1d/xa9JAA9sL2QyXIQCQFQW/X08= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.6/go.mod h1:c9PCiTEuh0wQID5/KqA32J+HAgZxN9tOGXKCiYJjTZI= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.6 h1:nEXUSAwyUfLTgnc9cxlDWy637qsq4UWwp3sNAfl0Z3Y= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.6/go.mod h1:HGzIULx4Ge3Do2V0FaiYKcyKzOqwrhUZgCI77NisswQ= -github.com/aws/aws-sdk-go-v2/service/kinesis v1.40.1 h1:9QC0AF6gakV1TZuGp3NEUNl/6gXt3rfIifnxd+dWwbw= -github.com/aws/aws-sdk-go-v2/service/kinesis v1.40.1/go.mod h1:UpSQbmXxFiDGDrvqsTgEm3YijDf9cg/Ti+s2W0SeFEU= -github.com/aws/aws-sdk-go-v2/service/s3 v1.87.3 h1:ETkfWcXP2KNPLecaDa++5bsQhCRa5M5sLUJa5DWYIIg= -github.com/aws/aws-sdk-go-v2/service/s3 v1.87.3/go.mod h1:+/3ZTqoYb3Ur7DObD00tarKMLMuKg8iqz5CHEanqTnw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 h1:qYQ4pzQ2Oz6WpQ8T3HvGHnZydA72MnLuFK9tJwmrbHw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6/go.mod h1:O3h0IK87yXci+kg6flUKzJnWeziQUKciKrLjcatSNcY= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 h1:rWyie/PxDRIdhNf4DzRk0lvjVOqFJuNnO8WwaIRVxzQ= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22/go.mod h1:zd/JsJ4P7oGfUhXn1VyLqaRZwPmZwg44Jf2dS84Dm3Y= +github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.68.0 h1:+/lmB/+i2oqkzbmlQxsW0kr/+wmJgmyiEF9VDJicX34= +github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.68.0/go.mod h1:PobeppEnIjw4pcgjFryNDZCTH7AiqZw0yb5r98Gvf9c= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 h1:JRaIgADQS/U6uXDqlPiefP32yXTda7Kqfx+LgspooZM= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13/go.mod h1:CEuVn5WqOMilYl+tbccq8+N2ieCy0gVn3OtRb0vBNNM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 h1:c31//R3xgIJMSC8S6hEVq+38DcvUlgFY0FM6mSI5oto= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21/go.mod h1:r6+pf23ouCB718FUxaqzZdbpYFyDtehyZcmP5KL9FkA= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 h1:ZlvrNcHSFFWURB8avufQq9gFsheUgjVD9536obIknfM= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21/go.mod h1:cv3TNhVrssKR0O/xxLJVRfd2oazSnZnkUeTf6ctUwfQ= +github.com/aws/aws-sdk-go-v2/service/kinesis v1.43.5 h1:LxgRVyuY+5DEPSX7kmin/V7toE8MWZ9U8n2dqRtX+RE= +github.com/aws/aws-sdk-go-v2/service/kinesis v1.43.5/go.mod h1:eUebEBEqVfOwEyDDDbGauH4PNqDCuepRvTaNbJeWr5w= +github.com/aws/aws-sdk-go-v2/service/s3 v1.98.0 h1:foqo/ocQ7WqKwy3FojGtZQJo0FR4vto9qnz9VaumbCo= +github.com/aws/aws-sdk-go-v2/service/s3 v1.98.0/go.mod h1:uoA43SdFwacedBfSgfFSjjCvYe8aYBS7EnU5GZ/YKMM= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 h1:QKZH0S178gCmFEgst8hN0mCX1KxLgHBKKY/CLqwP8lg= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.9/go.mod h1:7yuQJoT+OoH8aqIxw9vwF+8KpvLZ8AWmvmUWHsGQZvI= github.com/aws/aws-sdk-go-v2/service/sqs v1.42.25 h1:8Bv3TQ1Cob6HLlpUbAnWxeHhAkYScJO9RIHh2WPXaxw= github.com/aws/aws-sdk-go-v2/service/sqs v1.42.25/go.mod h1:eDstEbM0OEnBUnNQxIA7j74Jy61cCU1S4EMlCtdMwzs= -github.com/aws/aws-sdk-go-v2/service/sso v1.29.1 h1:8OLZnVJPvjnrxEwHFg9hVUof/P4sibH+Ea4KKuqAGSg= -github.com/aws/aws-sdk-go-v2/service/sso v1.29.1/go.mod h1:27M3BpVi0C02UiQh1w9nsBEit6pLhlaH3NHna6WUbDE= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.2 h1:gKWSTnqudpo8dAxqBqZnDoDWCiEh/40FziUjr/mo6uA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.34.2/go.mod h1:x7+rkNmRoEN1U13A6JE2fXne9EWyJy54o3n6d4mGaXQ= -github.com/aws/aws-sdk-go-v2/service/sts v1.38.2 h1:YZPjhyaGzhDQEvsffDEcpycq49nl7fiGcfJTIo8BszI= -github.com/aws/aws-sdk-go-v2/service/sts v1.38.2/go.mod h1:2dIN8qhQfv37BdUYGgEC8Q3tteM3zFxTI1MLO2O3J3c= -github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng= -github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= -github.com/beevik/etree v1.4.1 h1:PmQJDDYahBGNKDcpdX8uPy1xRCwoCGVUiW669MEirVI= -github.com/beevik/etree v1.4.1/go.mod h1:gPNJNaBGVZ9AwsidazFZyygnd+0pAU38N4D+WemwKNs= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 h1:lFd1+ZSEYJZYvv9d6kXzhkZu07si3f+GQ1AaYwa2LUM= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.15/go.mod h1:WSvS1NLr7JaPunCXqpJnWk1Bjo7IxzZXrZi1QQCkuqM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 h1:dzztQ1YmfPrxdrOiuZRMF6fuOwWlWpD2StNLTceKpys= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19/go.mod h1:YO8TrYtFdl5w/4vmjL8zaBSsiNp3w0L1FfKVKenZT7w= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 h1:p8ogvvLugcR/zLBXTXrTkj0RYBUdErbMnAFFp12Lm/U= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.10/go.mod h1:60dv0eZJfeVXfbT1tFJinbHrDfSJ2GZl4Q//OSSNAVw= +github.com/aws/smithy-go v1.24.3 h1:XgOAaUgx+HhVBoP4v8n6HCQoTRDhoMghKqw4LNHsDNg= +github.com/aws/smithy-go v1.24.3/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/beevik/etree v1.6.0 h1:u8Kwy8pp9D9XeITj2Z0XtA5qqZEmtJtuXZRQi+j03eE= +github.com/beevik/etree v1.6.0/go.mod h1:bh4zJxiIr62SOf9pRzN7UUYaEDa9HEKafK25+sLc0Gc= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw= github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= 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/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= +github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk= github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= -github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ= -github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= -github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= -github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM= +github.com/bytedance/gopkg v0.1.4/go.mod h1:v1zWfPm21Fb+OsyXN2VAHdL6TBb2L88anLQgdyje6R4= +github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE= +github.com/bytedance/sonic v1.15.0/go.mod h1:tFkWrPz0/CUCLEF4ri4UkHekCIcdnkqXw9VduqpJh0k= +github.com/bytedance/sonic/loader v0.5.1 h1:Ygpfa9zwRCCKSlrp5bBP/b/Xzc3VxsAW+5NIYXrOOpI= +github.com/bytedance/sonic/loader v0.5.1/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= 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.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= -github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= -github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= +github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= +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/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= @@ -115,15 +116,16 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= github.com/corazawaf/coraza-coreruleset v0.0.0-20240226094324-415b1017abdc h1:OlJhrgI3I+FLUCTI3JJW8MoqyM78WbqJjecqMnqG+wc= github.com/corazawaf/coraza-coreruleset v0.0.0-20240226094324-415b1017abdc/go.mod h1:7rsocqNDkTCira5T0M7buoKR2ehh7YZiPkzxRuAgvVU= -github.com/corazawaf/libinjection-go v0.2.2 h1:Chzodvb6+NXh6wew5/yhD0Ggioif9ACrQGR4qjTCs1g= -github.com/corazawaf/libinjection-go v0.2.2/go.mod h1:OP4TM7xdJ2skyXqNX1AN1wN5nNZEmJNuWbNPOItn7aw= +github.com/corazawaf/libinjection-go v0.3.2 h1:9rrKt0lpg4WvUXt+lwS06GywfqRXXsa/7JcOw5cQLwI= +github.com/corazawaf/libinjection-go v0.3.2/go.mod h1:Ik/+w3UmTWH9yn366RgS9D95K3y7Atb5m/H/gXzzPCk= 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/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= +github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= +github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= @@ -155,13 +157,13 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4 github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= -github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= -github.com/expr-lang/expr v1.17.7 h1:Q0xY/e/2aCIp8g9s/LGvMDCC5PxYlvHgDZRQ4y16JX8= -github.com/expr-lang/expr v1.17.7/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= +github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= +github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/expr-lang/expr v1.17.8 h1:W1loDTT+0PQf5YteHSTpju2qfUfNoBt4yw9+wOEU9VM= +github.com/expr-lang/expr v1.17.8/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= -github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= +github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/foxcpp/go-mockdns v1.1.0 h1:jI0rD8M0wuYAxL7r/ynTrCQQq0BVqfB99Vgk7DlmewI= @@ -171,68 +173,99 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= -github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= +github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ= +github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM= +github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gin-contrib/gzip v1.2.3 h1:dAhT722RuEG330ce2agAs75z7yB+NKvX/ZM1r8w0u2U= github.com/gin-contrib/gzip v1.2.3/go.mod h1:ad72i4Bzmaypk8M762gNXa2wkxxjbz0icRNnuLJ9a/c= -github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E= -github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0= +github.com/gin-contrib/sse v1.1.1 h1:uGYpNwTacv5R68bSGMapo62iLTRa9l5zxGCps4hK6ko= +github.com/gin-contrib/sse v1.1.1/go.mod h1:QXzuVkA0YO7o/gun03UI1Q+FTI8ZV/n5t03kIQAI89s= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= -github.com/go-co-op/gocron/v2 v2.19.1 h1:B4iLeA0NB/2iO3EKQ7NfKn5KsQgZfjb2fkvoZJU3yBI= -github.com/go-co-op/gocron/v2 v2.19.1/go.mod h1:5lEiCKk1oVJV39Zg7/YG10OnaVrDAV5GGR6O0663k6U= +github.com/go-co-op/gocron/v2 v2.20.0 h1:9IMrnnVSWjfSh3E54gWmWCHbloQJLh6f9+nwyKfLNpc= +github.com/go-co-op/gocron/v2 v2.20.0/go.mod h1:5lEiCKk1oVJV39Zg7/YG10OnaVrDAV5GGR6O0663k6U= +github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 h1:vymEbVwYFP/L05h5TKQxvkXoKxNvTpjxYKdF1Nlwuao= +github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU= -github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= -github.com/go-openapi/errors v0.22.2 h1:rdxhzcBUazEcGccKqbY1Y7NS8FDcMyIRr0934jrYnZg= -github.com/go-openapi/errors v0.22.2/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0= -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-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= -github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= -github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= -github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco= -github.com/go-openapi/loads v0.22.0/go.mod h1:yLsaTCS92mnSAZX5WWoxszLj0u+Ojl+Zs5Stn1oF+rs= -github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= -github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= -github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= -github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= -github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= -github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= -github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= -github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-openapi/analysis v0.25.0 h1:EnjAq1yO8wEO9HbPmY8vLPEIkdZuuFhCAKBPvCB7bCs= +github.com/go-openapi/analysis v0.25.0/go.mod h1:5WFTRE43WLkPG9r9OtlMfqkkvUTYLVVCIxLlEpyF8kE= +github.com/go-openapi/errors v0.22.7 h1:JLFBGC0Apwdzw3484MmBqspjPbwa2SHvpDm0u5aGhUA= +github.com/go-openapi/errors v0.22.7/go.mod h1://QW6SD9OsWtH6gHllUCddOXDL0tk0ZGNYHwsw4sW3w= +github.com/go-openapi/inflect v0.21.5 h1:M2RCq6PPS3YbIaL7CXosGL3BbzAcmfBAT0nC3YfesZA= +github.com/go-openapi/inflect v0.21.5/go.mod h1:GypUyi6bU880NYurWaEH2CmH84zFDNd+EhhmzroHmB4= +github.com/go-openapi/jsonpointer v0.22.5 h1:8on/0Yp4uTb9f4XvTrM2+1CPrV05QPZXu+rvu2o9jcA= +github.com/go-openapi/jsonpointer v0.22.5/go.mod h1:gyUR3sCvGSWchA2sUBJGluYMbe1zazrYWIkWPjjMUY0= +github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= +github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= +github.com/go-openapi/loads v0.23.3 h1:g5Xap1JfwKkUnZdn+S0L3SzBDpcTIYzZ5Qaag0YDkKQ= +github.com/go-openapi/loads v0.23.3/go.mod h1:NOH07zLajXo8y55hom0omlHWDVVvCwBM/S+csCK8LqA= +github.com/go-openapi/spec v0.22.4 h1:4pxGjipMKu0FzFiu/DPwN3CTBRlVM2yLf/YTWorYfDQ= +github.com/go-openapi/spec v0.22.4/go.mod h1:WQ6Ai0VPWMZgMT4XySjlRIE6GP1bGQOtEThn3gcWLtQ= +github.com/go-openapi/strfmt v0.26.1 h1:7zGCHji7zSYDC2tCXIusoxYQz/48jAf2q+sF6wXTG+c= +github.com/go-openapi/strfmt v0.26.1/go.mod h1:Zslk5VZPOISLwmWTMBIS7oiVFem1o1EI6zULY8Uer7Y= +github.com/go-openapi/swag v0.25.5 h1:pNkwbUEeGwMtcgxDr+2GBPAk4kT+kJ+AaB+TMKAg+TU= +github.com/go-openapi/swag v0.25.5/go.mod h1:B3RT6l8q7X803JRxa2e59tHOiZlX1t8viplOcs9CwTA= +github.com/go-openapi/swag/cmdutils v0.25.5 h1:yh5hHrpgsw4NwM9KAEtaDTXILYzdXh/I8Whhx9hKj7c= +github.com/go-openapi/swag/cmdutils v0.25.5/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0= +github.com/go-openapi/swag/conv v0.25.5 h1:wAXBYEXJjoKwE5+vc9YHhpQOFj2JYBMF2DUi+tGu97g= +github.com/go-openapi/swag/conv v0.25.5/go.mod h1:CuJ1eWvh1c4ORKx7unQnFGyvBbNlRKbnRyAvDvzWA4k= +github.com/go-openapi/swag/fileutils v0.25.5 h1:B6JTdOcs2c0dBIs9HnkyTW+5gC+8NIhVBUwERkFhMWk= +github.com/go-openapi/swag/fileutils v0.25.5/go.mod h1:V3cT9UdMQIaH4WiTrUc9EPtVA4txS0TOmRURmhGF4kc= +github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3US3uUYSFhSo= +github.com/go-openapi/swag/jsonname v0.25.5/go.mod h1:jNqqikyiAK56uS7n8sLkdaNY/uq6+D2m2LANat09pKU= +github.com/go-openapi/swag/jsonutils v0.25.5 h1:XUZF8awQr75MXeC+/iaw5usY/iM7nXPDwdG3Jbl9vYo= +github.com/go-openapi/swag/jsonutils v0.25.5/go.mod h1:48FXUaz8YsDAA9s5AnaUvAmry1UcLcNVWUjY42XkrN4= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5 h1:SX6sE4FrGb4sEnnxbFL/25yZBb5Hcg1inLeErd86Y1U= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5/go.mod h1:/2KvOTrKWjVA5Xli3DZWdMCZDzz3uV/T7bXwrKWPquo= +github.com/go-openapi/swag/loading v0.25.5 h1:odQ/umlIZ1ZVRteI6ckSrvP6e2w9UTF5qgNdemJHjuU= +github.com/go-openapi/swag/loading v0.25.5/go.mod h1:I8A8RaaQ4DApxhPSWLNYWh9NvmX2YKMoB9nwvv6oW6g= +github.com/go-openapi/swag/mangling v0.25.5 h1:hyrnvbQRS7vKePQPHHDso+k6CGn5ZBs5232UqWZmJZw= +github.com/go-openapi/swag/mangling v0.25.5/go.mod h1:6hadXM/o312N/h98RwByLg088U61TPGiltQn71Iw0NY= +github.com/go-openapi/swag/netutils v0.25.5 h1:LZq2Xc2QI8+7838elRAaPCeqJnHODfSyOa7ZGfxDKlU= +github.com/go-openapi/swag/netutils v0.25.5/go.mod h1:lHbtmj4m57APG/8H7ZcMMSWzNqIQcu0RFiXrPUara14= +github.com/go-openapi/swag/stringutils v0.25.5 h1:NVkoDOA8YBgtAR/zvCx5rhJKtZF3IzXcDdwOsYzrB6M= +github.com/go-openapi/swag/stringutils v0.25.5/go.mod h1:PKK8EZdu4QJq8iezt17HM8RXnLAzY7gW0O1KKarrZII= +github.com/go-openapi/swag/typeutils v0.25.5 h1:EFJ+PCga2HfHGdo8s8VJXEVbeXRCYwzzr9u4rJk7L7E= +github.com/go-openapi/swag/typeutils v0.25.5/go.mod h1:itmFmScAYE1bSD8C4rS0W+0InZUBrB2xSPbWt6DLGuc= +github.com/go-openapi/swag/yamlutils v0.25.5 h1:kASCIS+oIeoc55j28T4o8KwlV2S4ZLPT6G0iq2SSbVQ= +github.com/go-openapi/swag/yamlutils v0.25.5/go.mod h1:Gek1/SjjfbYvM+Iq4QGwa/2lEXde9n2j4a3wI3pNuOQ= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.1 h1:NZOrZmIb6PTv5LTFxr5/mKV/FjbUzGE7E6gLz7vFoOQ= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.1/go.mod h1:r7dwsujEHawapMsxA69i+XMGZrQ5tRauhLAjV/sxg3Q= +github.com/go-openapi/testify/v2 v2.4.1 h1:zB34HDKj4tHwyUQHrUkpV0Q0iXQ6dUCOQtIqn8hE6Iw= +github.com/go-openapi/testify/v2 v2.4.1/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54= +github.com/go-openapi/validate v0.25.2 h1:12NsfLAwGegqbGWr2CnvT65X/Q2USJipmJ9b7xDJZz0= +github.com/go-openapi/validate v0.25.2/go.mod h1:Pgl1LpPPGFnZ+ys4/hTlDiRYQdI1ocKypgE+8Q8BLfY= 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.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= -github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= +github.com/go-playground/validator/v10 v10.30.2 h1:JiFIMtSSHb2/XBUbWM4i/MpeQm9ZK2xqPNk8vgvu5JQ= +github.com/go-playground/validator/v10 v10.30.2/go.mod h1:mAf2pIOVXjTEBrwUMGKkCWKKPs9NheYGabeB04txQSc= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= -github.com/go-test/deep v1.0.4/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/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= +github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU= +github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/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/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v1.2.5 h1:DrW6hGnjIhtvhOIiAKT6Psh/Kd/ldepEa81DKeiRJ5I= @@ -243,52 +276,41 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 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/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 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/google/winops v0.0.0-20230712152054-af9b550d0601 h1:XvlrmqZIuwxuRE88S9mkxX+FkV+YakqbiAC5Z4OzDnM= -github.com/google/winops v0.0.0-20230712152054-af9b550d0601/go.mod h1:rT1mcjzuvcDDbRmUTsoH6kV0DG91AkFe9UCjASraK5I= +github.com/google/winops v0.0.0-20260218212338-878c3f651658 h1:TLRvGW+2zxbeIeS35tM07zrpiu3uvP82g48i43AOorI= +github.com/google/winops v0.0.0-20260218212338-878c3f651658/go.mod h1:LzJ1k+theAY9oqZYuOpAxE559bLZqxDt6qi8epvQ15g= github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e h1:XmA6L9IPRdUr28a+SK/oMchGgQy159wvzXA5tJ7l+40= github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e/go.mod h1:AFIo+02s+12CEg8Gzz9kzhCbmbq6JcKNrhHffCGA9z4= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gotnospirit/makeplural v0.0.0-20180622080156-a5f48d94d976 h1:b70jEaX2iaJSPZULSUxKtm73LBfsCrMsIlYCUgNGSIs= -github.com/gotnospirit/makeplural v0.0.0-20180622080156-a5f48d94d976/go.mod h1:ZGQeOwybjD8lkCjIyJfqR5LD2wMVHJ31d6GdPxoTsWY= -github.com/gotnospirit/messageformat v0.0.0-20221001023931-dfe49f1eb092 h1:c7gcNWTSr1gtLp6PyYi3wzvFCEcHJ4YRobDgqmIgf7Q= -github.com/gotnospirit/messageformat v0.0.0-20221001023931-dfe49f1eb092/go.mod h1:ZZAN4fkkful3l1lpJwF8JbW41ZiG9TwJ2ZlqzQovBNU= -github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= -github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-plugin v1.6.3 h1:xgHB+ZUSYeuJi96WtxEjzi23uh7YQpznjGh0U0UUrwg= -github.com/hashicorp/go-plugin v1.6.3/go.mod h1:MRobyh+Wc/nYy1V4KAXUiYfzxoYhs7V1mlH1Z7iY2h0= -github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= -github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc= -github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo= +github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshfk+mA= +github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= +github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= +github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +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/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= +github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -324,54 +346,56 @@ github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwX 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 h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= 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.14.0 h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw= 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.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU= 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.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jarcoal/httpmock v1.1.0 h1:F47ChZj1Y2zFsCXxNkBPwNNKnAyOATcdQibk0qEdVCE= github.com/jarcoal/httpmock v1.1.0/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= github.com/jcchavezs/mergefs v0.1.0 h1:7oteO7Ocl/fnfFMkoVLJxTveCjrsd//UB0j89xmnpec= github.com/jcchavezs/mergefs v0.1.0/go.mod h1:eRLTrsA+vFwQZ48hj8p8gki/5v9C2bFtHH5Mnn4bcGk= -github.com/jedib0t/go-pretty/v6 v6.6.7 h1:m+LbHpm0aIAPLzLbMfn8dc3Ht8MW7lsSO4MPItz/Uuo= -github.com/jedib0t/go-pretty/v6 v6.6.7/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jedib0t/go-pretty/v6 v6.7.9 h1:frarzQWmkZd97syT81+TH8INKPpzoxQnk+Mk5EIHSrM= +github.com/jedib0t/go-pretty/v6 v6.7.9/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= +github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= +github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I= github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= 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/jszwec/csvutil v1.5.1 h1:c3GFBhj6DFMUl4dMK3+B6rz2+LWWS/e9VJiVJ9t9kfQ= -github.com/jszwec/csvutil v1.5.1/go.mod h1:Rpu7Uu9giO9subDyMCIQfHVDuLrcaC36UA4YcJjGBkg= -github.com/kaptinlin/go-i18n v0.1.4 h1:wCiwAn1LOcvymvWIVAM4m5dUAMiHunTdEubLDk4hTGs= -github.com/kaptinlin/go-i18n v0.1.4/go.mod h1:g1fn1GvTgT4CiLE8/fFE1hboHWJ6erivrDpiDtCcFKg= -github.com/kaptinlin/jsonschema v0.4.6 h1:vOSFg5tjmfkOdKg+D6Oo4fVOM/pActWu/ntkPsI1T64= -github.com/kaptinlin/jsonschema v0.4.6/go.mod h1:1DUd7r5SdyB2ZnMtyB7uLv64dE3zTFTiYytDCd+AEL0= +github.com/jszwec/csvutil v1.10.0 h1:upMDUxhQKqZ5ZDCs/wy+8Kib8rZR8I8lOR34yJkdqhI= +github.com/jszwec/csvutil v1.10.0/go.mod h1:/E4ONrmGkwmWsk9ae9jpXnv9QT8pLHEPcCirMFhxG9I= +github.com/kaptinlin/go-i18n v0.3.1 h1:plXi3XQE1aYamFi8TU0K6actODmw2+5FSobmhTkfQ/0= +github.com/kaptinlin/go-i18n v0.3.1/go.mod h1:ZRoAHj7elWYamfbv7wev7Ajch6LOzjtBaq8nWe8HIVk= +github.com/kaptinlin/jsonpointer v0.4.17 h1:mY9k8ciWncxbsECyaxKnR0MdmxamNdp2tLQkAKVrtSk= +github.com/kaptinlin/jsonpointer v0.4.17/go.mod h1:SsfsjqnHG5zuKo1DTBzk1VknaHlL4osHw+X9kZKukpU= +github.com/kaptinlin/jsonschema v0.7.7 h1:41BlQJ9dskH0oE5DSzBUrl/w4JQYIr6N6L0B5GNyDoM= +github.com/kaptinlin/jsonschema v0.7.7/go.mod h1:rKjWfyySHSxAD7Li2ctYkPlOu960igoKBvZ2ADRtd5Q= +github.com/kaptinlin/messageformat-go v0.4.19 h1:A5kuuZ1ybXDQ7kD1aoEWGAOemX7hLsMY0yolgSbgpRI= +github.com/kaptinlin/messageformat-go v0.4.19/go.mod h1:utSDTfiXTxl66OC5RIEuObLH7Ue3YjbA2X86SYMBYWg= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= -github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= -github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= +github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +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/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -391,84 +415,78 @@ 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/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/magefile/mage v1.15.1-0.20250615140142-78acbaf2e3ae h1:yyMUG1VUd6IjV5jonMKpLXgwm9AzkfRsYisdCXc5OVI= -github.com/magefile/mage v1.15.1-0.20250615140142-78acbaf2e3ae/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= -github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= -github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= +github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e h1:Q6MvJtQK/iRcRtzAscm/zF23XxJlbECiGPyRicsX+Ak= +github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= +github.com/magefile/mage v1.17.1 h1:F1d2lnLSlbQDM0Plq6Ac4NtaHxkxTK8t5nrMY9SkoNA= +github.com/magefile/mage v1.17.1/go.mod h1:Yj51kqllmsgFpvvSzgrZPK9WtluG3kUhFaBUVLo4feA= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= 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.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 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-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= -github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= +github.com/mattn/go-runewidth v0.0.22 h1:76lXsPn6FyHtTY+jt2fTTvsMUCZq1k0qwRsAMuxzKAk= +github.com/mattn/go-runewidth v0.0.22/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= +github.com/mattn/go-sqlite3 v1.14.41 h1:8p7Pwz5NHkEbWSqc/ygU4CBGubhFFkpgP9KwcdkAHNA= +github.com/mattn/go-sqlite3 v1.14.41/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM= github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= 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/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/moby/moby/api v1.52.1-0.20251116162601-e9ff10bf365a h1:/97LpoYpSfeEBEYLuGUAsVeXRMpCk0DK83syOo9avgs= -github.com/moby/moby/api v1.52.1-0.20251116162601-e9ff10bf365a/go.mod h1:8mb+ReTlisw4pS6BRzCMts5M49W5M7bKt1cJy/YbAqc= -github.com/moby/moby/client v0.1.1-0.20251116162601-e9ff10bf365a h1:wWpHaCQpsJj8n2xXGuut03VTjlV3/w3I/IOJVtYomkA= -github.com/moby/moby/client v0.1.1-0.20251116162601-e9ff10bf365a/go.mod h1:O+/tw5d4a1Ha/ZA/tPxIZJapJRUS6LNZ1wiVRxYHyUE= +github.com/moby/moby/api v1.54.1 h1:TqVzuJkOLsgLDDwNLmYqACUuTehOHRGKiPhvH8V3Nn4= +github.com/moby/moby/api v1.54.1/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= +github.com/moby/moby/client v0.4.0 h1:S+2XegzHQrrvTCvF6s5HFzcrywWQmuVnhOXe2kiWjIw= +github.com/moby/moby/client v0.4.0/go.mod h1:QWPbvWchQbxBNdaLSpoKpCdf5E+WxFAgNHogCWDoa7g= 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 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= -github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= +github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= -github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/oklog/run v1.2.0 h1:O8x3yXwah4A73hJdlrwo/2X6J62gE5qTMusH0dvz60E= +github.com/oklog/run v1.2.0/go.mod h1:mgDbKRSwPhJfesJ4PntqFUbKQRZ50NgmZTSPlFA0YFk= +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/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/oschwald/geoip2-golang v1.9.0 h1:uvD3O6fXAXs+usU+UGExshpdP13GAqp4GBrzN7IgKZc= -github.com/oschwald/geoip2-golang v1.9.0/go.mod h1:BHK6TvDyATVQhKNbQBdrj9eAvuwOMi2zSFXizL3K81Y= -github.com/oschwald/maxminddb-golang v1.12.0 h1:9FnTOD0YOhP7DGxGsq4glzpGy5+w7pq50AS6wALUMYs= -github.com/oschwald/maxminddb-golang v1.12.0/go.mod h1:q0Nob5lTCqyQ8WT6FYgS1L7PXKVVbgiymefNwIjPzgY= -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/oschwald/geoip2-golang v1.13.0 h1:Q44/Ldc703pasJeP5V9+aFSZFmBN7DKHbNsSFzQATJI= +github.com/oschwald/geoip2-golang v1.13.0/go.mod h1:P9zG+54KPEFOliZ29i7SeYZ/GM6tfEL+rgSn03hYuUo= +github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE= +github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8= +github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= +github.com/pelletier/go-toml/v2 v2.3.0 h1:k59bC/lIZREW0/iVaQR8nDHxVq8OVlIzYCOJf421CaM= +github.com/pelletier/go-toml/v2 v2.3.0/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/petar-dambovaliev/aho-corasick v0.0.0-20250424160509-463d218d4745 h1:Vpr4VgAizEgEZsaMohpw6JYDP+i9Of9dmdY4ufNP6HI= github.com/petar-dambovaliev/aho-corasick v0.0.0-20250424160509-463d218d4745/go.mod h1:EHPiTAKtiFmrMldLUNswFwfZ2eJIYBHktdaUTZxYWRw= -github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= -github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.26 h1:GrpZw1gZttORinvzBdXPUXATeqlJjqUG/D87TKMnhjY= +github.com/pierrec/lz4/v4 v4.1.26/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= 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= @@ -482,17 +500,14 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= +github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= github.com/r3labs/diff/v2 v2.15.1 h1:EOrVqPUzi+njlumoqJwiS/TgGgmZo83619FNDB9xQUg= github.com/r3labs/diff/v2 v2.15.1/go.mod h1:I8noH9Fc2fjSaMxqF3G2lhDdC0b+JXCfyx85tWFM9kc= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -508,31 +523,29 @@ github.com/sanity-io/litter v1.5.8/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ= github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/segmentio/kafka-go v0.4.48 h1:9jyu9CWK4W5W+SroCe8EffbrRZVqAOkuaLd/ApID4Vs= -github.com/segmentio/kafka-go v0.4.48/go.mod h1:HjF6XbOKh0Pjlkr5GVZxt6CsjjwnmhVOfURM5KMd8qg= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= -github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/shirou/gopsutil/v4 v4.25.8 h1:NnAsw9lN7587WHxjJA9ryDnqhJpFH6A+wagYWTOH970= -github.com/shirou/gopsutil/v4 v4.25.8/go.mod h1:q9QdMmfAOVIw7a+eF86P7ISEU6ka+NLgkUxlopV4RwI= +github.com/segmentio/kafka-go v0.4.50 h1:mcyC3tT5WeyWzrFbd6O374t+hmcu1NKt2Pu1L3QaXmc= +github.com/segmentio/kafka-go v0.4.50/go.mod h1:Y1gn60kzLEEaW28YshXyk2+VCUKbJ3Qr6DrnT3i4+9E= +github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= +github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= 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.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/slack-go/slack v0.16.0 h1:khp/WCFv+Hb/B/AJaAwvcxKun0hM6grN0bUZ8xG60P8= -github.com/slack-go/slack v0.16.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= -github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= +github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= +github.com/slack-go/slack v0.21.0 h1:TAGnZYFp79LAG/oqFzYhFJ9LwEwXJ93heCkPvwjxc7o= +github.com/slack-go/slack v0.21.0/go.mod h1:K81UmCivcYd/5Jmz8vLBfuyoZ3B4rQC2GHVXHteXiAE= +github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= +github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= -github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 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/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -555,25 +568,27 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 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/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= -github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= +github.com/tetratelabs/wazero v1.11.0 h1:+gKemEuKCTevU4d7ZTzlsvgd1uaToIDtlQlmNbwqYhA= +github.com/tetratelabs/wazero v1.11.0/go.mod h1:eV28rsN8Q+xwjogd7f4/Pp4xFxO7uOGbLcD/LzB1wiU= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM= +github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4= -github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4= -github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso= -github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ= -github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 h1:PM5hJF7HVfNWmCjMdEfbuOBNXSVF2cMFGgQTPdKCbwM= +github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= +github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= +github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= +github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208/go.mod h1:BzWtXXrXzZUvMacR0oF/fbDDgUPO8L36tDMmRAf14ns= +github.com/toorop/go-dkim v0.0.0-20250226130143-9025cce95817 h1:q0hKh5a5FRkhuTb5JNfgjzpzvYLHjH0QOgPZPYnRWGA= +github.com/toorop/go-dkim v0.0.0-20250226130143-9025cce95817/go.mod h1:BzWtXXrXzZUvMacR0oF/fbDDgUPO8L36tDMmRAf14ns= 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.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= -github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY= +github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= github.com/umahmood/haversine v0.0.0-20151105152445-808ab04add26 h1:UFHFmFfixpmfRBcxuu+LA9l8MdURWVdVNUHxO5n1d2w= github.com/umahmood/haversine v0.0.0-20151105152445-808ab04add26/go.mod h1:IGhd0qMDsUa9acVjsbsT7bu3ktadtGOHI79+idTew/M= github.com/valllabh/ocsf-schema-golang v1.0.3 h1:eR8k/3jP/OOqB8LRCtdJ4U+vlgd/gk5y3KMXoodrsrw= @@ -586,42 +601,42 @@ github.com/wasilibs/go-re2 v1.10.0 h1:vQZEBYZOCA9jdBMmrO4+CvqyCj0x4OomXTJ4a5/urQ github.com/wasilibs/go-re2 v1.10.0/go.mod h1:k+5XqO2bCJS+QpGOnqugyfwC04nw0jaglmjrrkG8U6o= github.com/wasilibs/wazero-helpers v0.0.0-20250123031827-cd30c44769bb h1:gQ+ZV4wJke/EBKYciZ2MshEouEHFuinB85dY3f5s1q8= github.com/wasilibs/wazero-helpers v0.0.0-20250123031827-cd30c44769bb/go.mod h1:jMeV4Vpbi8osrE/pKUxRZkVaA0EX7NZN0A9/oRzgpgY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/scram v1.2.0 h1:bYKF2AEwG5rqd1BumT4gAnvwU/M9nBp2pTSxeZw7Wvs= +github.com/xdg-go/scram v1.2.0/go.mod h1:3dlrS0iBaWKYVt2ZfA4cj48umJZ+cAEbR6/SjLA88I8= github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xhit/go-simple-mail/v2 v2.16.0 h1:ouGy/Ww4kuaqu2E2UrDw7SvLaziWTB60ICLkIkNVccA= github.com/xhit/go-simple-mail/v2 v2.16.0/go.mod h1:b7P5ygho6SYE+VIqpxA6QkYfv4teeyG4MKqB3utRu98= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= -github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -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/zclconf/go-cty v1.18.0 h1:pJ8+HNI4gFoyRNqVE37wWbJWVw43BZczFo7KUoRczaA= +github.com/zclconf/go-cty v1.18.0/go.mod h1:qpnV6EDNgC1sns/AleL1fvatHw72j+S+nS+MJ+T2CSg= +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.2.0 h1:GDyL4+e/Qe/S0B7YaecMLbVvAR/Mp21CXMOSiCTOi1M= +github.com/zclconf/go-cty-yaml v1.2.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= -go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ= -go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= -go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8= -go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0= -go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs= -go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18= -go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE= -go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= -go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= -go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI= -go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= 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= @@ -635,10 +650,12 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E 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.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= -go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= -golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw= -golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= +go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= +go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/arch v0.25.0 h1:qnk6Ksugpi5Bz32947rkUgDt9/s5qvqDPl/gBKdMJLE= +golang.org/x/arch v0.25.0/go.mod h1:0X+GdSIP+kL5wPmpK7sdkEVTt2XoYP0cSjQSbZBwOi8= 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-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -649,43 +666,34 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= -golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= -golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= -golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= +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.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= +golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -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.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.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk= -golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc= +golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= +golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= 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-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-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-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= 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.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= 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-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.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/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= @@ -697,7 +705,6 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/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-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-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -705,26 +712,23 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/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.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/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.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= 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.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= 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.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= -golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU= +golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= 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= @@ -735,9 +739,9 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= -golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= +golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -747,34 +751,31 @@ golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtn 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-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ= -golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ= +golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= +golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= 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/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= -gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= -google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= -google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260406210006-6f92a3bedf2d h1:wT2n40TBqFY6wiwazVK9/iTWbsQrgk5ZfCSVFLO9LQA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260406210006-6f92a3bedf2d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= +google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= 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.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= @@ -788,8 +789,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -798,28 +797,32 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY= -k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0= -k8s.io/apimachinery v0.28.4 h1:zOSJe1mc+GxuMnFzD4Z/U1wst50X28ZNsn5bhgIIao8= -k8s.io/apimachinery v0.28.4/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg= -k8s.io/apiserver v0.28.4 h1:BJXlaQbAU/RXYX2lRz+E1oPe3G3TKlozMMCZWu5GMgg= -k8s.io/apiserver v0.28.4/go.mod h1:Idq71oXugKZoVGUUL2wgBCTHbUR+FYTWa4rq9j4n23w= -k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= -k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= -k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -modernc.org/cc/v4 v4.26.5 h1:xM3bX7Mve6G8K8b+T11ReenJOT+BmVqQj0FY5T4+5Y4= -modernc.org/cc/v4 v4.26.5/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= -modernc.org/ccgo/v4 v4.28.1 h1:wPKYn5EC/mYTqBO373jKjvX2n+3+aK7+sICCv4Fjy1A= -modernc.org/ccgo/v4 v4.28.1/go.mod h1:uD+4RnfrVgE6ec9NGguUNdhqzNIeeomeXf6CL0GTE5Q= -modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA= -modernc.org/fileutil v1.3.40/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc= +k8s.io/api v0.35.3 h1:pA2fiBc6+N9PDf7SAiluKGEBuScsTzd2uYBkA5RzNWQ= +k8s.io/api v0.35.3/go.mod h1:9Y9tkBcFwKNq2sxwZTQh1Njh9qHl81D0As56tu42GA4= +k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= +k8s.io/apimachinery v0.35.3/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= +k8s.io/apiserver v0.35.3 h1:D2eIcfJ05hEAEewoSDg+05e0aSRwx8Y4Agvd/wiomUI= +k8s.io/apiserver v0.35.3/go.mod h1:JI0n9bHYzSgIxgIrfe21dbduJ9NHzKJ6RchcsmIKWKY= +k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= +k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= +k8s.io/kube-openapi v0.0.0-20260330154417-16be699c7b31 h1:V+sn9a/1fEYDGwnllCmqXBk8x7obZ+hl869Q3Abumkg= +k8s.io/kube-openapi v0.0.0-20260330154417-16be699c7b31/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +k8s.io/utils v0.0.0-20260319190234-28399d86e0b5 h1:kBawHLSnx/mYHmRnNUf9d4CpjREbeZuxoSGOX/J+aYM= +k8s.io/utils v0.0.0-20260319190234-28399d86e0b5/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +modernc.org/cc/v4 v4.27.1 h1:9W30zRlYrefrDV2JE2O8VDtJ1yPGownxciz5rrbQZis= +modernc.org/cc/v4 v4.27.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= +modernc.org/ccgo/v4 v4.32.0 h1:hjG66bI/kqIPX1b2yT6fr/jt+QedtP2fqojG2VrFuVw= +modernc.org/ccgo/v4 v4.32.0/go.mod h1:6F08EBCx5uQc38kMGl+0Nm0oWczoo1c7cgpzEry7Uc0= +modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM= +modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU= modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= +modernc.org/gc/v3 v3.1.2 h1:ZtDCnhonXSZexk/AYsegNRV1lJGgaNZJuKjJSWKyEqo= +modernc.org/gc/v3 v3.1.2/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY= modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks= modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI= -modernc.org/libc v1.66.10 h1:yZkb3YeLx4oynyR+iUsXsybsX4Ubx7MQlSYEw4yj59A= -modernc.org/libc v1.66.10/go.mod h1:8vGSEwvoUoltr4dlywvHqjtAqHBaw0j1jI7iFBTAr2I= +modernc.org/libc v1.70.0 h1:U58NawXqXbgpZ/dcdS9kMshu08aiA6b7gusEusqzNkw= +modernc.org/libc v1.70.0/go.mod h1:OVmxFGP1CI/Z4L3E0Q3Mf1PDE0BucwMkcXjjLntvHJo= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI= @@ -828,20 +831,21 @@ modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= -modernc.org/sqlite v1.42.2 h1:7hkZUNJvJFN2PgfUdjni9Kbvd4ef4mNLOu0B9FGxM74= -modernc.org/sqlite v1.42.2/go.mod h1:+VkC6v3pLOAE0A0uVucQEcbVW0I5nHCeDaBf+DpsQT8= +modernc.org/sqlite v1.48.1 h1:S85iToyU6cgeojybE2XJlSbcsvcWkQ6qqNXJHtW5hWA= +modernc.org/sqlite v1.48.1/go.mod h1:hWjRO6Tj/5Ik8ieqxQybiEOUXy0NJFNp2tpvVpKlvig= modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/pkg/acquisition/modules/appsec/utils.go b/pkg/acquisition/modules/appsec/utils.go index 5934c0d61..fccdd1e1e 100644 --- a/pkg/acquisition/modules/appsec/utils.go +++ b/pkg/acquisition/modules/appsec/utils.go @@ -16,7 +16,6 @@ import ( "github.com/corazawaf/coraza/v3/collection" corazatypes "github.com/corazawaf/coraza/v3/types" "github.com/corazawaf/coraza/v3/types/variables" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/crowdsec/pkg/alertcontext" "github.com/crowdsecurity/crowdsec/pkg/appsec" @@ -115,7 +114,7 @@ func AppsecEventGeneration(inEvt pipeline.Event, request *http.Request) (*pipeli source := models.Source{ Value: &sourceIP, IP: sourceIP, - Scope: ptr.Of(types.Ip), + Scope: new(types.Ip), } // Enrich source with GeoIP data @@ -128,7 +127,7 @@ func AppsecEventGeneration(inEvt pipeline.Event, request *http.Request) (*pipeli evt.Overflow.Sources[sourceIP] = source alert := models.Alert{} - alert.Capacity = ptr.Of(int32(1)) + alert.Capacity = new(int32(1)) alert.Events = make([]*models.Event, len(evt.Appsec.MatchedRules)) now := time.Now().UTC().Format(time.RFC3339) @@ -188,8 +187,8 @@ func AppsecEventGeneration(inEvt pipeline.Event, request *http.Request) (*pipeli alert.Meta = metas - alert.EventsCount = ptr.Of(int32(len(alert.Events))) - alert.Leakspeed = ptr.Of("") + alert.EventsCount = new(int32(len(alert.Events))) + alert.Leakspeed = new("") var scenarioName string @@ -239,10 +238,10 @@ func AppsecEventGeneration(inEvt pipeline.Event, request *http.Request) (*pipeli } } - alert.Scenario = ptr.Of(scenarioName) - alert.ScenarioHash = ptr.Of(inEvt.Appsec.GetHash()) - alert.ScenarioVersion = ptr.Of(inEvt.Appsec.GetVersion()) - alert.Simulated = ptr.Of(false) + alert.Scenario = new(scenarioName) + alert.ScenarioHash = new(inEvt.Appsec.GetHash()) + alert.ScenarioVersion = new(inEvt.Appsec.GetVersion()) + alert.Simulated = new(false) alert.Source = &source alert.Kind = types.WAFAlertKind.String() @@ -258,8 +257,8 @@ func AppsecEventGeneration(inEvt pipeline.Event, request *http.Request) (*pipeli msg += fmt.Sprintf("%s from %s (%s)", scenarioName, alert.Source.IP, inEvt.Parsed["remediation_cmpt_ip"]) alert.Message = &msg - alert.StartAt = ptr.Of(time.Now().UTC().Format(time.RFC3339)) - alert.StopAt = ptr.Of(time.Now().UTC().Format(time.RFC3339)) + alert.StartAt = new(time.Now().UTC().Format(time.RFC3339)) + alert.StopAt = new(time.Now().UTC().Format(time.RFC3339)) evt.Overflow.APIAlerts = []models.Alert{alert} evt.Overflow.Alert = &alert diff --git a/pkg/acquisition/modules/docker/config.go b/pkg/acquisition/modules/docker/config.go index 97f746139..d771fc490 100644 --- a/pkg/acquisition/modules/docker/config.go +++ b/pkg/acquisition/modules/docker/config.go @@ -9,9 +9,9 @@ import ( "strconv" "time" + yaml "github.com/goccy/go-yaml" dockerTypesSwarm "github.com/moby/moby/api/types/swarm" "github.com/moby/moby/client" - yaml "github.com/goccy/go-yaml" log "github.com/sirupsen/logrus" "github.com/crowdsecurity/crowdsec/pkg/acquisition/configuration" @@ -159,7 +159,6 @@ func (d *Source) Configure(ctx context.Context, yamlConfig []byte, logger *log.E opts := []client.Opt{ client.FromEnv, - client.WithAPIVersionNegotiation(), } if d.Config.DockerHost != "" { @@ -208,8 +207,8 @@ func (d *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string } d.Config = Configuration{ - FollowStdout: true, - FollowStdErr: true, + FollowStdout: true, + FollowStdErr: true, } d.Config.UniqueId = uuid d.Config.ContainerName = make([]string, 0) @@ -222,7 +221,6 @@ func (d *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string opts := []client.Opt{ client.FromEnv, - client.WithAPIVersionNegotiation(), } d.containerLogsOptions = &client.ContainerLogsOptions{ diff --git a/pkg/alertcontext/alertcontext_test.go b/pkg/alertcontext/alertcontext_test.go index e224e9fbb..f785d2f76 100644 --- a/pkg/alertcontext/alertcontext_test.go +++ b/pkg/alertcontext/alertcontext_test.go @@ -8,8 +8,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/pkg/models" "github.com/crowdsecurity/crowdsec/pkg/pipeline" ) @@ -225,7 +223,7 @@ func TestValidateContextExpr(t *testing.T) { exprs: []string{ "evt.invalid.source_ip", }, - expectedErr: ptr.Of("compilation of 'evt.invalid.source_ip' failed: type pipeline.Event has no field invalid"), + expectedErr: new("compilation of 'evt.invalid.source_ip' failed: type pipeline.Event has no field invalid"), }, } for _, test := range tests { diff --git a/pkg/apiclient/alerts_service_test.go b/pkg/apiclient/alerts_service_test.go index 71edd83b9..c2bc5613f 100644 --- a/pkg/apiclient/alerts_service_test.go +++ b/pkg/apiclient/alerts_service_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" "github.com/crowdsecurity/go-cs-lib/cstest" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/crowdsec/pkg/models" ) @@ -111,18 +110,18 @@ func TestAlertsListAsMachine(t *testing.T) { expected := models.GetAlertsResponse{ &models.Alert{ - Capacity: ptr.Of(int32(5)), + Capacity: new(int32(5)), CreatedAt: "2020-11-28T10:20:47+01:00", Decisions: []*models.Decision{ { - Duration: ptr.Of("59m49.264032632s"), + Duration: new("59m49.264032632s"), ID: 1, - Origin: ptr.Of("crowdsec"), + Origin: new("crowdsec"), Scenario: &tscenario, Scope: &tscope, - Simulated: ptr.Of(false), - Type: ptr.Of("ban"), + Simulated: new(false), + Type: new("ban"), Value: &tvalue, }, }, @@ -153,16 +152,16 @@ func TestAlertsListAsMachine(t *testing.T) { Timestamp: &ttimestamp, }, }, - EventsCount: ptr.Of(int32(6)), + EventsCount: new(int32(6)), ID: 1, - Leakspeed: ptr.Of("10s"), + Leakspeed: new("10s"), MachineID: "test", Message: &tmessage, Remediation: false, Scenario: &tscenario, - ScenarioHash: ptr.Of("4441dcff07020f6690d998b7101e642359ba405c2abb83565bbbdcee36de280f"), - ScenarioVersion: ptr.Of("0.1"), - Simulated: ptr.Of(false), + ScenarioHash: new("4441dcff07020f6690d998b7101e642359ba405c2abb83565bbbdcee36de280f"), + ScenarioVersion: new("0.1"), + Simulated: new(false), Source: &models.Source{ AsName: "Cloudflare Inc", AsNumber: "", @@ -174,8 +173,8 @@ func TestAlertsListAsMachine(t *testing.T) { Scope: &tscope, Value: &tvalue, }, - StartAt: ptr.Of("2020-11-28 10:20:46.842701127 +0100 +0100"), - StopAt: ptr.Of("2020-11-28 10:20:46.845621385 +0100 +0100"), + StartAt: new("2020-11-28 10:20:46.842701127 +0100 +0100"), + StopAt: new("2020-11-28 10:20:46.845621385 +0100 +0100"), }, } @@ -288,17 +287,17 @@ func TestAlertsGetAsMachine(t *testing.T) { ttimestamp := "2020-11-28 10:20:46 +0000 UTC" expected := &models.Alert{ - Capacity: ptr.Of(int32(5)), + Capacity: new(int32(5)), CreatedAt: "2020-11-28T10:20:47+01:00", Decisions: []*models.Decision{ { - Duration: ptr.Of("59m49.264032632s"), + Duration: new("59m49.264032632s"), ID: 1, - Origin: ptr.Of("crowdsec"), + Origin: new("crowdsec"), Scenario: &tscenario, Scope: &tscope, - Simulated: ptr.Of(false), + Simulated: new(false), Type: &ttype, Value: &tvalue, }, @@ -330,16 +329,16 @@ func TestAlertsGetAsMachine(t *testing.T) { Timestamp: &ttimestamp, }, }, - EventsCount: ptr.Of(int32(6)), + EventsCount: new(int32(6)), ID: 1, - Leakspeed: ptr.Of("10s"), + Leakspeed: new("10s"), MachineID: "test", - Message: ptr.Of("Ip 1.1.1.172 performed 'crowdsecurity/ssh-bf' (6 events over 2.920062ms) at 2020-11-28 10:20:46.845619968 +0100 CET m=+5.903899761"), + Message: new("Ip 1.1.1.172 performed 'crowdsecurity/ssh-bf' (6 events over 2.920062ms) at 2020-11-28 10:20:46.845619968 +0100 CET m=+5.903899761"), Remediation: false, Scenario: &tscenario, - ScenarioHash: ptr.Of("4441dcff07020f6690d998b7101e642359ba405c2abb83565bbbdcee36de280f"), - ScenarioVersion: ptr.Of("0.1"), - Simulated: ptr.Of(false), + ScenarioHash: new("4441dcff07020f6690d998b7101e642359ba405c2abb83565bbbdcee36de280f"), + ScenarioVersion: new("0.1"), + Simulated: new(false), Source: &models.Source{ AsName: "Cloudflare Inc", AsNumber: "", @@ -351,8 +350,8 @@ func TestAlertsGetAsMachine(t *testing.T) { Scope: &tscope, Value: &tvalue, }, - StartAt: ptr.Of("2020-11-28 10:20:46.842701127 +0100 +0100"), - StopAt: ptr.Of("2020-11-28 10:20:46.845621385 +0100 +0100"), + StartAt: new("2020-11-28 10:20:46.842701127 +0100 +0100"), + StopAt: new("2020-11-28 10:20:46.845621385 +0100 +0100"), } alerts, resp, err := client.Alerts.GetByID(ctx, 1) diff --git a/pkg/apiclient/decisions_service.go b/pkg/apiclient/decisions_service.go index cdfd76193..893a6d7f4 100644 --- a/pkg/apiclient/decisions_service.go +++ b/pkg/apiclient/decisions_service.go @@ -10,8 +10,6 @@ import ( qs "github.com/google/go-querystring/query" log "github.com/sirupsen/logrus" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/pkg/models" "github.com/crowdsecurity/crowdsec/pkg/modelscapi" "github.com/crowdsecurity/crowdsec/pkg/types" @@ -121,10 +119,10 @@ func (*DecisionsService) GetDecisionsFromGroups(decisionsGroups []*modelscapi.Ge partialDecisions[idx] = &models.Decision{ Scenario: decisionsGroup.Scenario, Scope: decisionsGroup.Scope, - Type: ptr.Of(types.DecisionTypeBan), + Type: new(types.DecisionTypeBan), Value: decision.Value, Duration: decision.Duration, - Origin: ptr.Of(types.CAPIOrigin), + Origin: new(types.CAPIOrigin), } } @@ -161,10 +159,10 @@ func (s *DecisionsService) FetchV3Decisions(ctx context.Context, url string) (*m partialDecisions[idx] = &models.Decision{ Scenario: &scenarioDeleted, Scope: decisionsGroup.Scope, - Type: ptr.Of(types.DecisionTypeBan), + Type: new(types.DecisionTypeBan), Value: &decision, Duration: &durationDeleted, - Origin: ptr.Of(types.CAPIOrigin), + Origin: new(types.CAPIOrigin), } } @@ -243,7 +241,7 @@ func (*DecisionsService) GetDecisionsFromBlocklist(ctx context.Context, blocklis Type: blocklist.Remediation, Value: &decision, Duration: blocklist.Duration, - Origin: ptr.Of(types.ListOrigin), + Origin: new(types.ListOrigin), }) } diff --git a/pkg/apiclient/decisions_service_test.go b/pkg/apiclient/decisions_service_test.go index acee0db1b..806cc1518 100644 --- a/pkg/apiclient/decisions_service_test.go +++ b/pkg/apiclient/decisions_service_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" "github.com/crowdsecurity/go-cs-lib/cstest" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/crowdsec/pkg/models" "github.com/crowdsecurity/crowdsec/pkg/modelscapi" @@ -54,13 +53,13 @@ func TestDecisionsList(t *testing.T) { expected := &models.GetDecisionsResponse{ &models.Decision{ - Duration: ptr.Of("3h59m55.756182786s"), + Duration: new("3h59m55.756182786s"), ID: 4, - Origin: ptr.Of("cscli"), - Scenario: ptr.Of("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), - Scope: ptr.Of("Ip"), - Type: ptr.Of("ban"), - Value: ptr.Of("1.2.3.4"), + Origin: new("cscli"), + Scenario: new("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), + Scope: new("Ip"), + Type: new("ban"), + Value: new("1.2.3.4"), }, } @@ -125,13 +124,13 @@ func TestDecisionsStream(t *testing.T) { expected := &models.DecisionsStreamResponse{ New: models.GetDecisionsResponse{ &models.Decision{ - Duration: ptr.Of("3h59m55.756182786s"), + Duration: new("3h59m55.756182786s"), ID: 4, - Origin: ptr.Of("cscli"), - Scenario: ptr.Of("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), - Scope: ptr.Of("Ip"), - Type: ptr.Of("ban"), - Value: ptr.Of("1.2.3.4"), + Origin: new("cscli"), + Scenario: new("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), + Scope: new("Ip"), + Type: new("ban"), + Value: new("1.2.3.4"), }, }, } @@ -196,22 +195,22 @@ func TestDecisionsStreamV3Compatibility(t *testing.T) { expected := &models.DecisionsStreamResponse{ New: models.GetDecisionsResponse{ &models.Decision{ - Duration: ptr.Of("3h59m55.756182786s"), + Duration: new("3h59m55.756182786s"), Origin: &torigin, - Scenario: ptr.Of("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), + Scenario: new("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), Scope: &tscope, Type: &ttype, - Value: ptr.Of("1.2.3.4"), + Value: new("1.2.3.4"), }, }, Deleted: models.GetDecisionsResponse{ &models.Decision{ - Duration: ptr.Of("1h"), + Duration: new("1h"), Origin: &torigin, - Scenario: ptr.Of("deleted"), + Scenario: new("deleted"), Scope: &tscope, Type: &ttype, - Value: ptr.Of("1.2.3.5"), + Value: new("1.2.3.5"), }, }, } @@ -261,11 +260,11 @@ func TestDecisionsStreamV3(t *testing.T) { &modelscapi.GetDecisionsStreamResponseNewItem{ Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Duration: ptr.Of("3h59m55.756182786s"), - Value: ptr.Of("1.2.3.4"), + Duration: new("3h59m55.756182786s"), + Value: new("1.2.3.4"), }, }, - Scenario: ptr.Of("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), + Scenario: new("manual 'ban' from '82929df7ee394b73b81252fe3b4e50203yaT2u6nXiaN7Ix9'"), Scope: &tscope, }, }, @@ -280,11 +279,11 @@ func TestDecisionsStreamV3(t *testing.T) { Links: &modelscapi.GetDecisionsStreamResponseLinks{ Blocklists: []*modelscapi.BlocklistLink{ { - Duration: ptr.Of("24h"), - Name: ptr.Of("blocklist1"), - Remediation: ptr.Of("ban"), - Scope: ptr.Of("ip"), - URL: ptr.Of("/v3/blocklist"), + Duration: new("24h"), + Name: new("blocklist1"), + Remediation: new("ban"), + Scope: new("ip"), + URL: new("/v3/blocklist"), }, }, }, @@ -341,7 +340,7 @@ func TestDecisionsFromBlocklist(t *testing.T) { expected := []*models.Decision{ { Duration: &tdurationBlocklist, - Value: ptr.Of("1.2.3.4"), + Value: new("1.2.3.4"), Scenario: &tnameBlocklist, Scope: &tscopeBlocklist, Type: &tremediationBlocklist, @@ -349,7 +348,7 @@ func TestDecisionsFromBlocklist(t *testing.T) { }, { Duration: &tdurationBlocklist, - Value: ptr.Of("1.2.3.5"), + Value: new("1.2.3.5"), Scenario: &tnameBlocklist, Scope: &tscopeBlocklist, Type: &tremediationBlocklist, diff --git a/pkg/apiclient/resperr.go b/pkg/apiclient/resperr.go index 1b0786f98..ebd1ee6a3 100644 --- a/pkg/apiclient/resperr.go +++ b/pkg/apiclient/resperr.go @@ -40,19 +40,19 @@ func CheckResponse(r *http.Response) error { data, err := io.ReadAll(r.Body) if err != nil || len(data) == 0 { - ret.Message = ptr.Of(fmt.Sprintf("http code %d, no response body", r.StatusCode)) + ret.Message = new(fmt.Sprintf("http code %d, no response body", r.StatusCode)) return ret } switch r.StatusCode { case http.StatusUnprocessableEntity: - ret.Message = ptr.Of(fmt.Sprintf("http code %d, invalid request: %s", r.StatusCode, string(data))) + ret.Message = new(fmt.Sprintf("http code %d, invalid request: %s", r.StatusCode, string(data))) default: // try to unmarshal and if there are no 'message' or 'errors' fields, display the body as is, // the API is following a different convention err := json.Unmarshal(data, ret) if err != nil || (ret.Message == nil && ret.Errors == "") { - ret.Message = ptr.Of(fmt.Sprintf("http code %d, response: %s", r.StatusCode, string(data))) + ret.Message = new(fmt.Sprintf("http code %d, response: %s", r.StatusCode, string(data))) return ret } } diff --git a/pkg/apiserver/apic.go b/pkg/apiserver/apic.go index 2c447916c..3acdfc6b9 100644 --- a/pkg/apiserver/apic.go +++ b/pkg/apiserver/apic.go @@ -20,8 +20,6 @@ import ( log "github.com/sirupsen/logrus" "gopkg.in/tomb.v2" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/pkg/apiclient" "github.com/crowdsecurity/crowdsec/pkg/csconfig" "github.com/crowdsecurity/crowdsec/pkg/database" @@ -122,15 +120,15 @@ func decisionsToAPIDecisions(decisions []*models.Decision) modelscapi.AddSignals for _, decision := range decisions { x := &modelscapi.AddSignalsRequestItemDecisionsItem{ - Duration: ptr.Of(*decision.Duration), + Duration: new(*decision.Duration), ID: new(int64), - Origin: ptr.Of(*decision.Origin), - Scenario: ptr.Of(*decision.Scenario), - Scope: ptr.Of(*decision.Scope), + Origin: new(*decision.Origin), + Scenario: new(*decision.Scenario), + Scope: new(*decision.Scope), // Simulated: *decision.Simulated, - Type: ptr.Of(*decision.Type), + Type: new(*decision.Type), Until: decision.Until, - Value: ptr.Of(*decision.Value), + Value: new(*decision.Value), UUID: decision.UUID, } @@ -466,7 +464,7 @@ func (a *apic) HandleDeletedDecisionsV3(ctx context.Context, deletedDecisions [] return 0, fmt.Errorf("expiring decisions error: %w", err) } - updateCounterForDecision(deleteCounters, ptr.Of(types.CAPIOrigin), nil, dbCliDel) + updateCounterForDecision(deleteCounters, new(types.CAPIOrigin), nil, dbCliDel) nbDeleted += dbCliDel } @@ -497,20 +495,20 @@ func createAlertForDecision(decision *models.Decision, kind types.AlertKind) *mo return &models.Alert{ Source: &models.Source{ - Scope: ptr.Of(scope), - Value: ptr.Of(""), + Scope: new(scope), + Value: new(""), }, - Scenario: ptr.Of(scenario), + Scenario: new(scenario), Kind: kind.String(), - Message: ptr.Of(""), - StartAt: ptr.Of(time.Now().UTC().Format(time.RFC3339)), - StopAt: ptr.Of(time.Now().UTC().Format(time.RFC3339)), - Capacity: ptr.Of(int32(0)), - Simulated: ptr.Of(false), - EventsCount: ptr.Of(int32(0)), - Leakspeed: ptr.Of(""), - ScenarioHash: ptr.Of(""), - ScenarioVersion: ptr.Of(""), + Message: new(""), + StartAt: new(time.Now().UTC().Format(time.RFC3339)), + StopAt: new(time.Now().UTC().Format(time.RFC3339)), + Capacity: new(int32(0)), + Simulated: new(false), + EventsCount: new(int32(0)), + Leakspeed: new(""), + ScenarioHash: new(""), + ScenarioVersion: new(""), MachineID: database.CapiMachineID, } } @@ -1031,12 +1029,12 @@ func setAlertScenario(alert *models.Alert, addCounters map[string]map[string]int switch *alert.Source.Scope { case types.CAPIOrigin: *alert.Source.Scope = types.CommunityBlocklistPullSourceScope - alert.Scenario = ptr.Of(fmt.Sprintf("update : +%d/-%d IPs", + alert.Scenario = new(fmt.Sprintf("update : +%d/-%d IPs", addCounters[types.CAPIOrigin]["all"], deleteCounters[types.CAPIOrigin]["all"])) case types.ListOrigin: *alert.Source.Scope = fmt.Sprintf("%s:%s", types.ListOrigin, *alert.Scenario) - alert.Scenario = ptr.Of(fmt.Sprintf("update : +%d/-%d IPs", + alert.Scenario = new(fmt.Sprintf("update : +%d/-%d IPs", addCounters[types.ListOrigin][*alert.Scenario], deleteCounters[types.ListOrigin][*alert.Scenario])) } diff --git a/pkg/apiserver/apic_metrics.go b/pkg/apiserver/apic_metrics.go index bc49b0cdc..b4370b281 100644 --- a/pkg/apiserver/apic_metrics.go +++ b/pkg/apiserver/apic_metrics.go @@ -158,15 +158,15 @@ func (a *apic) GetUsageMetrics(ctx context.Context) (*models.AllMetrics, []int, Family: osFamily, Version: &osVersion, } - allMetrics.Lapi.Version = ptr.Of(version.String()) + allMetrics.Lapi.Version = new(version.String()) allMetrics.Lapi.FeatureFlags = fflag.Crowdsec.GetEnabledFeatures() allMetrics.Lapi.Metrics = make([]*models.DetailedMetrics, 0) allMetrics.Lapi.Metrics = append(allMetrics.Lapi.Metrics, &models.DetailedMetrics{ Meta: &models.MetricsMeta{ - UtcNowTimestamp: ptr.Of(time.Now().UTC().Unix()), - WindowSizeSeconds: ptr.Of(int64(a.metricsInterval.Seconds())), + UtcNowTimestamp: new(time.Now().UTC().Unix()), + WindowSizeSeconds: new(int64(a.metricsInterval.Seconds())), }, Items: make([]*models.MetricsDetailItem, 0), }) @@ -226,7 +226,7 @@ func (a *apic) GetMetrics(ctx context.Context) (*models.Metrics, error) { } return &models.Metrics{ - ApilVersion: ptr.Of(version.String()), + ApilVersion: new(version.String()), Machines: machinesInfo, Bouncers: bouncersInfo, }, nil diff --git a/pkg/apiserver/apic_test.go b/pkg/apiserver/apic_test.go index d37e783bc..38dfd2bae 100644 --- a/pkg/apiserver/apic_test.go +++ b/pkg/apiserver/apic_test.go @@ -23,7 +23,6 @@ import ( "gopkg.in/tomb.v2" "github.com/crowdsecurity/go-cs-lib/cstest" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/go-cs-lib/version" "github.com/crowdsecurity/crowdsec/pkg/apiclient" @@ -71,10 +70,10 @@ func getAPIC(t *testing.T, ctx context.Context) *apic { pushTomb: tomb.Tomb{}, metricsTomb: tomb.Tomb{}, consoleConfig: &csconfig.ConsoleConfig{ - ShareManualDecisions: ptr.Of(false), - ShareTaintedScenarios: ptr.Of(false), - ShareCustomScenarios: ptr.Of(false), - ShareContext: ptr.Of(false), + ShareManualDecisions: new(false), + ShareTaintedScenarios: new(false), + ShareCustomScenarios: new(false), + ShareContext: new(false), }, isPulling: make(chan bool, 1), shareSignals: true, @@ -212,10 +211,10 @@ func TestNewAPIC(t *testing.T) { Login: "foo", Password: "bar", }, - Sharing: ptr.Of(true), + Sharing: new(true), PullConfig: csconfig.CapiPullConfig{ - Community: ptr.Of(true), - Blocklists: ptr.Of(true), + Community: new(true), + Blocklists: new(true), }, } } @@ -290,7 +289,7 @@ func TestAPICGetMetrics(t *testing.T) { machineIDs: []string{}, bouncers: []string{}, expectedMetric: &models.Metrics{ - ApilVersion: ptr.Of(version.String()), + ApilVersion: new(version.String()), Bouncers: []*models.MetricsBouncerInfo{}, Machines: []*models.MetricsAgentInfo{}, }, @@ -300,7 +299,7 @@ func TestAPICGetMetrics(t *testing.T) { machineIDs: []string{"a", "b", "c"}, bouncers: []string{"1", "2", "3"}, expectedMetric: &models.Metrics{ - ApilVersion: ptr.Of(version.String()), + ApilVersion: new(version.String()), Bouncers: []*models.MetricsBouncerInfo{ { CustomName: "1", @@ -371,27 +370,27 @@ func TestAPICGetMetrics(t *testing.T) { func TestFillAlertsWithDecisions(t *testing.T) { httpBfDecisionCommunity := &models.Decision{ - Origin: ptr.Of(types.CAPIOrigin), - Scenario: ptr.Of("crowdsecurity/http-bf"), - Scope: ptr.Of("ip"), + Origin: new(types.CAPIOrigin), + Scenario: new("crowdsecurity/http-bf"), + Scope: new("ip"), } sshBfDecisionCommunity := &models.Decision{ - Origin: ptr.Of(types.CAPIOrigin), - Scenario: ptr.Of("crowdsecurity/ssh-bf"), - Scope: ptr.Of("ip"), + Origin: new(types.CAPIOrigin), + Scenario: new("crowdsecurity/ssh-bf"), + Scope: new("ip"), } httpBfDecisionList := &models.Decision{ - Origin: ptr.Of(types.ListOrigin), - Scenario: ptr.Of("crowdsecurity/http-bf"), - Scope: ptr.Of("ip"), + Origin: new(types.ListOrigin), + Scenario: new("crowdsecurity/http-bf"), + Scope: new("ip"), } sshBfDecisionList := &models.Decision{ - Origin: ptr.Of(types.ListOrigin), - Scenario: ptr.Of("crowdsecurity/ssh-bf"), - Scope: ptr.Of("ip"), + Origin: new(types.ListOrigin), + Scenario: new("crowdsecurity/ssh-bf"), + Scope: new("ip"), } type args struct { @@ -488,68 +487,68 @@ func TestAPICWhitelists(t *testing.T) { "9.9.9.9", // This is already present in DB "9.1.9.9", // This is not present in DB }, - Scope: ptr.Of("Ip"), + Scope: new("Ip"), }, // This is already present in DB }, New: modelscapi.GetDecisionsStreamResponseNew{ &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("13.2.3.4"), // wl by cidr - Duration: ptr.Of("24h"), + Value: new("13.2.3.4"), // wl by cidr + Duration: new("24h"), }, }, }, &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("2.2.3.4"), - Duration: ptr.Of("24h"), + Value: new("2.2.3.4"), + Duration: new("24h"), }, }, }, &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test2"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test2"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("13.2.3.5"), // wl by cidr - Duration: ptr.Of("24h"), + Value: new("13.2.3.5"), // wl by cidr + Duration: new("24h"), }, }, }, // These two are from community list. &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("6.2.3.4"), - Duration: ptr.Of("24h"), + Value: new("6.2.3.4"), + Duration: new("24h"), }, }, }, &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("9.2.3.4"), // wl by ip - Duration: ptr.Of("24h"), + Value: new("9.2.3.4"), // wl by ip + Duration: new("24h"), }, }, }, &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("10.2.3.4"), // wl by allowlist that we pull at the same time - Duration: ptr.Of("24h"), + Value: new("10.2.3.4"), // wl by allowlist that we pull at the same time + Duration: new("24h"), }, }, }, @@ -557,27 +556,27 @@ func TestAPICWhitelists(t *testing.T) { Links: &modelscapi.GetDecisionsStreamResponseLinks{ Blocklists: []*modelscapi.BlocklistLink{ { - URL: ptr.Of("http://api.crowdsec.net/blocklist1"), - Name: ptr.Of("blocklist1"), - Scope: ptr.Of("Ip"), - Remediation: ptr.Of("ban"), - Duration: ptr.Of("24h"), + URL: new("http://api.crowdsec.net/blocklist1"), + Name: new("blocklist1"), + Scope: new("Ip"), + Remediation: new("ban"), + Duration: new("24h"), }, { - URL: ptr.Of("http://api.crowdsec.net/blocklist2"), - Name: ptr.Of("blocklist2"), - Scope: ptr.Of("Ip"), - Remediation: ptr.Of("ban"), - Duration: ptr.Of("24h"), + URL: new("http://api.crowdsec.net/blocklist2"), + Name: new("blocklist2"), + Scope: new("Ip"), + Remediation: new("ban"), + Duration: new("24h"), }, }, Allowlists: []*modelscapi.AllowlistLink{ { - URL: ptr.Of("http://api.crowdsec.net/allowlist1"), - Name: ptr.Of("allowlist1"), - ID: ptr.Of("1"), - Description: ptr.Of("test"), - CreatedAt: ptr.Of(strfmt.DateTime(time.Now())), + URL: new("http://api.crowdsec.net/allowlist1"), + Name: new("allowlist1"), + ID: new("1"), + Description: new("test"), + CreatedAt: new(strfmt.DateTime(time.Now())), }, }, }, @@ -700,27 +699,27 @@ func TestAPICPullTop(t *testing.T) { "9.9.9.9", // This is already present in DB "9.1.9.9", // This is not present in DB }, - Scope: ptr.Of("Ip"), + Scope: new("Ip"), }, // This is already present in DB }, New: modelscapi.GetDecisionsStreamResponseNew{ &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("1.2.3.4"), - Duration: ptr.Of("24h"), + Value: new("1.2.3.4"), + Duration: new("24h"), }, }, }, &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test2"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test2"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("1.2.3.5"), - Duration: ptr.Of("24h"), + Value: new("1.2.3.5"), + Duration: new("24h"), }, }, }, // These two are from community list. @@ -728,18 +727,18 @@ func TestAPICPullTop(t *testing.T) { Links: &modelscapi.GetDecisionsStreamResponseLinks{ Blocklists: []*modelscapi.BlocklistLink{ { - URL: ptr.Of("http://api.crowdsec.net/blocklist1"), - Name: ptr.Of("blocklist1"), - Scope: ptr.Of("Ip"), - Remediation: ptr.Of("ban"), - Duration: ptr.Of("24h"), + URL: new("http://api.crowdsec.net/blocklist1"), + Name: new("blocklist1"), + Scope: new("Ip"), + Remediation: new("ban"), + Duration: new("24h"), }, { - URL: ptr.Of("http://api.crowdsec.net/blocklist2"), - Name: ptr.Of("blocklist2"), - Scope: ptr.Of("Ip"), - Remediation: ptr.Of("ban"), - Duration: ptr.Of("24h"), + URL: new("http://api.crowdsec.net/blocklist2"), + Name: new("blocklist2"), + Scope: new("Ip"), + Remediation: new("ban"), + Duration: new("24h"), }, }, }, @@ -813,12 +812,12 @@ func TestAPICPullTopBLCacheFirstCall(t *testing.T) { modelscapi.GetDecisionsStreamResponse{ New: modelscapi.GetDecisionsStreamResponseNew{ &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("1.2.3.4"), - Duration: ptr.Of("24h"), + Value: new("1.2.3.4"), + Duration: new("24h"), }, }, }, @@ -826,11 +825,11 @@ func TestAPICPullTopBLCacheFirstCall(t *testing.T) { Links: &modelscapi.GetDecisionsStreamResponseLinks{ Blocklists: []*modelscapi.BlocklistLink{ { - URL: ptr.Of("http://api.crowdsec.net/blocklist1"), - Name: ptr.Of("blocklist1"), - Scope: ptr.Of("Ip"), - Remediation: ptr.Of("ban"), - Duration: ptr.Of("24h"), + URL: new("http://api.crowdsec.net/blocklist1"), + Name: new("blocklist1"), + Scope: new("Ip"), + Remediation: new("ban"), + Duration: new("24h"), }, }, }, @@ -906,12 +905,12 @@ func TestAPICPullTopBLCacheForceCall(t *testing.T) { modelscapi.GetDecisionsStreamResponse{ New: modelscapi.GetDecisionsStreamResponseNew{ &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/test1"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/test1"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("1.2.3.4"), - Duration: ptr.Of("24h"), + Value: new("1.2.3.4"), + Duration: new("24h"), }, }, }, @@ -919,11 +918,11 @@ func TestAPICPullTopBLCacheForceCall(t *testing.T) { Links: &modelscapi.GetDecisionsStreamResponseLinks{ Blocklists: []*modelscapi.BlocklistLink{ { - URL: ptr.Of("http://api.crowdsec.net/blocklist1"), - Name: ptr.Of("blocklist1"), - Scope: ptr.Of("Ip"), - Remediation: ptr.Of("ban"), - Duration: ptr.Of("24h"), + URL: new("http://api.crowdsec.net/blocklist1"), + Name: new("blocklist1"), + Scope: new("Ip"), + Remediation: new("ban"), + Duration: new("24h"), }, }, }, @@ -977,11 +976,11 @@ func TestAPICPullBlocklistCall(t *testing.T) { api.apiClient = apic err = api.PullBlocklist(ctx, &modelscapi.BlocklistLink{ - URL: ptr.Of("http://api.crowdsec.net/blocklist1"), - Name: ptr.Of("blocklist1"), - Scope: ptr.Of("Ip"), - Remediation: ptr.Of("ban"), - Duration: ptr.Of("24h"), + URL: new("http://api.crowdsec.net/blocklist1"), + Name: new("blocklist1"), + Scope: new("Ip"), + Remediation: new("ban"), + Duration: new("24h"), }, true) require.NoError(t, err) } @@ -997,10 +996,10 @@ func TestAPICPush(t *testing.T) { name: "simple single alert", alerts: []*models.Alert{ { - Scenario: ptr.Of("crowdsec/test"), - ScenarioHash: ptr.Of("certified"), - ScenarioVersion: ptr.Of("v1.0"), - Simulated: ptr.Of(false), + Scenario: new("crowdsec/test"), + ScenarioHash: new("certified"), + ScenarioVersion: new("v1.0"), + Simulated: new(false), Source: &models.Source{}, }, }, @@ -1010,10 +1009,10 @@ func TestAPICPush(t *testing.T) { name: "simulated alert is not pushed", alerts: []*models.Alert{ { - Scenario: ptr.Of("crowdsec/test"), - ScenarioHash: ptr.Of("certified"), - ScenarioVersion: ptr.Of("v1.0"), - Simulated: ptr.Of(true), + Scenario: new("crowdsec/test"), + ScenarioHash: new("certified"), + ScenarioVersion: new("v1.0"), + Simulated: new(true), Source: &models.Source{}, }, }, @@ -1026,10 +1025,10 @@ func TestAPICPush(t *testing.T) { alerts := make([]*models.Alert, 100) for i := range 100 { alerts[i] = &models.Alert{ - Scenario: ptr.Of("crowdsec/test"), - ScenarioHash: ptr.Of("certified"), - ScenarioVersion: ptr.Of("v1.0"), - Simulated: ptr.Of(false), + Scenario: new("crowdsec/test"), + ScenarioHash: new("certified"), + ScenarioVersion: new("v1.0"), + Simulated: new(false), Source: &models.Source{}, } } @@ -1131,12 +1130,12 @@ func TestAPICPull(t *testing.T) { modelscapi.GetDecisionsStreamResponse{ New: modelscapi.GetDecisionsStreamResponseNew{ &modelscapi.GetDecisionsStreamResponseNewItem{ - Scenario: ptr.Of("crowdsecurity/ssh-bf"), - Scope: ptr.Of("Ip"), + Scenario: new("crowdsecurity/ssh-bf"), + Scope: new("Ip"), Decisions: []*modelscapi.GetDecisionsStreamResponseNewItemDecisionsItems0{ { - Value: ptr.Of("1.2.3.5"), - Duration: ptr.Of("24h"), + Value: new("1.2.3.5"), + Duration: new("24h"), }, }, }, @@ -1176,9 +1175,9 @@ func TestShouldShareAlert(t *testing.T) { { name: "custom alert should be shared if config enables it", consoleConfig: &csconfig.ConsoleConfig{ - ShareCustomScenarios: ptr.Of(true), + ShareCustomScenarios: new(true), }, - alert: &models.Alert{Simulated: ptr.Of(false)}, + alert: &models.Alert{Simulated: new(false)}, shareSignals: true, expectedRet: true, expectedTrust: "custom", @@ -1186,9 +1185,9 @@ func TestShouldShareAlert(t *testing.T) { { name: "custom alert should not be shared if config disables it", consoleConfig: &csconfig.ConsoleConfig{ - ShareCustomScenarios: ptr.Of(false), + ShareCustomScenarios: new(false), }, - alert: &models.Alert{Simulated: ptr.Of(false)}, + alert: &models.Alert{Simulated: new(false)}, shareSignals: true, expectedRet: false, expectedTrust: "custom", @@ -1196,12 +1195,12 @@ func TestShouldShareAlert(t *testing.T) { { name: "manual alert should be shared if config enables it", consoleConfig: &csconfig.ConsoleConfig{ - ShareManualDecisions: ptr.Of(true), + ShareManualDecisions: new(true), }, shareSignals: true, alert: &models.Alert{ - Simulated: ptr.Of(false), - Decisions: []*models.Decision{{Origin: ptr.Of(types.CscliOrigin)}}, + Simulated: new(false), + Decisions: []*models.Decision{{Origin: new(types.CscliOrigin)}}, }, expectedRet: true, expectedTrust: "manual", @@ -1209,12 +1208,12 @@ func TestShouldShareAlert(t *testing.T) { { name: "manual alert should not be shared if config disables it", consoleConfig: &csconfig.ConsoleConfig{ - ShareManualDecisions: ptr.Of(false), + ShareManualDecisions: new(false), }, shareSignals: true, alert: &models.Alert{ - Simulated: ptr.Of(false), - Decisions: []*models.Decision{{Origin: ptr.Of(types.CscliOrigin)}}, + Simulated: new(false), + Decisions: []*models.Decision{{Origin: new(types.CscliOrigin)}}, }, expectedRet: false, expectedTrust: "manual", @@ -1222,12 +1221,12 @@ func TestShouldShareAlert(t *testing.T) { { name: "manual alert should be shared if config enables it", consoleConfig: &csconfig.ConsoleConfig{ - ShareTaintedScenarios: ptr.Of(true), + ShareTaintedScenarios: new(true), }, shareSignals: true, alert: &models.Alert{ - Simulated: ptr.Of(false), - ScenarioHash: ptr.Of("whateverHash"), + Simulated: new(false), + ScenarioHash: new("whateverHash"), }, expectedRet: true, expectedTrust: "tainted", @@ -1235,12 +1234,12 @@ func TestShouldShareAlert(t *testing.T) { { name: "manual alert should not be shared if config disables it", consoleConfig: &csconfig.ConsoleConfig{ - ShareTaintedScenarios: ptr.Of(false), + ShareTaintedScenarios: new(false), }, shareSignals: true, alert: &models.Alert{ - Simulated: ptr.Of(false), - ScenarioHash: ptr.Of("whateverHash"), + Simulated: new(false), + ScenarioHash: new("whateverHash"), }, expectedRet: false, expectedTrust: "tainted", @@ -1248,12 +1247,12 @@ func TestShouldShareAlert(t *testing.T) { { name: "manual alert should not be shared if global sharing is disabled", consoleConfig: &csconfig.ConsoleConfig{ - ShareManualDecisions: ptr.Of(true), + ShareManualDecisions: new(true), }, shareSignals: false, alert: &models.Alert{ - Simulated: ptr.Of(false), - ScenarioHash: ptr.Of("whateverHash"), + Simulated: new(false), + ScenarioHash: new("whateverHash"), }, expectedRet: false, expectedTrust: "manual", diff --git a/pkg/apiserver/apiserver_test.go b/pkg/apiserver/apiserver_test.go index e376cdff8..64cc699a5 100644 --- a/pkg/apiserver/apiserver_test.go +++ b/pkg/apiserver/apiserver_test.go @@ -14,13 +14,12 @@ import ( "github.com/gin-gonic/gin" "github.com/go-openapi/strfmt" log "github.com/sirupsen/logrus" + logtest "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - logtest "github.com/sirupsen/logrus/hooks/test" "github.com/crowdsecurity/go-cs-lib/cstest" "github.com/crowdsecurity/go-cs-lib/cstime" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/go-cs-lib/version" middlewares "github.com/crowdsecurity/crowdsec/pkg/apiserver/middlewares/v1" @@ -74,7 +73,7 @@ func LoadTestConfig(t *testing.T) csconfig.Config { ShareCustomScenarios: new(bool), }, AutoRegister: &csconfig.LocalAPIAutoRegisterCfg{ - Enable: ptr.Of(true), + Enable: new(true), Token: validRegistrationToken, AllowedRanges: []string{ "127.0.0.1/8", diff --git a/pkg/apiserver/controllers/v1/usagemetrics.go b/pkg/apiserver/controllers/v1/usagemetrics.go index 5b2c3e3b1..d1800da5f 100644 --- a/pkg/apiserver/controllers/v1/usagemetrics.go +++ b/pkg/apiserver/controllers/v1/usagemetrics.go @@ -11,8 +11,6 @@ import ( "github.com/go-openapi/strfmt" log "github.com/sirupsen/logrus" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/pkg/database/ent" "github.com/crowdsecurity/crowdsec/pkg/database/ent/metric" "github.com/crowdsecurity/crowdsec/pkg/models" @@ -166,8 +164,8 @@ func (c *Controller) UsageMetrics(gctx *gin.Context) { if baseMetrics.Os == nil { baseMetrics.Os = &models.OSversion{ - Name: ptr.Of(""), - Version: ptr.Of(""), + Name: new(""), + Version: new(""), } } diff --git a/pkg/apiserver/machines_test.go b/pkg/apiserver/machines_test.go index 291eef587..8b247a288 100644 --- a/pkg/apiserver/machines_test.go +++ b/pkg/apiserver/machines_test.go @@ -9,8 +9,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/crowdsecurity/go-cs-lib/ptr" ) func TestCreateMachine(t *testing.T) { @@ -228,7 +226,7 @@ func TestAutoRegistration(t *testing.T) { // No token / valid source IP regReq = MachineTest - regReq.MachineID = ptr.Of("test2") + regReq.MachineID = new("test2") b, err = json.Marshal(regReq) require.NoError(t, err) diff --git a/pkg/apiserver/papi_cmd.go b/pkg/apiserver/papi_cmd.go index 47b2e70cc..e3f35e883 100644 --- a/pkg/apiserver/papi_cmd.go +++ b/pkg/apiserver/papi_cmd.go @@ -9,8 +9,6 @@ import ( "github.com/go-openapi/strfmt" log "github.com/sirupsen/logrus" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/pkg/apiclient" "github.com/crowdsecurity/crowdsec/pkg/database/ent" "github.com/crowdsecurity/crowdsec/pkg/models" @@ -132,22 +130,22 @@ func AlertCmd(ctx context.Context, message *Message, p *Papi, sync bool) error { /*Fix the alert with missing mandatory items*/ if alert.StartAt == nil || *alert.StartAt == "" { log.Warnf("Alert %d has no StartAt, setting it to now", alert.ID) - alert.StartAt = ptr.Of(time.Now().UTC().Format(time.RFC3339)) + alert.StartAt = new(time.Now().UTC().Format(time.RFC3339)) } if alert.StopAt == nil || *alert.StopAt == "" { log.Warnf("Alert %d has no StopAt, setting it to now", alert.ID) - alert.StopAt = ptr.Of(time.Now().UTC().Format(time.RFC3339)) + alert.StopAt = new(time.Now().UTC().Format(time.RFC3339)) } - alert.EventsCount = ptr.Of(int32(0)) - alert.Capacity = ptr.Of(int32(0)) - alert.Leakspeed = ptr.Of("") - alert.Simulated = ptr.Of(false) - alert.ScenarioHash = ptr.Of("") - alert.ScenarioVersion = ptr.Of("") - alert.Message = ptr.Of("") - alert.Scenario = ptr.Of("") + alert.EventsCount = new(int32(0)) + alert.Capacity = new(int32(0)) + alert.Leakspeed = new("") + alert.Simulated = new(false) + alert.ScenarioHash = new("") + alert.ScenarioVersion = new("") + alert.Message = new("") + alert.Scenario = new("") alert.Source = &models.Source{} alert.Kind = types.PAPIAlertKind.String() @@ -158,7 +156,7 @@ func AlertCmd(ctx context.Context, message *Message, p *Papi, sync bool) error { } else { log.Warningf("No decision found in alert for Polling API (%s : %s)", message.Header.Source.User, message.Header.Message) - alert.Source.Scope = ptr.Of(types.ConsoleOrigin) + alert.Source.Scope = new(types.ConsoleOrigin) alert.Source.Value = &message.Header.Source.User } diff --git a/pkg/csconfig/api.go b/pkg/csconfig/api.go index 3c5f2365d..cb3ef8066 100644 --- a/pkg/csconfig/api.go +++ b/pkg/csconfig/api.go @@ -20,7 +20,6 @@ import ( "github.com/crowdsecurity/go-cs-lib/csstring" "github.com/crowdsecurity/go-cs-lib/csyaml" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/crowdsec/pkg/apiclient" "github.com/crowdsecurity/crowdsec/pkg/logging" @@ -75,7 +74,7 @@ type CTICfg struct { func (a *CTICfg) Load() error { if a.Key == nil { - a.Enabled = ptr.Of(false) + a.Enabled = new(false) } if a.Key != nil && *a.Key == "" { @@ -83,7 +82,7 @@ func (a *CTICfg) Load() error { } if a.Enabled == nil { - a.Enabled = ptr.Of(true) + a.Enabled = new(true) } if a.CacheTimeout == nil { @@ -349,7 +348,7 @@ func (c *Config) LoadAPIServer(inCli bool, skipOnlineCreds bool) error { if c.API.Server.Enable == nil { // if the option is not present, it is enabled by default - c.API.Server.Enable = ptr.Of(true) + c.API.Server.Enable = new(true) } if !*c.API.Server.Enable { @@ -379,15 +378,15 @@ func (c *Config) LoadAPIServer(inCli bool, skipOnlineCreds bool) error { // Set default values for CAPI push/pull if c.API.Server.OnlineClient != nil { if c.API.Server.OnlineClient.PullConfig.Community == nil { - c.API.Server.OnlineClient.PullConfig.Community = ptr.Of(true) + c.API.Server.OnlineClient.PullConfig.Community = new(true) } if c.API.Server.OnlineClient.PullConfig.Blocklists == nil { - c.API.Server.OnlineClient.PullConfig.Blocklists = ptr.Of(true) + c.API.Server.OnlineClient.PullConfig.Blocklists = new(true) } if c.API.Server.OnlineClient.Sharing == nil { - c.API.Server.OnlineClient.Sharing = ptr.Of(true) + c.API.Server.OnlineClient.Sharing = new(true) } } @@ -517,7 +516,7 @@ func (c *Config) LoadAPIClient() error { func (c *LocalApiServerCfg) LoadAutoRegister() error { if c.AutoRegister == nil { c.AutoRegister = &LocalAPIAutoRegisterCfg{ - Enable: ptr.Of(false), + Enable: new(false), } return nil @@ -525,7 +524,7 @@ func (c *LocalApiServerCfg) LoadAutoRegister() error { // Disable by default if c.AutoRegister.Enable == nil { - c.AutoRegister.Enable = ptr.Of(false) + c.AutoRegister.Enable = new(false) } if !*c.AutoRegister.Enable { diff --git a/pkg/csconfig/api_test.go b/pkg/csconfig/api_test.go index 104601e80..10617caa9 100644 --- a/pkg/csconfig/api_test.go +++ b/pkg/csconfig/api_test.go @@ -12,7 +12,6 @@ import ( "gopkg.in/yaml.v3" "github.com/crowdsecurity/go-cs-lib/cstest" - "github.com/crowdsecurity/go-cs-lib/ptr" ) func TestLoadLocalApiClientCfg(t *testing.T) { @@ -53,7 +52,7 @@ func TestLoadLocalApiClientCfg(t *testing.T) { name: "valid configuration with insecure skip verify", input: &LocalApiClientCfg{ CredentialsFilePath: "./testdata/lapi-secrets.yaml", - InsecureSkipVerify: ptr.Of(false), + InsecureSkipVerify: new(false), }, expected: &ApiCredentialsCfg{ URL: "http://localhost:8080/", @@ -188,23 +187,23 @@ func TestLoadAPIServer(t *testing.T) { DisableAPI: false, }, expected: &LocalApiServerCfg{ - Enable: ptr.Of(true), + Enable: new(true), ListenURI: "http://crowdsec.api", TLS: nil, DbConfig: &DatabaseCfg{ DbPath: "./testdata/test.db", Type: "sqlite", MaxOpenConns: DEFAULT_MAX_OPEN_CONNS, - UseWal: ptr.Of(true), // autodetected + UseWal: new(true), // autodetected DecisionBulkSize: defaultDecisionBulkSize, }, ConsoleConfigPath: DefaultConfigPath("console.yaml"), ConsoleConfig: &ConsoleConfig{ - ShareManualDecisions: ptr.Of(false), - ShareTaintedScenarios: ptr.Of(true), - ShareCustomScenarios: ptr.Of(true), - ShareContext: ptr.Of(false), - ConsoleManagement: ptr.Of(false), + ShareManualDecisions: new(false), + ShareTaintedScenarios: new(true), + ShareCustomScenarios: new(true), + ShareContext: new(false), + ConsoleManagement: new(false), }, OnlineClient: &OnlineApiClientCfg{ CredentialsFilePath: "./testdata/online-api-secrets.yaml", @@ -214,10 +213,10 @@ func TestLoadAPIServer(t *testing.T) { Password: "testpassword", PapiURL: PAPIBaseURL, }, - Sharing: ptr.Of(true), + Sharing: new(true), PullConfig: CapiPullConfig{ - Community: ptr.Of(true), - Blocklists: ptr.Of(true), + Community: new(true), + Blocklists: new(true), }, }, Profiles: tmpLAPI.Profiles, @@ -225,7 +224,7 @@ func TestLoadAPIServer(t *testing.T) { UseForwardedForHeaders: false, PapiLogLevel: logLevel, AutoRegister: &LocalAPIAutoRegisterCfg{ - Enable: ptr.Of(false), + Enable: new(false), Token: "", AllowedRanges: nil, AllowedRangesParsed: nil, @@ -250,7 +249,7 @@ func TestLoadAPIServer(t *testing.T) { DisableAPI: false, }, expected: &LocalApiServerCfg{ - Enable: ptr.Of(true), + Enable: new(true), PapiLogLevel: logLevel, }, expectedErr: "no database configuration provided", diff --git a/pkg/csconfig/config.go b/pkg/csconfig/config.go index 424036691..fb114105a 100644 --- a/pkg/csconfig/config.go +++ b/pkg/csconfig/config.go @@ -14,7 +14,6 @@ import ( "github.com/crowdsecurity/go-cs-lib/csstring" "github.com/crowdsecurity/go-cs-lib/csyaml" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/crowdsec/pkg/metrics" ) @@ -146,7 +145,7 @@ func NewDefaultConfig() *Config { }, }, CTI: &CTICfg{ - Enabled: ptr.Of(false), + Enabled: new(false), }, } diff --git a/pkg/csconfig/console.go b/pkg/csconfig/console.go index 21ecbf3d7..ee12efe16 100644 --- a/pkg/csconfig/console.go +++ b/pkg/csconfig/console.go @@ -6,8 +6,6 @@ import ( log "github.com/sirupsen/logrus" "gopkg.in/yaml.v3" - - "github.com/crowdsecurity/go-cs-lib/ptr" ) const ( @@ -79,11 +77,11 @@ func (c *LocalApiServerCfg) LoadConsoleConfig() error { if _, err := os.Stat(c.ConsoleConfigPath); err != nil && os.IsNotExist(err) { log.Debugf("no console configuration to load") - c.ConsoleConfig.ShareCustomScenarios = ptr.Of(true) - c.ConsoleConfig.ShareTaintedScenarios = ptr.Of(true) - c.ConsoleConfig.ShareManualDecisions = ptr.Of(false) - c.ConsoleConfig.ConsoleManagement = ptr.Of(false) - c.ConsoleConfig.ShareContext = ptr.Of(false) + c.ConsoleConfig.ShareCustomScenarios = new(true) + c.ConsoleConfig.ShareTaintedScenarios = new(true) + c.ConsoleConfig.ShareManualDecisions = new(false) + c.ConsoleConfig.ConsoleManagement = new(false) + c.ConsoleConfig.ShareContext = new(false) return nil } @@ -100,27 +98,27 @@ func (c *LocalApiServerCfg) LoadConsoleConfig() error { if c.ConsoleConfig.ShareCustomScenarios == nil { log.Debugf("no share_custom scenarios found, setting to true") - c.ConsoleConfig.ShareCustomScenarios = ptr.Of(true) + c.ConsoleConfig.ShareCustomScenarios = new(true) } if c.ConsoleConfig.ShareTaintedScenarios == nil { log.Debugf("no share_tainted scenarios found, setting to true") - c.ConsoleConfig.ShareTaintedScenarios = ptr.Of(true) + c.ConsoleConfig.ShareTaintedScenarios = new(true) } if c.ConsoleConfig.ShareManualDecisions == nil { log.Debugf("no share_manual scenarios found, setting to false") - c.ConsoleConfig.ShareManualDecisions = ptr.Of(false) + c.ConsoleConfig.ShareManualDecisions = new(false) } if c.ConsoleConfig.ConsoleManagement == nil { log.Debugf("no console_management found, setting to false") - c.ConsoleConfig.ConsoleManagement = ptr.Of(false) + c.ConsoleConfig.ConsoleManagement = new(false) } if c.ConsoleConfig.ShareContext == nil { log.Debugf("no 'context' found, setting to false") - c.ConsoleConfig.ShareContext = ptr.Of(false) + c.ConsoleConfig.ShareContext = new(false) } log.Debugf("Console configuration '%s' loaded successfully", c.ConsoleConfigPath) diff --git a/pkg/csconfig/crowdsec_service.go b/pkg/csconfig/crowdsec_service.go index 864e0de0a..c2f4980c7 100644 --- a/pkg/csconfig/crowdsec_service.go +++ b/pkg/csconfig/crowdsec_service.go @@ -9,8 +9,6 @@ import ( log "github.com/sirupsen/logrus" "gopkg.in/yaml.v3" - - "github.com/crowdsecurity/go-cs-lib/ptr" ) // CrowdsecServiceCfg contains the location of parsers/scenarios/... and acquisition files @@ -99,7 +97,7 @@ func (c *Config) LoadCrowdsec() error { if c.Crowdsec.Enable == nil { // if the option is not present, it is enabled by default - c.Crowdsec.Enable = ptr.Of(true) + c.Crowdsec.Enable = new(true) } if !*c.Crowdsec.Enable { diff --git a/pkg/csconfig/crowdsec_service_test.go b/pkg/csconfig/crowdsec_service_test.go index 75395bb97..8ac065035 100644 --- a/pkg/csconfig/crowdsec_service_test.go +++ b/pkg/csconfig/crowdsec_service_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/require" "github.com/crowdsecurity/go-cs-lib/cstest" - "github.com/crowdsecurity/go-cs-lib/ptr" ) func TestLoadCrowdsec(t *testing.T) { @@ -55,7 +54,7 @@ func TestLoadCrowdsec(t *testing.T) { }, }, expected: &CrowdsecServiceCfg{ - Enable: ptr.Of(true), + Enable: new(true), AcquisitionDirPath: "", ConsoleContextPath: contextFileFullPath, AcquisitionFilePath: acquisFullPath, @@ -92,7 +91,7 @@ func TestLoadCrowdsec(t *testing.T) { }, }, expected: &CrowdsecServiceCfg{ - Enable: ptr.Of(true), + Enable: new(true), AcquisitionDirPath: acquisDirFullPath, AcquisitionFilePath: acquisFullPath, ConsoleContextPath: contextFileFullPath, @@ -127,7 +126,7 @@ func TestLoadCrowdsec(t *testing.T) { }, }, expected: &CrowdsecServiceCfg{ - Enable: ptr.Of(true), + Enable: new(true), AcquisitionDirPath: "", AcquisitionFilePath: "", ConsoleContextPath: contextFileFullPath, @@ -162,7 +161,7 @@ func TestLoadCrowdsec(t *testing.T) { }, }, expected: &CrowdsecServiceCfg{ - Enable: ptr.Of(true), + Enable: new(true), AcquisitionFilePath: notExistFullPath, AcquisitionFiles: []string{}, ParserRoutinesCount: 1, diff --git a/pkg/csconfig/database.go b/pkg/csconfig/database.go index 074309257..ab1bf48a0 100644 --- a/pkg/csconfig/database.go +++ b/pkg/csconfig/database.go @@ -15,7 +15,6 @@ import ( log "github.com/sirupsen/logrus" "github.com/crowdsecurity/go-cs-lib/cstime" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/crowdsec/pkg/fsutil" "github.com/crowdsecurity/crowdsec/pkg/logging" @@ -100,10 +99,10 @@ func (c *Config) LoadDBConfig(inCli bool) error { "Set explicitly to false to disable this warning.") case isNetwork: log.Debugf("database is on network filesystem (%s), setting useWal to false", fsType) - c.DbConfig.UseWal = ptr.Of(false) + c.DbConfig.UseWal = new(false) default: log.Debugf("database is on local filesystem (%s), setting useWal to true", fsType) - c.DbConfig.UseWal = ptr.Of(true) + c.DbConfig.UseWal = new(true) } } else if *c.DbConfig.UseWal { dbDir := filepath.Dir(c.DbConfig.DbPath) diff --git a/pkg/csconfig/database_test.go b/pkg/csconfig/database_test.go index 4a1ef807f..50dd4505f 100644 --- a/pkg/csconfig/database_test.go +++ b/pkg/csconfig/database_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/crowdsecurity/go-cs-lib/cstest" - "github.com/crowdsecurity/go-cs-lib/ptr" ) func TestLoadDBConfig(t *testing.T) { @@ -33,7 +32,7 @@ func TestLoadDBConfig(t *testing.T) { Type: "sqlite", DbPath: "./testdata/test.db", MaxOpenConns: 10, - UseWal: ptr.Of(true), + UseWal: new(true), DecisionBulkSize: defaultDecisionBulkSize, }, }, diff --git a/pkg/csconfig/logging.go b/pkg/csconfig/logging.go index 204cc0fba..7e459214e 100644 --- a/pkg/csconfig/logging.go +++ b/pkg/csconfig/logging.go @@ -5,27 +5,25 @@ import ( "path/filepath" "gopkg.in/natefinch/lumberjack.v2" - - "github.com/crowdsecurity/go-cs-lib/ptr" ) const ( defMaxSize = 500 // megabytes defMaxFiles = 3 - defMaxAge = 28 // days + defMaxAge = 28 // days defCompress = true ) // LogConfig contains common fields used to create the default logger, or a service logger when the // clone/sublogger pattern is not enough, for example access logger to use a different file name. type LogConfig struct { - LogMedia string `yaml:"log_media"` - LogDir string `yaml:"log_dir,omitempty"` // if LogMedia = file - CompressLogs *bool `yaml:"compress_logs,omitempty"` - LogMaxSize int `yaml:"log_max_size,omitempty"` - LogFormat string `yaml:"log_format,omitempty"` - LogMaxAge int `yaml:"log_max_age,omitempty"` - LogMaxFiles int `yaml:"log_max_files,omitempty"` + LogMedia string `yaml:"log_media"` + LogDir string `yaml:"log_dir,omitempty"` // if LogMedia = file + CompressLogs *bool `yaml:"compress_logs,omitempty"` + LogMaxSize int `yaml:"log_max_size,omitempty"` + LogFormat string `yaml:"log_format,omitempty"` + LogMaxAge int `yaml:"log_max_age,omitempty"` + LogMaxFiles int `yaml:"log_max_files,omitempty"` } func (c LogConfig) GetFormat() string { @@ -46,6 +44,6 @@ func (c LogConfig) NewRotatingLogger(filename string) *lumberjack.Logger { MaxSize: cmp.Or(c.LogMaxSize, defMaxSize), MaxBackups: cmp.Or(c.LogMaxFiles, defMaxFiles), MaxAge: cmp.Or(c.LogMaxAge, defMaxAge), - Compress: *cmp.Or(c.CompressLogs, ptr.Of(defCompress)), + Compress: *cmp.Or(c.CompressLogs, new(defCompress)), } } diff --git a/pkg/cticlient/client_test.go b/pkg/cticlient/client_test.go index 3b6e8f72b..a3f3a4d82 100644 --- a/pkg/cticlient/client_test.go +++ b/pkg/cticlient/client_test.go @@ -13,8 +13,6 @@ import ( log "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/crowdsecurity/go-cs-lib/ptr" ) const validApiKey = "my-api-key" @@ -219,12 +217,12 @@ func TestFireOk(t *testing.T) { assert.Len(t, data.Items, 3) assert.Equal(t, "1.2.3.4", data.Items[0].Ip) //page 1 is the default - data, err = cticlient.Fire(FireParams{Page: ptr.Of(1)}) + data, err = cticlient.Fire(FireParams{Page: new(1)}) require.NoError(t, err) assert.Len(t, data.Items, 3) assert.Equal(t, "1.2.3.4", data.Items[0].Ip) //page 2 - data, err = cticlient.Fire(FireParams{Page: ptr.Of(2)}) + data, err = cticlient.Fire(FireParams{Page: new(2)}) require.NoError(t, err) assert.Len(t, data.Items, 3) assert.Equal(t, "4.2.3.4", data.Items[0].Ip) @@ -267,7 +265,7 @@ func TestSmokeInfoValidIP(t *testing.T) { } assert.Equal(t, "1.1.1.1", resp.Ip) - assert.Equal(t, ptr.Of("1.1.1.0/24"), resp.IpRange) + assert.Equal(t, new("1.1.1.0/24"), resp.IpRange) } func TestSmokeUnknownIP(t *testing.T) { diff --git a/pkg/cticlient/ctiexpr/expr_test.go b/pkg/cticlient/ctiexpr/expr_test.go index 3f11a567e..4bb56a3a1 100644 --- a/pkg/cticlient/ctiexpr/expr_test.go +++ b/pkg/cticlient/ctiexpr/expr_test.go @@ -13,8 +13,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/crowdsecurity/go-cs-lib/ptr" - "github.com/crowdsecurity/crowdsec/pkg/cticlient" ) @@ -114,7 +112,7 @@ func smokeHandler(req *http.Request) *http.Response { func TestNilClient(t *testing.T) { defer ShutdownCrowdsecCTI() - if err := InitCrowdsecCTI(ptr.Of(""), nil, nil, 0); !errors.Is(err, cticlient.ErrDisabled) { + if err := InitCrowdsecCTI(new(""), nil, nil, 0); !errors.Is(err, cticlient.ErrDisabled) { t.Fatalf("failed to init CTI : %s", err) } @@ -126,7 +124,7 @@ func TestNilClient(t *testing.T) { func TestInvalidAuth(t *testing.T) { defer ShutdownCrowdsecCTI() - if err := InitCrowdsecCTI(ptr.Of("asdasd"), nil, nil, 0); err != nil { + if err := InitCrowdsecCTI(new("asdasd"), nil, nil, 0); err != nil { t.Fatalf("failed to init CTI : %s", err) } // Replace the client created by InitCrowdsecCTI with one that uses a custom transport @@ -170,7 +168,7 @@ func TestCache(t *testing.T) { defer ShutdownCrowdsecCTI() cacheDuration := 1 * time.Second - if err := InitCrowdsecCTI(ptr.Of(validApiKey), &cacheDuration, nil, 0); err != nil { + if err := InitCrowdsecCTI(new(validApiKey), &cacheDuration, nil, 0); err != nil { t.Fatalf("failed to init CTI : %s", err) } // Replace the client created by InitCrowdsecCTI with one that uses a custom transport diff --git a/pkg/cticlient/example/fire.go b/pkg/cticlient/example/fire.go index 598175ce0..4ca4a80f5 100644 --- a/pkg/cticlient/example/fire.go +++ b/pkg/cticlient/example/fire.go @@ -9,14 +9,10 @@ import ( "github.com/crowdsecurity/crowdsec/pkg/cticlient" ) -func intPtr(i int) *int { - return &i -} - func main() { client := cticlient.NewCrowdsecCTIClient(cticlient.WithAPIKey(os.Getenv("CTI_API_KEY"))) paginator := cticlient.NewFirePaginator(client, cticlient.FireParams{ - Limit: intPtr(1000), + Limit: new(1000), }) csvHeader := []string{ diff --git a/pkg/cticlient/types_test.go b/pkg/cticlient/types_test.go index 9c7840de3..1a6bdd8be 100644 --- a/pkg/cticlient/types_test.go +++ b/pkg/cticlient/types_test.go @@ -4,8 +4,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - - "github.com/crowdsecurity/go-cs-lib/ptr" ) //func (c *SmokeItem) GetAttackDetails() []string { @@ -16,16 +14,16 @@ func getSampleSmokeItem() SmokeItem { emptyItem := SmokeItem{ IpRangeScore: 2.0, Ip: "1.2.3.4", - IpRange: ptr.Of("1.2.3.0/24"), - AsName: ptr.Of("AS1234"), - AsNum: ptr.Of(1234), + IpRange: new("1.2.3.0/24"), + AsName: new("AS1234"), + AsNum: new(1234), Location: CTILocationInfo{ - Country: ptr.Of("FR"), - City: ptr.Of("Paris"), + Country: new("FR"), + City: new("Paris"), Latitude: &lat, Longitude: &long, }, - ReverseDNS: ptr.Of("foo.bar.com"), + ReverseDNS: new("foo.bar.com"), Behaviors: []*CTIBehavior{ { Name: "ssh:bruteforce", @@ -34,8 +32,8 @@ func getSampleSmokeItem() SmokeItem { }, }, History: CTIHistory{ - FirstSeen: ptr.Of("2022-12-05T17:45:00+00:00"), - LastSeen: ptr.Of("2022-12-06T19:15:00+00:00"), + FirstSeen: new("2022-12-05T17:45:00+00:00"), + LastSeen: new("2022-12-06T19:15:00+00:00"), FullAge: 3, DaysAge: 1, }, @@ -62,7 +60,7 @@ func getSampleSmokeItem() SmokeItem { "GB": 14, "US": 14, }, - BackgroundNoiseScore: ptr.Of(3), + BackgroundNoiseScore: new(3), Scores: CTIScores{ Overall: CTIScore{ Aggressiveness: 2, diff --git a/pkg/database/ent/alert.go b/pkg/database/ent/alert.go index 456db3440..99974dd04 100644 --- a/pkg/database/ent/alert.go +++ b/pkg/database/ent/alert.go @@ -154,7 +154,7 @@ func (*Alert) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Alert fields. -func (a *Alert) assignValues(columns []string, values []any) error { +func (_m *Alert) 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) } @@ -165,166 +165,166 @@ func (a *Alert) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - a.ID = int(value.Int64) + _m.ID = int(value.Int64) case alert.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - a.CreatedAt = value.Time + _m.CreatedAt = value.Time } case alert.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - a.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case alert.FieldScenario: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field scenario", values[i]) } else if value.Valid { - a.Scenario = value.String + _m.Scenario = value.String } case alert.FieldBucketId: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field bucketId", values[i]) } else if value.Valid { - a.BucketId = value.String + _m.BucketId = value.String } case alert.FieldMessage: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field message", values[i]) } else if value.Valid { - a.Message = value.String + _m.Message = value.String } case alert.FieldEventsCount: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field eventsCount", values[i]) } else if value.Valid { - a.EventsCount = int32(value.Int64) + _m.EventsCount = int32(value.Int64) } case alert.FieldStartedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field startedAt", values[i]) } else if value.Valid { - a.StartedAt = value.Time + _m.StartedAt = value.Time } case alert.FieldStoppedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field stoppedAt", values[i]) } else if value.Valid { - a.StoppedAt = value.Time + _m.StoppedAt = value.Time } case alert.FieldSourceIp: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field sourceIp", values[i]) } else if value.Valid { - a.SourceIp = value.String + _m.SourceIp = value.String } case alert.FieldSourceRange: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field sourceRange", values[i]) } else if value.Valid { - a.SourceRange = value.String + _m.SourceRange = value.String } case alert.FieldSourceAsNumber: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field sourceAsNumber", values[i]) } else if value.Valid { - a.SourceAsNumber = value.String + _m.SourceAsNumber = value.String } case alert.FieldSourceAsName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field sourceAsName", values[i]) } else if value.Valid { - a.SourceAsName = value.String + _m.SourceAsName = value.String } case alert.FieldSourceCountry: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field sourceCountry", values[i]) } else if value.Valid { - a.SourceCountry = value.String + _m.SourceCountry = value.String } case alert.FieldSourceLatitude: if value, ok := values[i].(*sql.NullFloat64); !ok { return fmt.Errorf("unexpected type %T for field sourceLatitude", values[i]) } else if value.Valid { - a.SourceLatitude = float32(value.Float64) + _m.SourceLatitude = float32(value.Float64) } case alert.FieldSourceLongitude: if value, ok := values[i].(*sql.NullFloat64); !ok { return fmt.Errorf("unexpected type %T for field sourceLongitude", values[i]) } else if value.Valid { - a.SourceLongitude = float32(value.Float64) + _m.SourceLongitude = float32(value.Float64) } case alert.FieldSourceScope: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field sourceScope", values[i]) } else if value.Valid { - a.SourceScope = value.String + _m.SourceScope = value.String } case alert.FieldSourceValue: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field sourceValue", values[i]) } else if value.Valid { - a.SourceValue = value.String + _m.SourceValue = value.String } case alert.FieldCapacity: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field capacity", values[i]) } else if value.Valid { - a.Capacity = int32(value.Int64) + _m.Capacity = int32(value.Int64) } case alert.FieldLeakSpeed: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field leakSpeed", values[i]) } else if value.Valid { - a.LeakSpeed = value.String + _m.LeakSpeed = value.String } case alert.FieldScenarioVersion: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field scenarioVersion", values[i]) } else if value.Valid { - a.ScenarioVersion = value.String + _m.ScenarioVersion = value.String } case alert.FieldScenarioHash: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field scenarioHash", values[i]) } else if value.Valid { - a.ScenarioHash = value.String + _m.ScenarioHash = value.String } case alert.FieldSimulated: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field simulated", values[i]) } else if value.Valid { - a.Simulated = value.Bool + _m.Simulated = value.Bool } case alert.FieldUUID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field uuid", values[i]) } else if value.Valid { - a.UUID = value.String + _m.UUID = value.String } case alert.FieldRemediation: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field remediation", values[i]) } else if value.Valid { - a.Remediation = value.Bool + _m.Remediation = value.Bool } case alert.FieldKind: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field kind", values[i]) } else if value.Valid { - a.Kind = value.String + _m.Kind = value.String } case alert.ForeignKeys[0]: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for edge-field machine_alerts", value) } else if value.Valid { - a.machine_alerts = new(int) - *a.machine_alerts = int(value.Int64) + _m.machine_alerts = new(int) + *_m.machine_alerts = int(value.Int64) } default: - a.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -332,127 +332,127 @@ func (a *Alert) assignValues(columns []string, values []any) error { // Value returns the ent.Value that was dynamically selected and assigned to the Alert. // This includes values selected through modifiers, order, etc. -func (a *Alert) Value(name string) (ent.Value, error) { - return a.selectValues.Get(name) +func (_m *Alert) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // QueryOwner queries the "owner" edge of the Alert entity. -func (a *Alert) QueryOwner() *MachineQuery { - return NewAlertClient(a.config).QueryOwner(a) +func (_m *Alert) QueryOwner() *MachineQuery { + return NewAlertClient(_m.config).QueryOwner(_m) } // QueryDecisions queries the "decisions" edge of the Alert entity. -func (a *Alert) QueryDecisions() *DecisionQuery { - return NewAlertClient(a.config).QueryDecisions(a) +func (_m *Alert) QueryDecisions() *DecisionQuery { + return NewAlertClient(_m.config).QueryDecisions(_m) } // QueryEvents queries the "events" edge of the Alert entity. -func (a *Alert) QueryEvents() *EventQuery { - return NewAlertClient(a.config).QueryEvents(a) +func (_m *Alert) QueryEvents() *EventQuery { + return NewAlertClient(_m.config).QueryEvents(_m) } // QueryMetas queries the "metas" edge of the Alert entity. -func (a *Alert) QueryMetas() *MetaQuery { - return NewAlertClient(a.config).QueryMetas(a) +func (_m *Alert) QueryMetas() *MetaQuery { + return NewAlertClient(_m.config).QueryMetas(_m) } // Update returns a builder for updating this Alert. // Note that you need to call Alert.Unwrap() before calling this method if this Alert // was returned from a transaction, and the transaction was committed or rolled back. -func (a *Alert) Update() *AlertUpdateOne { - return NewAlertClient(a.config).UpdateOne(a) +func (_m *Alert) Update() *AlertUpdateOne { + return NewAlertClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Alert 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 (a *Alert) Unwrap() *Alert { - _tx, ok := a.config.driver.(*txDriver) +func (_m *Alert) Unwrap() *Alert { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Alert is not a transactional entity") } - a.config.driver = _tx.drv - return a + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (a *Alert) String() string { +func (_m *Alert) String() string { var builder strings.Builder builder.WriteString("Alert(") - builder.WriteString(fmt.Sprintf("id=%v, ", a.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(a.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(a.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("scenario=") - builder.WriteString(a.Scenario) + builder.WriteString(_m.Scenario) builder.WriteString(", ") builder.WriteString("bucketId=") - builder.WriteString(a.BucketId) + builder.WriteString(_m.BucketId) builder.WriteString(", ") builder.WriteString("message=") - builder.WriteString(a.Message) + builder.WriteString(_m.Message) builder.WriteString(", ") builder.WriteString("eventsCount=") - builder.WriteString(fmt.Sprintf("%v", a.EventsCount)) + builder.WriteString(fmt.Sprintf("%v", _m.EventsCount)) builder.WriteString(", ") builder.WriteString("startedAt=") - builder.WriteString(a.StartedAt.Format(time.ANSIC)) + builder.WriteString(_m.StartedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("stoppedAt=") - builder.WriteString(a.StoppedAt.Format(time.ANSIC)) + builder.WriteString(_m.StoppedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("sourceIp=") - builder.WriteString(a.SourceIp) + builder.WriteString(_m.SourceIp) builder.WriteString(", ") builder.WriteString("sourceRange=") - builder.WriteString(a.SourceRange) + builder.WriteString(_m.SourceRange) builder.WriteString(", ") builder.WriteString("sourceAsNumber=") - builder.WriteString(a.SourceAsNumber) + builder.WriteString(_m.SourceAsNumber) builder.WriteString(", ") builder.WriteString("sourceAsName=") - builder.WriteString(a.SourceAsName) + builder.WriteString(_m.SourceAsName) builder.WriteString(", ") builder.WriteString("sourceCountry=") - builder.WriteString(a.SourceCountry) + builder.WriteString(_m.SourceCountry) builder.WriteString(", ") builder.WriteString("sourceLatitude=") - builder.WriteString(fmt.Sprintf("%v", a.SourceLatitude)) + builder.WriteString(fmt.Sprintf("%v", _m.SourceLatitude)) builder.WriteString(", ") builder.WriteString("sourceLongitude=") - builder.WriteString(fmt.Sprintf("%v", a.SourceLongitude)) + builder.WriteString(fmt.Sprintf("%v", _m.SourceLongitude)) builder.WriteString(", ") builder.WriteString("sourceScope=") - builder.WriteString(a.SourceScope) + builder.WriteString(_m.SourceScope) builder.WriteString(", ") builder.WriteString("sourceValue=") - builder.WriteString(a.SourceValue) + builder.WriteString(_m.SourceValue) builder.WriteString(", ") builder.WriteString("capacity=") - builder.WriteString(fmt.Sprintf("%v", a.Capacity)) + builder.WriteString(fmt.Sprintf("%v", _m.Capacity)) builder.WriteString(", ") builder.WriteString("leakSpeed=") - builder.WriteString(a.LeakSpeed) + builder.WriteString(_m.LeakSpeed) builder.WriteString(", ") builder.WriteString("scenarioVersion=") - builder.WriteString(a.ScenarioVersion) + builder.WriteString(_m.ScenarioVersion) builder.WriteString(", ") builder.WriteString("scenarioHash=") - builder.WriteString(a.ScenarioHash) + builder.WriteString(_m.ScenarioHash) builder.WriteString(", ") builder.WriteString("simulated=") - builder.WriteString(fmt.Sprintf("%v", a.Simulated)) + builder.WriteString(fmt.Sprintf("%v", _m.Simulated)) builder.WriteString(", ") builder.WriteString("uuid=") - builder.WriteString(a.UUID) + builder.WriteString(_m.UUID) builder.WriteString(", ") builder.WriteString("remediation=") - builder.WriteString(fmt.Sprintf("%v", a.Remediation)) + builder.WriteString(fmt.Sprintf("%v", _m.Remediation)) builder.WriteString(", ") builder.WriteString("kind=") - builder.WriteString(a.Kind) + builder.WriteString(_m.Kind) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/alert_create.go b/pkg/database/ent/alert_create.go index 57943119b..d36f7e730 100644 --- a/pkg/database/ent/alert_create.go +++ b/pkg/database/ent/alert_create.go @@ -27,425 +27,425 @@ type AlertCreate struct { } // SetCreatedAt sets the "created_at" field. -func (ac *AlertCreate) SetCreatedAt(t time.Time) *AlertCreate { - ac.mutation.SetCreatedAt(t) - return ac +func (_c *AlertCreate) SetCreatedAt(v time.Time) *AlertCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (ac *AlertCreate) SetNillableCreatedAt(t *time.Time) *AlertCreate { - if t != nil { - ac.SetCreatedAt(*t) +func (_c *AlertCreate) SetNillableCreatedAt(v *time.Time) *AlertCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return ac + return _c } // SetUpdatedAt sets the "updated_at" field. -func (ac *AlertCreate) SetUpdatedAt(t time.Time) *AlertCreate { - ac.mutation.SetUpdatedAt(t) - return ac +func (_c *AlertCreate) SetUpdatedAt(v time.Time) *AlertCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (ac *AlertCreate) SetNillableUpdatedAt(t *time.Time) *AlertCreate { - if t != nil { - ac.SetUpdatedAt(*t) +func (_c *AlertCreate) SetNillableUpdatedAt(v *time.Time) *AlertCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return ac + return _c } // SetScenario sets the "scenario" field. -func (ac *AlertCreate) SetScenario(s string) *AlertCreate { - ac.mutation.SetScenario(s) - return ac +func (_c *AlertCreate) SetScenario(v string) *AlertCreate { + _c.mutation.SetScenario(v) + return _c } // SetBucketId sets the "bucketId" field. -func (ac *AlertCreate) SetBucketId(s string) *AlertCreate { - ac.mutation.SetBucketId(s) - return ac +func (_c *AlertCreate) SetBucketId(v string) *AlertCreate { + _c.mutation.SetBucketId(v) + return _c } // SetNillableBucketId sets the "bucketId" field if the given value is not nil. -func (ac *AlertCreate) SetNillableBucketId(s *string) *AlertCreate { - if s != nil { - ac.SetBucketId(*s) +func (_c *AlertCreate) SetNillableBucketId(v *string) *AlertCreate { + if v != nil { + _c.SetBucketId(*v) } - return ac + return _c } // SetMessage sets the "message" field. -func (ac *AlertCreate) SetMessage(s string) *AlertCreate { - ac.mutation.SetMessage(s) - return ac +func (_c *AlertCreate) SetMessage(v string) *AlertCreate { + _c.mutation.SetMessage(v) + return _c } // SetNillableMessage sets the "message" field if the given value is not nil. -func (ac *AlertCreate) SetNillableMessage(s *string) *AlertCreate { - if s != nil { - ac.SetMessage(*s) +func (_c *AlertCreate) SetNillableMessage(v *string) *AlertCreate { + if v != nil { + _c.SetMessage(*v) } - return ac + return _c } // SetEventsCount sets the "eventsCount" field. -func (ac *AlertCreate) SetEventsCount(i int32) *AlertCreate { - ac.mutation.SetEventsCount(i) - return ac +func (_c *AlertCreate) SetEventsCount(v int32) *AlertCreate { + _c.mutation.SetEventsCount(v) + return _c } // SetNillableEventsCount sets the "eventsCount" field if the given value is not nil. -func (ac *AlertCreate) SetNillableEventsCount(i *int32) *AlertCreate { - if i != nil { - ac.SetEventsCount(*i) +func (_c *AlertCreate) SetNillableEventsCount(v *int32) *AlertCreate { + if v != nil { + _c.SetEventsCount(*v) } - return ac + return _c } // SetStartedAt sets the "startedAt" field. -func (ac *AlertCreate) SetStartedAt(t time.Time) *AlertCreate { - ac.mutation.SetStartedAt(t) - return ac +func (_c *AlertCreate) SetStartedAt(v time.Time) *AlertCreate { + _c.mutation.SetStartedAt(v) + return _c } // SetNillableStartedAt sets the "startedAt" field if the given value is not nil. -func (ac *AlertCreate) SetNillableStartedAt(t *time.Time) *AlertCreate { - if t != nil { - ac.SetStartedAt(*t) +func (_c *AlertCreate) SetNillableStartedAt(v *time.Time) *AlertCreate { + if v != nil { + _c.SetStartedAt(*v) } - return ac + return _c } // SetStoppedAt sets the "stoppedAt" field. -func (ac *AlertCreate) SetStoppedAt(t time.Time) *AlertCreate { - ac.mutation.SetStoppedAt(t) - return ac +func (_c *AlertCreate) SetStoppedAt(v time.Time) *AlertCreate { + _c.mutation.SetStoppedAt(v) + return _c } // SetNillableStoppedAt sets the "stoppedAt" field if the given value is not nil. -func (ac *AlertCreate) SetNillableStoppedAt(t *time.Time) *AlertCreate { - if t != nil { - ac.SetStoppedAt(*t) +func (_c *AlertCreate) SetNillableStoppedAt(v *time.Time) *AlertCreate { + if v != nil { + _c.SetStoppedAt(*v) } - return ac + return _c } // SetSourceIp sets the "sourceIp" field. -func (ac *AlertCreate) SetSourceIp(s string) *AlertCreate { - ac.mutation.SetSourceIp(s) - return ac +func (_c *AlertCreate) SetSourceIp(v string) *AlertCreate { + _c.mutation.SetSourceIp(v) + return _c } // SetNillableSourceIp sets the "sourceIp" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceIp(s *string) *AlertCreate { - if s != nil { - ac.SetSourceIp(*s) +func (_c *AlertCreate) SetNillableSourceIp(v *string) *AlertCreate { + if v != nil { + _c.SetSourceIp(*v) } - return ac + return _c } // SetSourceRange sets the "sourceRange" field. -func (ac *AlertCreate) SetSourceRange(s string) *AlertCreate { - ac.mutation.SetSourceRange(s) - return ac +func (_c *AlertCreate) SetSourceRange(v string) *AlertCreate { + _c.mutation.SetSourceRange(v) + return _c } // SetNillableSourceRange sets the "sourceRange" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceRange(s *string) *AlertCreate { - if s != nil { - ac.SetSourceRange(*s) +func (_c *AlertCreate) SetNillableSourceRange(v *string) *AlertCreate { + if v != nil { + _c.SetSourceRange(*v) } - return ac + return _c } // SetSourceAsNumber sets the "sourceAsNumber" field. -func (ac *AlertCreate) SetSourceAsNumber(s string) *AlertCreate { - ac.mutation.SetSourceAsNumber(s) - return ac +func (_c *AlertCreate) SetSourceAsNumber(v string) *AlertCreate { + _c.mutation.SetSourceAsNumber(v) + return _c } // SetNillableSourceAsNumber sets the "sourceAsNumber" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceAsNumber(s *string) *AlertCreate { - if s != nil { - ac.SetSourceAsNumber(*s) +func (_c *AlertCreate) SetNillableSourceAsNumber(v *string) *AlertCreate { + if v != nil { + _c.SetSourceAsNumber(*v) } - return ac + return _c } // SetSourceAsName sets the "sourceAsName" field. -func (ac *AlertCreate) SetSourceAsName(s string) *AlertCreate { - ac.mutation.SetSourceAsName(s) - return ac +func (_c *AlertCreate) SetSourceAsName(v string) *AlertCreate { + _c.mutation.SetSourceAsName(v) + return _c } // SetNillableSourceAsName sets the "sourceAsName" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceAsName(s *string) *AlertCreate { - if s != nil { - ac.SetSourceAsName(*s) +func (_c *AlertCreate) SetNillableSourceAsName(v *string) *AlertCreate { + if v != nil { + _c.SetSourceAsName(*v) } - return ac + return _c } // SetSourceCountry sets the "sourceCountry" field. -func (ac *AlertCreate) SetSourceCountry(s string) *AlertCreate { - ac.mutation.SetSourceCountry(s) - return ac +func (_c *AlertCreate) SetSourceCountry(v string) *AlertCreate { + _c.mutation.SetSourceCountry(v) + return _c } // SetNillableSourceCountry sets the "sourceCountry" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceCountry(s *string) *AlertCreate { - if s != nil { - ac.SetSourceCountry(*s) +func (_c *AlertCreate) SetNillableSourceCountry(v *string) *AlertCreate { + if v != nil { + _c.SetSourceCountry(*v) } - return ac + return _c } // SetSourceLatitude sets the "sourceLatitude" field. -func (ac *AlertCreate) SetSourceLatitude(f float32) *AlertCreate { - ac.mutation.SetSourceLatitude(f) - return ac +func (_c *AlertCreate) SetSourceLatitude(v float32) *AlertCreate { + _c.mutation.SetSourceLatitude(v) + return _c } // SetNillableSourceLatitude sets the "sourceLatitude" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceLatitude(f *float32) *AlertCreate { - if f != nil { - ac.SetSourceLatitude(*f) +func (_c *AlertCreate) SetNillableSourceLatitude(v *float32) *AlertCreate { + if v != nil { + _c.SetSourceLatitude(*v) } - return ac + return _c } // SetSourceLongitude sets the "sourceLongitude" field. -func (ac *AlertCreate) SetSourceLongitude(f float32) *AlertCreate { - ac.mutation.SetSourceLongitude(f) - return ac +func (_c *AlertCreate) SetSourceLongitude(v float32) *AlertCreate { + _c.mutation.SetSourceLongitude(v) + return _c } // SetNillableSourceLongitude sets the "sourceLongitude" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceLongitude(f *float32) *AlertCreate { - if f != nil { - ac.SetSourceLongitude(*f) +func (_c *AlertCreate) SetNillableSourceLongitude(v *float32) *AlertCreate { + if v != nil { + _c.SetSourceLongitude(*v) } - return ac + return _c } // SetSourceScope sets the "sourceScope" field. -func (ac *AlertCreate) SetSourceScope(s string) *AlertCreate { - ac.mutation.SetSourceScope(s) - return ac +func (_c *AlertCreate) SetSourceScope(v string) *AlertCreate { + _c.mutation.SetSourceScope(v) + return _c } // SetNillableSourceScope sets the "sourceScope" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceScope(s *string) *AlertCreate { - if s != nil { - ac.SetSourceScope(*s) +func (_c *AlertCreate) SetNillableSourceScope(v *string) *AlertCreate { + if v != nil { + _c.SetSourceScope(*v) } - return ac + return _c } // SetSourceValue sets the "sourceValue" field. -func (ac *AlertCreate) SetSourceValue(s string) *AlertCreate { - ac.mutation.SetSourceValue(s) - return ac +func (_c *AlertCreate) SetSourceValue(v string) *AlertCreate { + _c.mutation.SetSourceValue(v) + return _c } // SetNillableSourceValue sets the "sourceValue" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSourceValue(s *string) *AlertCreate { - if s != nil { - ac.SetSourceValue(*s) +func (_c *AlertCreate) SetNillableSourceValue(v *string) *AlertCreate { + if v != nil { + _c.SetSourceValue(*v) } - return ac + return _c } // SetCapacity sets the "capacity" field. -func (ac *AlertCreate) SetCapacity(i int32) *AlertCreate { - ac.mutation.SetCapacity(i) - return ac +func (_c *AlertCreate) SetCapacity(v int32) *AlertCreate { + _c.mutation.SetCapacity(v) + return _c } // SetNillableCapacity sets the "capacity" field if the given value is not nil. -func (ac *AlertCreate) SetNillableCapacity(i *int32) *AlertCreate { - if i != nil { - ac.SetCapacity(*i) +func (_c *AlertCreate) SetNillableCapacity(v *int32) *AlertCreate { + if v != nil { + _c.SetCapacity(*v) } - return ac + return _c } // SetLeakSpeed sets the "leakSpeed" field. -func (ac *AlertCreate) SetLeakSpeed(s string) *AlertCreate { - ac.mutation.SetLeakSpeed(s) - return ac +func (_c *AlertCreate) SetLeakSpeed(v string) *AlertCreate { + _c.mutation.SetLeakSpeed(v) + return _c } // SetNillableLeakSpeed sets the "leakSpeed" field if the given value is not nil. -func (ac *AlertCreate) SetNillableLeakSpeed(s *string) *AlertCreate { - if s != nil { - ac.SetLeakSpeed(*s) +func (_c *AlertCreate) SetNillableLeakSpeed(v *string) *AlertCreate { + if v != nil { + _c.SetLeakSpeed(*v) } - return ac + return _c } // SetScenarioVersion sets the "scenarioVersion" field. -func (ac *AlertCreate) SetScenarioVersion(s string) *AlertCreate { - ac.mutation.SetScenarioVersion(s) - return ac +func (_c *AlertCreate) SetScenarioVersion(v string) *AlertCreate { + _c.mutation.SetScenarioVersion(v) + return _c } // SetNillableScenarioVersion sets the "scenarioVersion" field if the given value is not nil. -func (ac *AlertCreate) SetNillableScenarioVersion(s *string) *AlertCreate { - if s != nil { - ac.SetScenarioVersion(*s) +func (_c *AlertCreate) SetNillableScenarioVersion(v *string) *AlertCreate { + if v != nil { + _c.SetScenarioVersion(*v) } - return ac + return _c } // SetScenarioHash sets the "scenarioHash" field. -func (ac *AlertCreate) SetScenarioHash(s string) *AlertCreate { - ac.mutation.SetScenarioHash(s) - return ac +func (_c *AlertCreate) SetScenarioHash(v string) *AlertCreate { + _c.mutation.SetScenarioHash(v) + return _c } // SetNillableScenarioHash sets the "scenarioHash" field if the given value is not nil. -func (ac *AlertCreate) SetNillableScenarioHash(s *string) *AlertCreate { - if s != nil { - ac.SetScenarioHash(*s) +func (_c *AlertCreate) SetNillableScenarioHash(v *string) *AlertCreate { + if v != nil { + _c.SetScenarioHash(*v) } - return ac + return _c } // SetSimulated sets the "simulated" field. -func (ac *AlertCreate) SetSimulated(b bool) *AlertCreate { - ac.mutation.SetSimulated(b) - return ac +func (_c *AlertCreate) SetSimulated(v bool) *AlertCreate { + _c.mutation.SetSimulated(v) + return _c } // SetNillableSimulated sets the "simulated" field if the given value is not nil. -func (ac *AlertCreate) SetNillableSimulated(b *bool) *AlertCreate { - if b != nil { - ac.SetSimulated(*b) +func (_c *AlertCreate) SetNillableSimulated(v *bool) *AlertCreate { + if v != nil { + _c.SetSimulated(*v) } - return ac + return _c } // SetUUID sets the "uuid" field. -func (ac *AlertCreate) SetUUID(s string) *AlertCreate { - ac.mutation.SetUUID(s) - return ac +func (_c *AlertCreate) SetUUID(v string) *AlertCreate { + _c.mutation.SetUUID(v) + return _c } // SetNillableUUID sets the "uuid" field if the given value is not nil. -func (ac *AlertCreate) SetNillableUUID(s *string) *AlertCreate { - if s != nil { - ac.SetUUID(*s) +func (_c *AlertCreate) SetNillableUUID(v *string) *AlertCreate { + if v != nil { + _c.SetUUID(*v) } - return ac + return _c } // SetRemediation sets the "remediation" field. -func (ac *AlertCreate) SetRemediation(b bool) *AlertCreate { - ac.mutation.SetRemediation(b) - return ac +func (_c *AlertCreate) SetRemediation(v bool) *AlertCreate { + _c.mutation.SetRemediation(v) + return _c } // SetNillableRemediation sets the "remediation" field if the given value is not nil. -func (ac *AlertCreate) SetNillableRemediation(b *bool) *AlertCreate { - if b != nil { - ac.SetRemediation(*b) +func (_c *AlertCreate) SetNillableRemediation(v *bool) *AlertCreate { + if v != nil { + _c.SetRemediation(*v) } - return ac + return _c } // SetKind sets the "kind" field. -func (ac *AlertCreate) SetKind(s string) *AlertCreate { - ac.mutation.SetKind(s) - return ac +func (_c *AlertCreate) SetKind(v string) *AlertCreate { + _c.mutation.SetKind(v) + return _c } // SetNillableKind sets the "kind" field if the given value is not nil. -func (ac *AlertCreate) SetNillableKind(s *string) *AlertCreate { - if s != nil { - ac.SetKind(*s) +func (_c *AlertCreate) SetNillableKind(v *string) *AlertCreate { + if v != nil { + _c.SetKind(*v) } - return ac + return _c } // SetOwnerID sets the "owner" edge to the Machine entity by ID. -func (ac *AlertCreate) SetOwnerID(id int) *AlertCreate { - ac.mutation.SetOwnerID(id) - return ac +func (_c *AlertCreate) SetOwnerID(id int) *AlertCreate { + _c.mutation.SetOwnerID(id) + return _c } // SetNillableOwnerID sets the "owner" edge to the Machine entity by ID if the given value is not nil. -func (ac *AlertCreate) SetNillableOwnerID(id *int) *AlertCreate { +func (_c *AlertCreate) SetNillableOwnerID(id *int) *AlertCreate { if id != nil { - ac = ac.SetOwnerID(*id) + _c = _c.SetOwnerID(*id) } - return ac + return _c } // SetOwner sets the "owner" edge to the Machine entity. -func (ac *AlertCreate) SetOwner(m *Machine) *AlertCreate { - return ac.SetOwnerID(m.ID) +func (_c *AlertCreate) SetOwner(v *Machine) *AlertCreate { + return _c.SetOwnerID(v.ID) } // AddDecisionIDs adds the "decisions" edge to the Decision entity by IDs. -func (ac *AlertCreate) AddDecisionIDs(ids ...int) *AlertCreate { - ac.mutation.AddDecisionIDs(ids...) - return ac +func (_c *AlertCreate) AddDecisionIDs(ids ...int) *AlertCreate { + _c.mutation.AddDecisionIDs(ids...) + return _c } // AddDecisions adds the "decisions" edges to the Decision entity. -func (ac *AlertCreate) AddDecisions(d ...*Decision) *AlertCreate { - ids := make([]int, len(d)) - for i := range d { - ids[i] = d[i].ID +func (_c *AlertCreate) AddDecisions(v ...*Decision) *AlertCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return ac.AddDecisionIDs(ids...) + return _c.AddDecisionIDs(ids...) } // AddEventIDs adds the "events" edge to the Event entity by IDs. -func (ac *AlertCreate) AddEventIDs(ids ...int) *AlertCreate { - ac.mutation.AddEventIDs(ids...) - return ac +func (_c *AlertCreate) AddEventIDs(ids ...int) *AlertCreate { + _c.mutation.AddEventIDs(ids...) + return _c } // AddEvents adds the "events" edges to the Event entity. -func (ac *AlertCreate) AddEvents(e ...*Event) *AlertCreate { - ids := make([]int, len(e)) - for i := range e { - ids[i] = e[i].ID +func (_c *AlertCreate) AddEvents(v ...*Event) *AlertCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return ac.AddEventIDs(ids...) + return _c.AddEventIDs(ids...) } // AddMetaIDs adds the "metas" edge to the Meta entity by IDs. -func (ac *AlertCreate) AddMetaIDs(ids ...int) *AlertCreate { - ac.mutation.AddMetaIDs(ids...) - return ac +func (_c *AlertCreate) AddMetaIDs(ids ...int) *AlertCreate { + _c.mutation.AddMetaIDs(ids...) + return _c } // AddMetas adds the "metas" edges to the Meta entity. -func (ac *AlertCreate) AddMetas(m ...*Meta) *AlertCreate { - ids := make([]int, len(m)) - for i := range m { - ids[i] = m[i].ID +func (_c *AlertCreate) AddMetas(v ...*Meta) *AlertCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return ac.AddMetaIDs(ids...) + return _c.AddMetaIDs(ids...) } // Mutation returns the AlertMutation object of the builder. -func (ac *AlertCreate) Mutation() *AlertMutation { - return ac.mutation +func (_c *AlertCreate) Mutation() *AlertMutation { + return _c.mutation } // Save creates the Alert in the database. -func (ac *AlertCreate) Save(ctx context.Context) (*Alert, error) { - ac.defaults() - return withHooks(ctx, ac.sqlSave, ac.mutation, ac.hooks) +func (_c *AlertCreate) Save(ctx context.Context) (*Alert, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (ac *AlertCreate) SaveX(ctx context.Context) *Alert { - v, err := ac.Save(ctx) +func (_c *AlertCreate) SaveX(ctx context.Context) *Alert { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -453,77 +453,77 @@ func (ac *AlertCreate) SaveX(ctx context.Context) *Alert { } // Exec executes the query. -func (ac *AlertCreate) Exec(ctx context.Context) error { - _, err := ac.Save(ctx) +func (_c *AlertCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (ac *AlertCreate) ExecX(ctx context.Context) { - if err := ac.Exec(ctx); err != nil { +func (_c *AlertCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (ac *AlertCreate) defaults() { - if _, ok := ac.mutation.CreatedAt(); !ok { +func (_c *AlertCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := alert.DefaultCreatedAt() - ac.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := ac.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := alert.DefaultUpdatedAt() - ac.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } - if _, ok := ac.mutation.BucketId(); !ok { + if _, ok := _c.mutation.BucketId(); !ok { v := alert.DefaultBucketId - ac.mutation.SetBucketId(v) + _c.mutation.SetBucketId(v) } - if _, ok := ac.mutation.Message(); !ok { + if _, ok := _c.mutation.Message(); !ok { v := alert.DefaultMessage - ac.mutation.SetMessage(v) + _c.mutation.SetMessage(v) } - if _, ok := ac.mutation.EventsCount(); !ok { + if _, ok := _c.mutation.EventsCount(); !ok { v := alert.DefaultEventsCount - ac.mutation.SetEventsCount(v) + _c.mutation.SetEventsCount(v) } - if _, ok := ac.mutation.StartedAt(); !ok { + if _, ok := _c.mutation.StartedAt(); !ok { v := alert.DefaultStartedAt() - ac.mutation.SetStartedAt(v) + _c.mutation.SetStartedAt(v) } - if _, ok := ac.mutation.StoppedAt(); !ok { + if _, ok := _c.mutation.StoppedAt(); !ok { v := alert.DefaultStoppedAt() - ac.mutation.SetStoppedAt(v) + _c.mutation.SetStoppedAt(v) } - if _, ok := ac.mutation.Simulated(); !ok { + if _, ok := _c.mutation.Simulated(); !ok { v := alert.DefaultSimulated - ac.mutation.SetSimulated(v) + _c.mutation.SetSimulated(v) } } // check runs all checks and user-defined validators on the builder. -func (ac *AlertCreate) check() error { - if _, ok := ac.mutation.CreatedAt(); !ok { +func (_c *AlertCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Alert.created_at"`)} } - if _, ok := ac.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Alert.updated_at"`)} } - if _, ok := ac.mutation.Scenario(); !ok { + if _, ok := _c.mutation.Scenario(); !ok { return &ValidationError{Name: "scenario", err: errors.New(`ent: missing required field "Alert.scenario"`)} } - if _, ok := ac.mutation.Simulated(); !ok { + if _, ok := _c.mutation.Simulated(); !ok { return &ValidationError{Name: "simulated", err: errors.New(`ent: missing required field "Alert.simulated"`)} } return nil } -func (ac *AlertCreate) sqlSave(ctx context.Context) (*Alert, error) { - if err := ac.check(); err != nil { +func (_c *AlertCreate) sqlSave(ctx context.Context) (*Alert, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := ac.createSpec() - if err := sqlgraph.CreateNode(ctx, ac.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -531,118 +531,118 @@ func (ac *AlertCreate) sqlSave(ctx context.Context) (*Alert, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - ac.mutation.id = &_node.ID - ac.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (ac *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) { +func (_c *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) { var ( - _node = &Alert{config: ac.config} + _node = &Alert{config: _c.config} _spec = sqlgraph.NewCreateSpec(alert.Table, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt)) ) - _spec.OnConflict = ac.conflict - if value, ok := ac.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(alert.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := ac.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := ac.mutation.Scenario(); ok { + if value, ok := _c.mutation.Scenario(); ok { _spec.SetField(alert.FieldScenario, field.TypeString, value) _node.Scenario = value } - if value, ok := ac.mutation.BucketId(); ok { + if value, ok := _c.mutation.BucketId(); ok { _spec.SetField(alert.FieldBucketId, field.TypeString, value) _node.BucketId = value } - if value, ok := ac.mutation.Message(); ok { + if value, ok := _c.mutation.Message(); ok { _spec.SetField(alert.FieldMessage, field.TypeString, value) _node.Message = value } - if value, ok := ac.mutation.EventsCount(); ok { + if value, ok := _c.mutation.EventsCount(); ok { _spec.SetField(alert.FieldEventsCount, field.TypeInt32, value) _node.EventsCount = value } - if value, ok := ac.mutation.StartedAt(); ok { + if value, ok := _c.mutation.StartedAt(); ok { _spec.SetField(alert.FieldStartedAt, field.TypeTime, value) _node.StartedAt = value } - if value, ok := ac.mutation.StoppedAt(); ok { + if value, ok := _c.mutation.StoppedAt(); ok { _spec.SetField(alert.FieldStoppedAt, field.TypeTime, value) _node.StoppedAt = value } - if value, ok := ac.mutation.SourceIp(); ok { + if value, ok := _c.mutation.SourceIp(); ok { _spec.SetField(alert.FieldSourceIp, field.TypeString, value) _node.SourceIp = value } - if value, ok := ac.mutation.SourceRange(); ok { + if value, ok := _c.mutation.SourceRange(); ok { _spec.SetField(alert.FieldSourceRange, field.TypeString, value) _node.SourceRange = value } - if value, ok := ac.mutation.SourceAsNumber(); ok { + if value, ok := _c.mutation.SourceAsNumber(); ok { _spec.SetField(alert.FieldSourceAsNumber, field.TypeString, value) _node.SourceAsNumber = value } - if value, ok := ac.mutation.SourceAsName(); ok { + if value, ok := _c.mutation.SourceAsName(); ok { _spec.SetField(alert.FieldSourceAsName, field.TypeString, value) _node.SourceAsName = value } - if value, ok := ac.mutation.SourceCountry(); ok { + if value, ok := _c.mutation.SourceCountry(); ok { _spec.SetField(alert.FieldSourceCountry, field.TypeString, value) _node.SourceCountry = value } - if value, ok := ac.mutation.SourceLatitude(); ok { + if value, ok := _c.mutation.SourceLatitude(); ok { _spec.SetField(alert.FieldSourceLatitude, field.TypeFloat32, value) _node.SourceLatitude = value } - if value, ok := ac.mutation.SourceLongitude(); ok { + if value, ok := _c.mutation.SourceLongitude(); ok { _spec.SetField(alert.FieldSourceLongitude, field.TypeFloat32, value) _node.SourceLongitude = value } - if value, ok := ac.mutation.SourceScope(); ok { + if value, ok := _c.mutation.SourceScope(); ok { _spec.SetField(alert.FieldSourceScope, field.TypeString, value) _node.SourceScope = value } - if value, ok := ac.mutation.SourceValue(); ok { + if value, ok := _c.mutation.SourceValue(); ok { _spec.SetField(alert.FieldSourceValue, field.TypeString, value) _node.SourceValue = value } - if value, ok := ac.mutation.Capacity(); ok { + if value, ok := _c.mutation.Capacity(); ok { _spec.SetField(alert.FieldCapacity, field.TypeInt32, value) _node.Capacity = value } - if value, ok := ac.mutation.LeakSpeed(); ok { + if value, ok := _c.mutation.LeakSpeed(); ok { _spec.SetField(alert.FieldLeakSpeed, field.TypeString, value) _node.LeakSpeed = value } - if value, ok := ac.mutation.ScenarioVersion(); ok { + if value, ok := _c.mutation.ScenarioVersion(); ok { _spec.SetField(alert.FieldScenarioVersion, field.TypeString, value) _node.ScenarioVersion = value } - if value, ok := ac.mutation.ScenarioHash(); ok { + if value, ok := _c.mutation.ScenarioHash(); ok { _spec.SetField(alert.FieldScenarioHash, field.TypeString, value) _node.ScenarioHash = value } - if value, ok := ac.mutation.Simulated(); ok { + if value, ok := _c.mutation.Simulated(); ok { _spec.SetField(alert.FieldSimulated, field.TypeBool, value) _node.Simulated = value } - if value, ok := ac.mutation.UUID(); ok { + if value, ok := _c.mutation.UUID(); ok { _spec.SetField(alert.FieldUUID, field.TypeString, value) _node.UUID = value } - if value, ok := ac.mutation.Remediation(); ok { + if value, ok := _c.mutation.Remediation(); ok { _spec.SetField(alert.FieldRemediation, field.TypeBool, value) _node.Remediation = value } - if value, ok := ac.mutation.Kind(); ok { + if value, ok := _c.mutation.Kind(); ok { _spec.SetField(alert.FieldKind, field.TypeString, value) _node.Kind = value } - if nodes := ac.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -659,7 +659,7 @@ func (ac *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) { _node.machine_alerts = &nodes[0] _spec.Edges = append(_spec.Edges, edge) } - if nodes := ac.mutation.DecisionsIDs(); len(nodes) > 0 { + if nodes := _c.mutation.DecisionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -675,7 +675,7 @@ func (ac *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - if nodes := ac.mutation.EventsIDs(); len(nodes) > 0 { + if nodes := _c.mutation.EventsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -691,7 +691,7 @@ func (ac *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - if nodes := ac.mutation.MetasIDs(); len(nodes) > 0 { + if nodes := _c.mutation.MetasIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -726,10 +726,10 @@ func (ac *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (ac *AlertCreate) OnConflict(opts ...sql.ConflictOption) *AlertUpsertOne { - ac.conflict = opts +func (_c *AlertCreate) OnConflict(opts ...sql.ConflictOption) *AlertUpsertOne { + _c.conflict = opts return &AlertUpsertOne{ - create: ac, + create: _c, } } @@ -739,10 +739,10 @@ func (ac *AlertCreate) OnConflict(opts ...sql.ConflictOption) *AlertUpsertOne { // client.Alert.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (ac *AlertCreate) OnConflictColumns(columns ...string) *AlertUpsertOne { - ac.conflict = append(ac.conflict, sql.ConflictColumns(columns...)) +func (_c *AlertCreate) OnConflictColumns(columns ...string) *AlertUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AlertUpsertOne{ - create: ac, + create: _c, } } @@ -941,16 +941,16 @@ type AlertCreateBulk struct { } // Save creates the Alert entities in the database. -func (acb *AlertCreateBulk) Save(ctx context.Context) ([]*Alert, error) { - if acb.err != nil { - return nil, acb.err +func (_c *AlertCreateBulk) Save(ctx context.Context) ([]*Alert, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(acb.builders)) - nodes := make([]*Alert, len(acb.builders)) - mutators := make([]Mutator, len(acb.builders)) - for i := range acb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Alert, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := acb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*AlertMutation) @@ -964,12 +964,12 @@ func (acb *AlertCreateBulk) Save(ctx context.Context) ([]*Alert, error) { var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, acb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = acb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, acb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -993,7 +993,7 @@ func (acb *AlertCreateBulk) Save(ctx context.Context) ([]*Alert, error) { }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, acb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -1001,8 +1001,8 @@ func (acb *AlertCreateBulk) Save(ctx context.Context) ([]*Alert, error) { } // SaveX is like Save, but panics if an error occurs. -func (acb *AlertCreateBulk) SaveX(ctx context.Context) []*Alert { - v, err := acb.Save(ctx) +func (_c *AlertCreateBulk) SaveX(ctx context.Context) []*Alert { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -1010,14 +1010,14 @@ func (acb *AlertCreateBulk) SaveX(ctx context.Context) []*Alert { } // Exec executes the query. -func (acb *AlertCreateBulk) Exec(ctx context.Context) error { - _, err := acb.Save(ctx) +func (_c *AlertCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (acb *AlertCreateBulk) ExecX(ctx context.Context) { - if err := acb.Exec(ctx); err != nil { +func (_c *AlertCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -1037,10 +1037,10 @@ func (acb *AlertCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (acb *AlertCreateBulk) OnConflict(opts ...sql.ConflictOption) *AlertUpsertBulk { - acb.conflict = opts +func (_c *AlertCreateBulk) OnConflict(opts ...sql.ConflictOption) *AlertUpsertBulk { + _c.conflict = opts return &AlertUpsertBulk{ - create: acb, + create: _c, } } @@ -1050,10 +1050,10 @@ func (acb *AlertCreateBulk) OnConflict(opts ...sql.ConflictOption) *AlertUpsertB // client.Alert.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (acb *AlertCreateBulk) OnConflictColumns(columns ...string) *AlertUpsertBulk { - acb.conflict = append(acb.conflict, sql.ConflictColumns(columns...)) +func (_c *AlertCreateBulk) OnConflictColumns(columns ...string) *AlertUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AlertUpsertBulk{ - create: acb, + create: _c, } } diff --git a/pkg/database/ent/alert_delete.go b/pkg/database/ent/alert_delete.go index 15b3a4c82..679592d80 100644 --- a/pkg/database/ent/alert_delete.go +++ b/pkg/database/ent/alert_delete.go @@ -20,56 +20,56 @@ type AlertDelete struct { } // Where appends a list predicates to the AlertDelete builder. -func (ad *AlertDelete) Where(ps ...predicate.Alert) *AlertDelete { - ad.mutation.Where(ps...) - return ad +func (_d *AlertDelete) Where(ps ...predicate.Alert) *AlertDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (ad *AlertDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, ad.sqlExec, ad.mutation, ad.hooks) +func (_d *AlertDelete) 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 (ad *AlertDelete) ExecX(ctx context.Context) int { - n, err := ad.Exec(ctx) +func (_d *AlertDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (ad *AlertDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *AlertDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(alert.Table, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt)) - if ps := ad.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, ad.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - ad.mutation.done = true + _d.mutation.done = true return affected, err } // AlertDeleteOne is the builder for deleting a single Alert entity. type AlertDeleteOne struct { - ad *AlertDelete + _d *AlertDelete } // Where appends a list predicates to the AlertDelete builder. -func (ado *AlertDeleteOne) Where(ps ...predicate.Alert) *AlertDeleteOne { - ado.ad.mutation.Where(ps...) - return ado +func (_d *AlertDeleteOne) Where(ps ...predicate.Alert) *AlertDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (ado *AlertDeleteOne) Exec(ctx context.Context) error { - n, err := ado.ad.Exec(ctx) +func (_d *AlertDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (ado *AlertDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (ado *AlertDeleteOne) ExecX(ctx context.Context) { - if err := ado.Exec(ctx); err != nil { +func (_d *AlertDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/alert_query.go b/pkg/database/ent/alert_query.go index ae0fbc965..b3fad4f3a 100644 --- a/pkg/database/ent/alert_query.go +++ b/pkg/database/ent/alert_query.go @@ -38,44 +38,44 @@ type AlertQuery struct { } // Where adds a new predicate for the AlertQuery builder. -func (aq *AlertQuery) Where(ps ...predicate.Alert) *AlertQuery { - aq.predicates = append(aq.predicates, ps...) - return aq +func (_q *AlertQuery) Where(ps ...predicate.Alert) *AlertQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (aq *AlertQuery) Limit(limit int) *AlertQuery { - aq.ctx.Limit = &limit - return aq +func (_q *AlertQuery) Limit(limit int) *AlertQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (aq *AlertQuery) Offset(offset int) *AlertQuery { - aq.ctx.Offset = &offset - return aq +func (_q *AlertQuery) Offset(offset int) *AlertQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (aq *AlertQuery) Unique(unique bool) *AlertQuery { - aq.ctx.Unique = &unique - return aq +func (_q *AlertQuery) Unique(unique bool) *AlertQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (aq *AlertQuery) Order(o ...alert.OrderOption) *AlertQuery { - aq.order = append(aq.order, o...) - return aq +func (_q *AlertQuery) Order(o ...alert.OrderOption) *AlertQuery { + _q.order = append(_q.order, o...) + return _q } // QueryOwner chains the current query on the "owner" edge. -func (aq *AlertQuery) QueryOwner() *MachineQuery { - query := (&MachineClient{config: aq.config}).Query() +func (_q *AlertQuery) QueryOwner() *MachineQuery { + query := (&MachineClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := aq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := aq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -84,20 +84,20 @@ func (aq *AlertQuery) QueryOwner() *MachineQuery { sqlgraph.To(machine.Table, machine.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, alert.OwnerTable, alert.OwnerColumn), ) - fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryDecisions chains the current query on the "decisions" edge. -func (aq *AlertQuery) QueryDecisions() *DecisionQuery { - query := (&DecisionClient{config: aq.config}).Query() +func (_q *AlertQuery) QueryDecisions() *DecisionQuery { + query := (&DecisionClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := aq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := aq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -106,20 +106,20 @@ func (aq *AlertQuery) QueryDecisions() *DecisionQuery { sqlgraph.To(decision.Table, decision.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, alert.DecisionsTable, alert.DecisionsColumn), ) - fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryEvents chains the current query on the "events" edge. -func (aq *AlertQuery) QueryEvents() *EventQuery { - query := (&EventClient{config: aq.config}).Query() +func (_q *AlertQuery) QueryEvents() *EventQuery { + query := (&EventClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := aq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := aq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -128,20 +128,20 @@ func (aq *AlertQuery) QueryEvents() *EventQuery { sqlgraph.To(event.Table, event.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, alert.EventsTable, alert.EventsColumn), ) - fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query } // QueryMetas chains the current query on the "metas" edge. -func (aq *AlertQuery) QueryMetas() *MetaQuery { - query := (&MetaClient{config: aq.config}).Query() +func (_q *AlertQuery) QueryMetas() *MetaQuery { + query := (&MetaClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := aq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := aq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -150,7 +150,7 @@ func (aq *AlertQuery) QueryMetas() *MetaQuery { sqlgraph.To(meta.Table, meta.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, alert.MetasTable, alert.MetasColumn), ) - fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query @@ -158,8 +158,8 @@ func (aq *AlertQuery) QueryMetas() *MetaQuery { // First returns the first Alert entity from the query. // Returns a *NotFoundError when no Alert was found. -func (aq *AlertQuery) First(ctx context.Context) (*Alert, error) { - nodes, err := aq.Limit(1).All(setContextOp(ctx, aq.ctx, ent.OpQueryFirst)) +func (_q *AlertQuery) First(ctx context.Context) (*Alert, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -170,8 +170,8 @@ func (aq *AlertQuery) First(ctx context.Context) (*Alert, error) { } // FirstX is like First, but panics if an error occurs. -func (aq *AlertQuery) FirstX(ctx context.Context) *Alert { - node, err := aq.First(ctx) +func (_q *AlertQuery) FirstX(ctx context.Context) *Alert { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -180,9 +180,9 @@ func (aq *AlertQuery) FirstX(ctx context.Context) *Alert { // FirstID returns the first Alert ID from the query. // Returns a *NotFoundError when no Alert ID was found. -func (aq *AlertQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *AlertQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = aq.Limit(1).IDs(setContextOp(ctx, aq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -193,8 +193,8 @@ func (aq *AlertQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (aq *AlertQuery) FirstIDX(ctx context.Context) int { - id, err := aq.FirstID(ctx) +func (_q *AlertQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -204,8 +204,8 @@ func (aq *AlertQuery) FirstIDX(ctx context.Context) int { // Only returns a single Alert entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Alert entity is found. // Returns a *NotFoundError when no Alert entities are found. -func (aq *AlertQuery) Only(ctx context.Context) (*Alert, error) { - nodes, err := aq.Limit(2).All(setContextOp(ctx, aq.ctx, ent.OpQueryOnly)) +func (_q *AlertQuery) Only(ctx context.Context) (*Alert, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -220,8 +220,8 @@ func (aq *AlertQuery) Only(ctx context.Context) (*Alert, error) { } // OnlyX is like Only, but panics if an error occurs. -func (aq *AlertQuery) OnlyX(ctx context.Context) *Alert { - node, err := aq.Only(ctx) +func (_q *AlertQuery) OnlyX(ctx context.Context) *Alert { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -231,9 +231,9 @@ func (aq *AlertQuery) OnlyX(ctx context.Context) *Alert { // OnlyID is like Only, but returns the only Alert ID in the query. // Returns a *NotSingularError when more than one Alert ID is found. // Returns a *NotFoundError when no entities are found. -func (aq *AlertQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *AlertQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = aq.Limit(2).IDs(setContextOp(ctx, aq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -248,8 +248,8 @@ func (aq *AlertQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (aq *AlertQuery) OnlyIDX(ctx context.Context) int { - id, err := aq.OnlyID(ctx) +func (_q *AlertQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -257,18 +257,18 @@ func (aq *AlertQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of Alerts. -func (aq *AlertQuery) All(ctx context.Context) ([]*Alert, error) { - ctx = setContextOp(ctx, aq.ctx, ent.OpQueryAll) - if err := aq.prepareQuery(ctx); err != nil { +func (_q *AlertQuery) All(ctx context.Context) ([]*Alert, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Alert, *AlertQuery]() - return withInterceptors[[]*Alert](ctx, aq, qr, aq.inters) + return withInterceptors[[]*Alert](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (aq *AlertQuery) AllX(ctx context.Context) []*Alert { - nodes, err := aq.All(ctx) +func (_q *AlertQuery) AllX(ctx context.Context) []*Alert { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -276,20 +276,20 @@ func (aq *AlertQuery) AllX(ctx context.Context) []*Alert { } // IDs executes the query and returns a list of Alert IDs. -func (aq *AlertQuery) IDs(ctx context.Context) (ids []int, err error) { - if aq.ctx.Unique == nil && aq.path != nil { - aq.Unique(true) +func (_q *AlertQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, aq.ctx, ent.OpQueryIDs) - if err = aq.Select(alert.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(alert.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (aq *AlertQuery) IDsX(ctx context.Context) []int { - ids, err := aq.IDs(ctx) +func (_q *AlertQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -297,17 +297,17 @@ func (aq *AlertQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (aq *AlertQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, aq.ctx, ent.OpQueryCount) - if err := aq.prepareQuery(ctx); err != nil { +func (_q *AlertQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, aq, querierCount[*AlertQuery](), aq.inters) + return withInterceptors[int](ctx, _q, querierCount[*AlertQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (aq *AlertQuery) CountX(ctx context.Context) int { - count, err := aq.Count(ctx) +func (_q *AlertQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -315,9 +315,9 @@ func (aq *AlertQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (aq *AlertQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, aq.ctx, ent.OpQueryExist) - switch _, err := aq.FirstID(ctx); { +func (_q *AlertQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -328,8 +328,8 @@ func (aq *AlertQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (aq *AlertQuery) ExistX(ctx context.Context) bool { - exist, err := aq.Exist(ctx) +func (_q *AlertQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -338,68 +338,68 @@ func (aq *AlertQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the AlertQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (aq *AlertQuery) Clone() *AlertQuery { - if aq == nil { +func (_q *AlertQuery) Clone() *AlertQuery { + if _q == nil { return nil } return &AlertQuery{ - config: aq.config, - ctx: aq.ctx.Clone(), - order: append([]alert.OrderOption{}, aq.order...), - inters: append([]Interceptor{}, aq.inters...), - predicates: append([]predicate.Alert{}, aq.predicates...), - withOwner: aq.withOwner.Clone(), - withDecisions: aq.withDecisions.Clone(), - withEvents: aq.withEvents.Clone(), - withMetas: aq.withMetas.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]alert.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Alert{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), + withDecisions: _q.withDecisions.Clone(), + withEvents: _q.withEvents.Clone(), + withMetas: _q.withMetas.Clone(), // clone intermediate query. - sql: aq.sql.Clone(), - path: aq.path, + sql: _q.sql.Clone(), + path: _q.path, } } // WithOwner tells the query-builder to eager-load the nodes that are connected to // the "owner" edge. The optional arguments are used to configure the query builder of the edge. -func (aq *AlertQuery) WithOwner(opts ...func(*MachineQuery)) *AlertQuery { - query := (&MachineClient{config: aq.config}).Query() +func (_q *AlertQuery) WithOwner(opts ...func(*MachineQuery)) *AlertQuery { + query := (&MachineClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - aq.withOwner = query - return aq + _q.withOwner = query + return _q } // WithDecisions tells the query-builder to eager-load the nodes that are connected to // the "decisions" edge. The optional arguments are used to configure the query builder of the edge. -func (aq *AlertQuery) WithDecisions(opts ...func(*DecisionQuery)) *AlertQuery { - query := (&DecisionClient{config: aq.config}).Query() +func (_q *AlertQuery) WithDecisions(opts ...func(*DecisionQuery)) *AlertQuery { + query := (&DecisionClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - aq.withDecisions = query - return aq + _q.withDecisions = query + return _q } // WithEvents tells the query-builder to eager-load the nodes that are connected to // the "events" edge. The optional arguments are used to configure the query builder of the edge. -func (aq *AlertQuery) WithEvents(opts ...func(*EventQuery)) *AlertQuery { - query := (&EventClient{config: aq.config}).Query() +func (_q *AlertQuery) WithEvents(opts ...func(*EventQuery)) *AlertQuery { + query := (&EventClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - aq.withEvents = query - return aq + _q.withEvents = query + return _q } // WithMetas tells the query-builder to eager-load the nodes that are connected to // the "metas" edge. The optional arguments are used to configure the query builder of the edge. -func (aq *AlertQuery) WithMetas(opts ...func(*MetaQuery)) *AlertQuery { - query := (&MetaClient{config: aq.config}).Query() +func (_q *AlertQuery) WithMetas(opts ...func(*MetaQuery)) *AlertQuery { + query := (&MetaClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - aq.withMetas = query - return aq + _q.withMetas = query + return _q } // GroupBy is used to group vertices by one or more fields/columns. @@ -416,10 +416,10 @@ func (aq *AlertQuery) WithMetas(opts ...func(*MetaQuery)) *AlertQuery { // GroupBy(alert.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (aq *AlertQuery) GroupBy(field string, fields ...string) *AlertGroupBy { - aq.ctx.Fields = append([]string{field}, fields...) - grbuild := &AlertGroupBy{build: aq} - grbuild.flds = &aq.ctx.Fields +func (_q *AlertQuery) GroupBy(field string, fields ...string) *AlertGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &AlertGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = alert.Label grbuild.scan = grbuild.Scan return grbuild @@ -437,58 +437,58 @@ func (aq *AlertQuery) GroupBy(field string, fields ...string) *AlertGroupBy { // client.Alert.Query(). // Select(alert.FieldCreatedAt). // Scan(ctx, &v) -func (aq *AlertQuery) Select(fields ...string) *AlertSelect { - aq.ctx.Fields = append(aq.ctx.Fields, fields...) - sbuild := &AlertSelect{AlertQuery: aq} +func (_q *AlertQuery) Select(fields ...string) *AlertSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &AlertSelect{AlertQuery: _q} sbuild.label = alert.Label - sbuild.flds, sbuild.scan = &aq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a AlertSelect configured with the given aggregations. -func (aq *AlertQuery) Aggregate(fns ...AggregateFunc) *AlertSelect { - return aq.Select().Aggregate(fns...) +func (_q *AlertQuery) Aggregate(fns ...AggregateFunc) *AlertSelect { + return _q.Select().Aggregate(fns...) } -func (aq *AlertQuery) prepareQuery(ctx context.Context) error { - for _, inter := range aq.inters { +func (_q *AlertQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, aq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range aq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !alert.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if aq.path != nil { - prev, err := aq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - aq.sql = prev + _q.sql = prev } return nil } -func (aq *AlertQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Alert, error) { +func (_q *AlertQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Alert, error) { var ( nodes = []*Alert{} - withFKs = aq.withFKs - _spec = aq.querySpec() + withFKs = _q.withFKs + _spec = _q.querySpec() loadedTypes = [4]bool{ - aq.withOwner != nil, - aq.withDecisions != nil, - aq.withEvents != nil, - aq.withMetas != nil, + _q.withOwner != nil, + _q.withDecisions != nil, + _q.withEvents != nil, + _q.withMetas != nil, } ) - if aq.withOwner != nil { + if _q.withOwner != nil { withFKs = true } if withFKs { @@ -498,7 +498,7 @@ func (aq *AlertQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Alert, return (*Alert).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Alert{config: aq.config} + node := &Alert{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) @@ -506,34 +506,34 @@ func (aq *AlertQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Alert, for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, aq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := aq.withOwner; query != nil { - if err := aq.loadOwner(ctx, query, nodes, nil, + if query := _q.withOwner; query != nil { + if err := _q.loadOwner(ctx, query, nodes, nil, func(n *Alert, e *Machine) { n.Edges.Owner = e }); err != nil { return nil, err } } - if query := aq.withDecisions; query != nil { - if err := aq.loadDecisions(ctx, query, nodes, + if query := _q.withDecisions; query != nil { + if err := _q.loadDecisions(ctx, query, nodes, func(n *Alert) { n.Edges.Decisions = []*Decision{} }, func(n *Alert, e *Decision) { n.Edges.Decisions = append(n.Edges.Decisions, e) }); err != nil { return nil, err } } - if query := aq.withEvents; query != nil { - if err := aq.loadEvents(ctx, query, nodes, + if query := _q.withEvents; query != nil { + if err := _q.loadEvents(ctx, query, nodes, func(n *Alert) { n.Edges.Events = []*Event{} }, func(n *Alert, e *Event) { n.Edges.Events = append(n.Edges.Events, e) }); err != nil { return nil, err } } - if query := aq.withMetas; query != nil { - if err := aq.loadMetas(ctx, query, nodes, + if query := _q.withMetas; query != nil { + if err := _q.loadMetas(ctx, query, nodes, func(n *Alert) { n.Edges.Metas = []*Meta{} }, func(n *Alert, e *Meta) { n.Edges.Metas = append(n.Edges.Metas, e) }); err != nil { return nil, err @@ -542,7 +542,7 @@ func (aq *AlertQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Alert, return nodes, nil } -func (aq *AlertQuery) loadOwner(ctx context.Context, query *MachineQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Machine)) error { +func (_q *AlertQuery) loadOwner(ctx context.Context, query *MachineQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Machine)) error { ids := make([]int, 0, len(nodes)) nodeids := make(map[int][]*Alert) for i := range nodes { @@ -574,7 +574,7 @@ func (aq *AlertQuery) loadOwner(ctx context.Context, query *MachineQuery, nodes } return nil } -func (aq *AlertQuery) loadDecisions(ctx context.Context, query *DecisionQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Decision)) error { +func (_q *AlertQuery) loadDecisions(ctx context.Context, query *DecisionQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Decision)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[int]*Alert) for i := range nodes { @@ -604,7 +604,7 @@ func (aq *AlertQuery) loadDecisions(ctx context.Context, query *DecisionQuery, n } return nil } -func (aq *AlertQuery) loadEvents(ctx context.Context, query *EventQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Event)) error { +func (_q *AlertQuery) loadEvents(ctx context.Context, query *EventQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Event)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[int]*Alert) for i := range nodes { @@ -634,7 +634,7 @@ func (aq *AlertQuery) loadEvents(ctx context.Context, query *EventQuery, nodes [ } return nil } -func (aq *AlertQuery) loadMetas(ctx context.Context, query *MetaQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Meta)) error { +func (_q *AlertQuery) loadMetas(ctx context.Context, query *MetaQuery, nodes []*Alert, init func(*Alert), assign func(*Alert, *Meta)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[int]*Alert) for i := range nodes { @@ -665,24 +665,24 @@ func (aq *AlertQuery) loadMetas(ctx context.Context, query *MetaQuery, nodes []* return nil } -func (aq *AlertQuery) sqlCount(ctx context.Context) (int, error) { - _spec := aq.querySpec() - _spec.Node.Columns = aq.ctx.Fields - if len(aq.ctx.Fields) > 0 { - _spec.Unique = aq.ctx.Unique != nil && *aq.ctx.Unique +func (_q *AlertQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, aq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (aq *AlertQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *AlertQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(alert.Table, alert.Columns, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt)) - _spec.From = aq.sql - if unique := aq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if aq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := aq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, alert.FieldID) for i := range fields { @@ -691,20 +691,20 @@ func (aq *AlertQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := aq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := aq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := aq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := aq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -714,33 +714,33 @@ func (aq *AlertQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (aq *AlertQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(aq.driver.Dialect()) +func (_q *AlertQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(alert.Table) - columns := aq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = alert.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if aq.sql != nil { - selector = aq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if aq.ctx.Unique != nil && *aq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range aq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range aq.order { + for _, p := range _q.order { p(selector) } - if offset := aq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := aq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -753,41 +753,41 @@ type AlertGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (agb *AlertGroupBy) Aggregate(fns ...AggregateFunc) *AlertGroupBy { - agb.fns = append(agb.fns, fns...) - return agb +func (_g *AlertGroupBy) Aggregate(fns ...AggregateFunc) *AlertGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (agb *AlertGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, agb.build.ctx, ent.OpQueryGroupBy) - if err := agb.build.prepareQuery(ctx); err != nil { +func (_g *AlertGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AlertQuery, *AlertGroupBy](ctx, agb.build, agb, agb.build.inters, v) + return scanWithInterceptors[*AlertQuery, *AlertGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (agb *AlertGroupBy) sqlScan(ctx context.Context, root *AlertQuery, v any) error { +func (_g *AlertGroupBy) sqlScan(ctx context.Context, root *AlertQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(agb.fns)) - for _, fn := range agb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*agb.flds)+len(agb.fns)) - for _, f := range *agb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*agb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := agb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -801,27 +801,27 @@ type AlertSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (as *AlertSelect) Aggregate(fns ...AggregateFunc) *AlertSelect { - as.fns = append(as.fns, fns...) - return as +func (_s *AlertSelect) Aggregate(fns ...AggregateFunc) *AlertSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (as *AlertSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, as.ctx, ent.OpQuerySelect) - if err := as.prepareQuery(ctx); err != nil { +func (_s *AlertSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AlertQuery, *AlertSelect](ctx, as.AlertQuery, as, as.inters, v) + return scanWithInterceptors[*AlertQuery, *AlertSelect](ctx, _s.AlertQuery, _s, _s.inters, v) } -func (as *AlertSelect) sqlScan(ctx context.Context, root *AlertQuery, v any) error { +func (_s *AlertSelect) sqlScan(ctx context.Context, root *AlertQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(as.fns)) - for _, fn := range as.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*as.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -829,7 +829,7 @@ func (as *AlertSelect) sqlScan(ctx context.Context, root *AlertQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := as.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/alert_update.go b/pkg/database/ent/alert_update.go index 76961b9a9..0aa1d7ee4 100644 --- a/pkg/database/ent/alert_update.go +++ b/pkg/database/ent/alert_update.go @@ -27,164 +27,164 @@ type AlertUpdate struct { } // Where appends a list predicates to the AlertUpdate builder. -func (au *AlertUpdate) Where(ps ...predicate.Alert) *AlertUpdate { - au.mutation.Where(ps...) - return au +func (_u *AlertUpdate) Where(ps ...predicate.Alert) *AlertUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (au *AlertUpdate) SetUpdatedAt(t time.Time) *AlertUpdate { - au.mutation.SetUpdatedAt(t) - return au +func (_u *AlertUpdate) SetUpdatedAt(v time.Time) *AlertUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetOwnerID sets the "owner" edge to the Machine entity by ID. -func (au *AlertUpdate) SetOwnerID(id int) *AlertUpdate { - au.mutation.SetOwnerID(id) - return au +func (_u *AlertUpdate) SetOwnerID(id int) *AlertUpdate { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Machine entity by ID if the given value is not nil. -func (au *AlertUpdate) SetNillableOwnerID(id *int) *AlertUpdate { +func (_u *AlertUpdate) SetNillableOwnerID(id *int) *AlertUpdate { if id != nil { - au = au.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return au + return _u } // SetOwner sets the "owner" edge to the Machine entity. -func (au *AlertUpdate) SetOwner(m *Machine) *AlertUpdate { - return au.SetOwnerID(m.ID) +func (_u *AlertUpdate) SetOwner(v *Machine) *AlertUpdate { + return _u.SetOwnerID(v.ID) } // AddDecisionIDs adds the "decisions" edge to the Decision entity by IDs. -func (au *AlertUpdate) AddDecisionIDs(ids ...int) *AlertUpdate { - au.mutation.AddDecisionIDs(ids...) - return au +func (_u *AlertUpdate) AddDecisionIDs(ids ...int) *AlertUpdate { + _u.mutation.AddDecisionIDs(ids...) + return _u } // AddDecisions adds the "decisions" edges to the Decision entity. -func (au *AlertUpdate) AddDecisions(d ...*Decision) *AlertUpdate { - ids := make([]int, len(d)) - for i := range d { - ids[i] = d[i].ID +func (_u *AlertUpdate) AddDecisions(v ...*Decision) *AlertUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return au.AddDecisionIDs(ids...) + return _u.AddDecisionIDs(ids...) } // AddEventIDs adds the "events" edge to the Event entity by IDs. -func (au *AlertUpdate) AddEventIDs(ids ...int) *AlertUpdate { - au.mutation.AddEventIDs(ids...) - return au +func (_u *AlertUpdate) AddEventIDs(ids ...int) *AlertUpdate { + _u.mutation.AddEventIDs(ids...) + return _u } // AddEvents adds the "events" edges to the Event entity. -func (au *AlertUpdate) AddEvents(e ...*Event) *AlertUpdate { - ids := make([]int, len(e)) - for i := range e { - ids[i] = e[i].ID +func (_u *AlertUpdate) AddEvents(v ...*Event) *AlertUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return au.AddEventIDs(ids...) + return _u.AddEventIDs(ids...) } // AddMetaIDs adds the "metas" edge to the Meta entity by IDs. -func (au *AlertUpdate) AddMetaIDs(ids ...int) *AlertUpdate { - au.mutation.AddMetaIDs(ids...) - return au +func (_u *AlertUpdate) AddMetaIDs(ids ...int) *AlertUpdate { + _u.mutation.AddMetaIDs(ids...) + return _u } // AddMetas adds the "metas" edges to the Meta entity. -func (au *AlertUpdate) AddMetas(m ...*Meta) *AlertUpdate { - ids := make([]int, len(m)) - for i := range m { - ids[i] = m[i].ID +func (_u *AlertUpdate) AddMetas(v ...*Meta) *AlertUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return au.AddMetaIDs(ids...) + return _u.AddMetaIDs(ids...) } // Mutation returns the AlertMutation object of the builder. -func (au *AlertUpdate) Mutation() *AlertMutation { - return au.mutation +func (_u *AlertUpdate) Mutation() *AlertMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Machine entity. -func (au *AlertUpdate) ClearOwner() *AlertUpdate { - au.mutation.ClearOwner() - return au +func (_u *AlertUpdate) ClearOwner() *AlertUpdate { + _u.mutation.ClearOwner() + return _u } // ClearDecisions clears all "decisions" edges to the Decision entity. -func (au *AlertUpdate) ClearDecisions() *AlertUpdate { - au.mutation.ClearDecisions() - return au +func (_u *AlertUpdate) ClearDecisions() *AlertUpdate { + _u.mutation.ClearDecisions() + return _u } // RemoveDecisionIDs removes the "decisions" edge to Decision entities by IDs. -func (au *AlertUpdate) RemoveDecisionIDs(ids ...int) *AlertUpdate { - au.mutation.RemoveDecisionIDs(ids...) - return au +func (_u *AlertUpdate) RemoveDecisionIDs(ids ...int) *AlertUpdate { + _u.mutation.RemoveDecisionIDs(ids...) + return _u } // RemoveDecisions removes "decisions" edges to Decision entities. -func (au *AlertUpdate) RemoveDecisions(d ...*Decision) *AlertUpdate { - ids := make([]int, len(d)) - for i := range d { - ids[i] = d[i].ID +func (_u *AlertUpdate) RemoveDecisions(v ...*Decision) *AlertUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return au.RemoveDecisionIDs(ids...) + return _u.RemoveDecisionIDs(ids...) } // ClearEvents clears all "events" edges to the Event entity. -func (au *AlertUpdate) ClearEvents() *AlertUpdate { - au.mutation.ClearEvents() - return au +func (_u *AlertUpdate) ClearEvents() *AlertUpdate { + _u.mutation.ClearEvents() + return _u } // RemoveEventIDs removes the "events" edge to Event entities by IDs. -func (au *AlertUpdate) RemoveEventIDs(ids ...int) *AlertUpdate { - au.mutation.RemoveEventIDs(ids...) - return au +func (_u *AlertUpdate) RemoveEventIDs(ids ...int) *AlertUpdate { + _u.mutation.RemoveEventIDs(ids...) + return _u } // RemoveEvents removes "events" edges to Event entities. -func (au *AlertUpdate) RemoveEvents(e ...*Event) *AlertUpdate { - ids := make([]int, len(e)) - for i := range e { - ids[i] = e[i].ID +func (_u *AlertUpdate) RemoveEvents(v ...*Event) *AlertUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return au.RemoveEventIDs(ids...) + return _u.RemoveEventIDs(ids...) } // ClearMetas clears all "metas" edges to the Meta entity. -func (au *AlertUpdate) ClearMetas() *AlertUpdate { - au.mutation.ClearMetas() - return au +func (_u *AlertUpdate) ClearMetas() *AlertUpdate { + _u.mutation.ClearMetas() + return _u } // RemoveMetaIDs removes the "metas" edge to Meta entities by IDs. -func (au *AlertUpdate) RemoveMetaIDs(ids ...int) *AlertUpdate { - au.mutation.RemoveMetaIDs(ids...) - return au +func (_u *AlertUpdate) RemoveMetaIDs(ids ...int) *AlertUpdate { + _u.mutation.RemoveMetaIDs(ids...) + return _u } // RemoveMetas removes "metas" edges to Meta entities. -func (au *AlertUpdate) RemoveMetas(m ...*Meta) *AlertUpdate { - ids := make([]int, len(m)) - for i := range m { - ids[i] = m[i].ID +func (_u *AlertUpdate) RemoveMetas(v ...*Meta) *AlertUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return au.RemoveMetaIDs(ids...) + return _u.RemoveMetaIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. -func (au *AlertUpdate) Save(ctx context.Context) (int, error) { - au.defaults() - return withHooks(ctx, au.sqlSave, au.mutation, au.hooks) +func (_u *AlertUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (au *AlertUpdate) SaveX(ctx context.Context) int { - affected, err := au.Save(ctx) +func (_u *AlertUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -192,102 +192,102 @@ func (au *AlertUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (au *AlertUpdate) Exec(ctx context.Context) error { - _, err := au.Save(ctx) +func (_u *AlertUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (au *AlertUpdate) ExecX(ctx context.Context) { - if err := au.Exec(ctx); err != nil { +func (_u *AlertUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (au *AlertUpdate) defaults() { - if _, ok := au.mutation.UpdatedAt(); !ok { +func (_u *AlertUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := alert.UpdateDefaultUpdatedAt() - au.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *AlertUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(alert.Table, alert.Columns, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt)) - if ps := au.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 := au.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value) } - if au.mutation.BucketIdCleared() { + if _u.mutation.BucketIdCleared() { _spec.ClearField(alert.FieldBucketId, field.TypeString) } - if au.mutation.MessageCleared() { + if _u.mutation.MessageCleared() { _spec.ClearField(alert.FieldMessage, field.TypeString) } - if au.mutation.EventsCountCleared() { + if _u.mutation.EventsCountCleared() { _spec.ClearField(alert.FieldEventsCount, field.TypeInt32) } - if au.mutation.StartedAtCleared() { + if _u.mutation.StartedAtCleared() { _spec.ClearField(alert.FieldStartedAt, field.TypeTime) } - if au.mutation.StoppedAtCleared() { + if _u.mutation.StoppedAtCleared() { _spec.ClearField(alert.FieldStoppedAt, field.TypeTime) } - if au.mutation.SourceIpCleared() { + if _u.mutation.SourceIpCleared() { _spec.ClearField(alert.FieldSourceIp, field.TypeString) } - if au.mutation.SourceRangeCleared() { + if _u.mutation.SourceRangeCleared() { _spec.ClearField(alert.FieldSourceRange, field.TypeString) } - if au.mutation.SourceAsNumberCleared() { + if _u.mutation.SourceAsNumberCleared() { _spec.ClearField(alert.FieldSourceAsNumber, field.TypeString) } - if au.mutation.SourceAsNameCleared() { + if _u.mutation.SourceAsNameCleared() { _spec.ClearField(alert.FieldSourceAsName, field.TypeString) } - if au.mutation.SourceCountryCleared() { + if _u.mutation.SourceCountryCleared() { _spec.ClearField(alert.FieldSourceCountry, field.TypeString) } - if au.mutation.SourceLatitudeCleared() { + if _u.mutation.SourceLatitudeCleared() { _spec.ClearField(alert.FieldSourceLatitude, field.TypeFloat32) } - if au.mutation.SourceLongitudeCleared() { + if _u.mutation.SourceLongitudeCleared() { _spec.ClearField(alert.FieldSourceLongitude, field.TypeFloat32) } - if au.mutation.SourceScopeCleared() { + if _u.mutation.SourceScopeCleared() { _spec.ClearField(alert.FieldSourceScope, field.TypeString) } - if au.mutation.SourceValueCleared() { + if _u.mutation.SourceValueCleared() { _spec.ClearField(alert.FieldSourceValue, field.TypeString) } - if au.mutation.CapacityCleared() { + if _u.mutation.CapacityCleared() { _spec.ClearField(alert.FieldCapacity, field.TypeInt32) } - if au.mutation.LeakSpeedCleared() { + if _u.mutation.LeakSpeedCleared() { _spec.ClearField(alert.FieldLeakSpeed, field.TypeString) } - if au.mutation.ScenarioVersionCleared() { + if _u.mutation.ScenarioVersionCleared() { _spec.ClearField(alert.FieldScenarioVersion, field.TypeString) } - if au.mutation.ScenarioHashCleared() { + if _u.mutation.ScenarioHashCleared() { _spec.ClearField(alert.FieldScenarioHash, field.TypeString) } - if au.mutation.UUIDCleared() { + if _u.mutation.UUIDCleared() { _spec.ClearField(alert.FieldUUID, field.TypeString) } - if au.mutation.RemediationCleared() { + if _u.mutation.RemediationCleared() { _spec.ClearField(alert.FieldRemediation, field.TypeBool) } - if au.mutation.KindCleared() { + if _u.mutation.KindCleared() { _spec.ClearField(alert.FieldKind, field.TypeString) } - if au.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -300,7 +300,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -316,7 +316,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if au.mutation.DecisionsCleared() { + if _u.mutation.DecisionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -329,7 +329,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.RemovedDecisionsIDs(); len(nodes) > 0 && !au.mutation.DecisionsCleared() { + if nodes := _u.mutation.RemovedDecisionsIDs(); len(nodes) > 0 && !_u.mutation.DecisionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -345,7 +345,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.DecisionsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.DecisionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -361,7 +361,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if au.mutation.EventsCleared() { + if _u.mutation.EventsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -374,7 +374,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.RemovedEventsIDs(); len(nodes) > 0 && !au.mutation.EventsCleared() { + if nodes := _u.mutation.RemovedEventsIDs(); len(nodes) > 0 && !_u.mutation.EventsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -390,7 +390,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.EventsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.EventsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -406,7 +406,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if au.mutation.MetasCleared() { + if _u.mutation.MetasCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -419,7 +419,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.RemovedMetasIDs(); len(nodes) > 0 && !au.mutation.MetasCleared() { + if nodes := _u.mutation.RemovedMetasIDs(); len(nodes) > 0 && !_u.mutation.MetasCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -435,7 +435,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.MetasIDs(); len(nodes) > 0 { + if nodes := _u.mutation.MetasIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -451,7 +451,7 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if n, err = sqlgraph.UpdateNodes(ctx, au.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{alert.Label} } else if sqlgraph.IsConstraintError(err) { @@ -459,8 +459,8 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - au.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // AlertUpdateOne is the builder for updating a single Alert entity. @@ -472,171 +472,171 @@ type AlertUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (auo *AlertUpdateOne) SetUpdatedAt(t time.Time) *AlertUpdateOne { - auo.mutation.SetUpdatedAt(t) - return auo +func (_u *AlertUpdateOne) SetUpdatedAt(v time.Time) *AlertUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetOwnerID sets the "owner" edge to the Machine entity by ID. -func (auo *AlertUpdateOne) SetOwnerID(id int) *AlertUpdateOne { - auo.mutation.SetOwnerID(id) - return auo +func (_u *AlertUpdateOne) SetOwnerID(id int) *AlertUpdateOne { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Machine entity by ID if the given value is not nil. -func (auo *AlertUpdateOne) SetNillableOwnerID(id *int) *AlertUpdateOne { +func (_u *AlertUpdateOne) SetNillableOwnerID(id *int) *AlertUpdateOne { if id != nil { - auo = auo.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return auo + return _u } // SetOwner sets the "owner" edge to the Machine entity. -func (auo *AlertUpdateOne) SetOwner(m *Machine) *AlertUpdateOne { - return auo.SetOwnerID(m.ID) +func (_u *AlertUpdateOne) SetOwner(v *Machine) *AlertUpdateOne { + return _u.SetOwnerID(v.ID) } // AddDecisionIDs adds the "decisions" edge to the Decision entity by IDs. -func (auo *AlertUpdateOne) AddDecisionIDs(ids ...int) *AlertUpdateOne { - auo.mutation.AddDecisionIDs(ids...) - return auo +func (_u *AlertUpdateOne) AddDecisionIDs(ids ...int) *AlertUpdateOne { + _u.mutation.AddDecisionIDs(ids...) + return _u } // AddDecisions adds the "decisions" edges to the Decision entity. -func (auo *AlertUpdateOne) AddDecisions(d ...*Decision) *AlertUpdateOne { - ids := make([]int, len(d)) - for i := range d { - ids[i] = d[i].ID +func (_u *AlertUpdateOne) AddDecisions(v ...*Decision) *AlertUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return auo.AddDecisionIDs(ids...) + return _u.AddDecisionIDs(ids...) } // AddEventIDs adds the "events" edge to the Event entity by IDs. -func (auo *AlertUpdateOne) AddEventIDs(ids ...int) *AlertUpdateOne { - auo.mutation.AddEventIDs(ids...) - return auo +func (_u *AlertUpdateOne) AddEventIDs(ids ...int) *AlertUpdateOne { + _u.mutation.AddEventIDs(ids...) + return _u } // AddEvents adds the "events" edges to the Event entity. -func (auo *AlertUpdateOne) AddEvents(e ...*Event) *AlertUpdateOne { - ids := make([]int, len(e)) - for i := range e { - ids[i] = e[i].ID +func (_u *AlertUpdateOne) AddEvents(v ...*Event) *AlertUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return auo.AddEventIDs(ids...) + return _u.AddEventIDs(ids...) } // AddMetaIDs adds the "metas" edge to the Meta entity by IDs. -func (auo *AlertUpdateOne) AddMetaIDs(ids ...int) *AlertUpdateOne { - auo.mutation.AddMetaIDs(ids...) - return auo +func (_u *AlertUpdateOne) AddMetaIDs(ids ...int) *AlertUpdateOne { + _u.mutation.AddMetaIDs(ids...) + return _u } // AddMetas adds the "metas" edges to the Meta entity. -func (auo *AlertUpdateOne) AddMetas(m ...*Meta) *AlertUpdateOne { - ids := make([]int, len(m)) - for i := range m { - ids[i] = m[i].ID +func (_u *AlertUpdateOne) AddMetas(v ...*Meta) *AlertUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return auo.AddMetaIDs(ids...) + return _u.AddMetaIDs(ids...) } // Mutation returns the AlertMutation object of the builder. -func (auo *AlertUpdateOne) Mutation() *AlertMutation { - return auo.mutation +func (_u *AlertUpdateOne) Mutation() *AlertMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Machine entity. -func (auo *AlertUpdateOne) ClearOwner() *AlertUpdateOne { - auo.mutation.ClearOwner() - return auo +func (_u *AlertUpdateOne) ClearOwner() *AlertUpdateOne { + _u.mutation.ClearOwner() + return _u } // ClearDecisions clears all "decisions" edges to the Decision entity. -func (auo *AlertUpdateOne) ClearDecisions() *AlertUpdateOne { - auo.mutation.ClearDecisions() - return auo +func (_u *AlertUpdateOne) ClearDecisions() *AlertUpdateOne { + _u.mutation.ClearDecisions() + return _u } // RemoveDecisionIDs removes the "decisions" edge to Decision entities by IDs. -func (auo *AlertUpdateOne) RemoveDecisionIDs(ids ...int) *AlertUpdateOne { - auo.mutation.RemoveDecisionIDs(ids...) - return auo +func (_u *AlertUpdateOne) RemoveDecisionIDs(ids ...int) *AlertUpdateOne { + _u.mutation.RemoveDecisionIDs(ids...) + return _u } // RemoveDecisions removes "decisions" edges to Decision entities. -func (auo *AlertUpdateOne) RemoveDecisions(d ...*Decision) *AlertUpdateOne { - ids := make([]int, len(d)) - for i := range d { - ids[i] = d[i].ID +func (_u *AlertUpdateOne) RemoveDecisions(v ...*Decision) *AlertUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return auo.RemoveDecisionIDs(ids...) + return _u.RemoveDecisionIDs(ids...) } // ClearEvents clears all "events" edges to the Event entity. -func (auo *AlertUpdateOne) ClearEvents() *AlertUpdateOne { - auo.mutation.ClearEvents() - return auo +func (_u *AlertUpdateOne) ClearEvents() *AlertUpdateOne { + _u.mutation.ClearEvents() + return _u } // RemoveEventIDs removes the "events" edge to Event entities by IDs. -func (auo *AlertUpdateOne) RemoveEventIDs(ids ...int) *AlertUpdateOne { - auo.mutation.RemoveEventIDs(ids...) - return auo +func (_u *AlertUpdateOne) RemoveEventIDs(ids ...int) *AlertUpdateOne { + _u.mutation.RemoveEventIDs(ids...) + return _u } // RemoveEvents removes "events" edges to Event entities. -func (auo *AlertUpdateOne) RemoveEvents(e ...*Event) *AlertUpdateOne { - ids := make([]int, len(e)) - for i := range e { - ids[i] = e[i].ID +func (_u *AlertUpdateOne) RemoveEvents(v ...*Event) *AlertUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return auo.RemoveEventIDs(ids...) + return _u.RemoveEventIDs(ids...) } // ClearMetas clears all "metas" edges to the Meta entity. -func (auo *AlertUpdateOne) ClearMetas() *AlertUpdateOne { - auo.mutation.ClearMetas() - return auo +func (_u *AlertUpdateOne) ClearMetas() *AlertUpdateOne { + _u.mutation.ClearMetas() + return _u } // RemoveMetaIDs removes the "metas" edge to Meta entities by IDs. -func (auo *AlertUpdateOne) RemoveMetaIDs(ids ...int) *AlertUpdateOne { - auo.mutation.RemoveMetaIDs(ids...) - return auo +func (_u *AlertUpdateOne) RemoveMetaIDs(ids ...int) *AlertUpdateOne { + _u.mutation.RemoveMetaIDs(ids...) + return _u } // RemoveMetas removes "metas" edges to Meta entities. -func (auo *AlertUpdateOne) RemoveMetas(m ...*Meta) *AlertUpdateOne { - ids := make([]int, len(m)) - for i := range m { - ids[i] = m[i].ID +func (_u *AlertUpdateOne) RemoveMetas(v ...*Meta) *AlertUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return auo.RemoveMetaIDs(ids...) + return _u.RemoveMetaIDs(ids...) } // Where appends a list predicates to the AlertUpdate builder. -func (auo *AlertUpdateOne) Where(ps ...predicate.Alert) *AlertUpdateOne { - auo.mutation.Where(ps...) - return auo +func (_u *AlertUpdateOne) Where(ps ...predicate.Alert) *AlertUpdateOne { + _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 (auo *AlertUpdateOne) Select(field string, fields ...string) *AlertUpdateOne { - auo.fields = append([]string{field}, fields...) - return auo +func (_u *AlertUpdateOne) Select(field string, fields ...string) *AlertUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Alert entity. -func (auo *AlertUpdateOne) Save(ctx context.Context) (*Alert, error) { - auo.defaults() - return withHooks(ctx, auo.sqlSave, auo.mutation, auo.hooks) +func (_u *AlertUpdateOne) Save(ctx context.Context) (*Alert, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (auo *AlertUpdateOne) SaveX(ctx context.Context) *Alert { - node, err := auo.Save(ctx) +func (_u *AlertUpdateOne) SaveX(ctx context.Context) *Alert { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -644,34 +644,34 @@ func (auo *AlertUpdateOne) SaveX(ctx context.Context) *Alert { } // Exec executes the query on the entity. -func (auo *AlertUpdateOne) Exec(ctx context.Context) error { - _, err := auo.Save(ctx) +func (_u *AlertUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (auo *AlertUpdateOne) ExecX(ctx context.Context) { - if err := auo.Exec(ctx); err != nil { +func (_u *AlertUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (auo *AlertUpdateOne) defaults() { - if _, ok := auo.mutation.UpdatedAt(); !ok { +func (_u *AlertUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := alert.UpdateDefaultUpdatedAt() - auo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error) { +func (_u *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error) { _spec := sqlgraph.NewUpdateSpec(alert.Table, alert.Columns, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt)) - id, ok := auo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Alert.id" for update`)} } _spec.Node.ID.Value = id - if fields := auo.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, alert.FieldID) for _, f := range fields { @@ -683,80 +683,80 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } } } - if ps := auo.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 := auo.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value) } - if auo.mutation.BucketIdCleared() { + if _u.mutation.BucketIdCleared() { _spec.ClearField(alert.FieldBucketId, field.TypeString) } - if auo.mutation.MessageCleared() { + if _u.mutation.MessageCleared() { _spec.ClearField(alert.FieldMessage, field.TypeString) } - if auo.mutation.EventsCountCleared() { + if _u.mutation.EventsCountCleared() { _spec.ClearField(alert.FieldEventsCount, field.TypeInt32) } - if auo.mutation.StartedAtCleared() { + if _u.mutation.StartedAtCleared() { _spec.ClearField(alert.FieldStartedAt, field.TypeTime) } - if auo.mutation.StoppedAtCleared() { + if _u.mutation.StoppedAtCleared() { _spec.ClearField(alert.FieldStoppedAt, field.TypeTime) } - if auo.mutation.SourceIpCleared() { + if _u.mutation.SourceIpCleared() { _spec.ClearField(alert.FieldSourceIp, field.TypeString) } - if auo.mutation.SourceRangeCleared() { + if _u.mutation.SourceRangeCleared() { _spec.ClearField(alert.FieldSourceRange, field.TypeString) } - if auo.mutation.SourceAsNumberCleared() { + if _u.mutation.SourceAsNumberCleared() { _spec.ClearField(alert.FieldSourceAsNumber, field.TypeString) } - if auo.mutation.SourceAsNameCleared() { + if _u.mutation.SourceAsNameCleared() { _spec.ClearField(alert.FieldSourceAsName, field.TypeString) } - if auo.mutation.SourceCountryCleared() { + if _u.mutation.SourceCountryCleared() { _spec.ClearField(alert.FieldSourceCountry, field.TypeString) } - if auo.mutation.SourceLatitudeCleared() { + if _u.mutation.SourceLatitudeCleared() { _spec.ClearField(alert.FieldSourceLatitude, field.TypeFloat32) } - if auo.mutation.SourceLongitudeCleared() { + if _u.mutation.SourceLongitudeCleared() { _spec.ClearField(alert.FieldSourceLongitude, field.TypeFloat32) } - if auo.mutation.SourceScopeCleared() { + if _u.mutation.SourceScopeCleared() { _spec.ClearField(alert.FieldSourceScope, field.TypeString) } - if auo.mutation.SourceValueCleared() { + if _u.mutation.SourceValueCleared() { _spec.ClearField(alert.FieldSourceValue, field.TypeString) } - if auo.mutation.CapacityCleared() { + if _u.mutation.CapacityCleared() { _spec.ClearField(alert.FieldCapacity, field.TypeInt32) } - if auo.mutation.LeakSpeedCleared() { + if _u.mutation.LeakSpeedCleared() { _spec.ClearField(alert.FieldLeakSpeed, field.TypeString) } - if auo.mutation.ScenarioVersionCleared() { + if _u.mutation.ScenarioVersionCleared() { _spec.ClearField(alert.FieldScenarioVersion, field.TypeString) } - if auo.mutation.ScenarioHashCleared() { + if _u.mutation.ScenarioHashCleared() { _spec.ClearField(alert.FieldScenarioHash, field.TypeString) } - if auo.mutation.UUIDCleared() { + if _u.mutation.UUIDCleared() { _spec.ClearField(alert.FieldUUID, field.TypeString) } - if auo.mutation.RemediationCleared() { + if _u.mutation.RemediationCleared() { _spec.ClearField(alert.FieldRemediation, field.TypeBool) } - if auo.mutation.KindCleared() { + if _u.mutation.KindCleared() { _spec.ClearField(alert.FieldKind, field.TypeString) } - if auo.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -769,7 +769,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -785,7 +785,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if auo.mutation.DecisionsCleared() { + if _u.mutation.DecisionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -798,7 +798,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.RemovedDecisionsIDs(); len(nodes) > 0 && !auo.mutation.DecisionsCleared() { + if nodes := _u.mutation.RemovedDecisionsIDs(); len(nodes) > 0 && !_u.mutation.DecisionsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -814,7 +814,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.DecisionsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.DecisionsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -830,7 +830,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if auo.mutation.EventsCleared() { + if _u.mutation.EventsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -843,7 +843,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.RemovedEventsIDs(); len(nodes) > 0 && !auo.mutation.EventsCleared() { + if nodes := _u.mutation.RemovedEventsIDs(); len(nodes) > 0 && !_u.mutation.EventsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -859,7 +859,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.EventsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.EventsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -875,7 +875,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if auo.mutation.MetasCleared() { + if _u.mutation.MetasCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -888,7 +888,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.RemovedMetasIDs(); len(nodes) > 0 && !auo.mutation.MetasCleared() { + if nodes := _u.mutation.RemovedMetasIDs(); len(nodes) > 0 && !_u.mutation.MetasCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -904,7 +904,7 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.MetasIDs(); len(nodes) > 0 { + if nodes := _u.mutation.MetasIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -920,10 +920,10 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - _node = &Alert{config: auo.config} + _node = &Alert{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, auo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{alert.Label} } else if sqlgraph.IsConstraintError(err) { @@ -931,6 +931,6 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error } return nil, err } - auo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/allowlist.go b/pkg/database/ent/allowlist.go index 99b36687a..b0ec71f24 100644 --- a/pkg/database/ent/allowlist.go +++ b/pkg/database/ent/allowlist.go @@ -75,7 +75,7 @@ func (*AllowList) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the AllowList fields. -func (al *AllowList) assignValues(columns []string, values []any) error { +func (_m *AllowList) 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) } @@ -86,45 +86,45 @@ func (al *AllowList) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - al.ID = int(value.Int64) + _m.ID = int(value.Int64) case allowlist.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - al.CreatedAt = value.Time + _m.CreatedAt = value.Time } case allowlist.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - al.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case allowlist.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { - al.Name = value.String + _m.Name = value.String } case allowlist.FieldFromConsole: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field from_console", values[i]) } else if value.Valid { - al.FromConsole = value.Bool + _m.FromConsole = value.Bool } case allowlist.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { - al.Description = value.String + _m.Description = value.String } case allowlist.FieldAllowlistID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field allowlist_id", values[i]) } else if value.Valid { - al.AllowlistID = value.String + _m.AllowlistID = value.String } default: - al.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -132,55 +132,55 @@ func (al *AllowList) assignValues(columns []string, values []any) error { // Value returns the ent.Value that was dynamically selected and assigned to the AllowList. // This includes values selected through modifiers, order, etc. -func (al *AllowList) Value(name string) (ent.Value, error) { - return al.selectValues.Get(name) +func (_m *AllowList) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // QueryAllowlistItems queries the "allowlist_items" edge of the AllowList entity. -func (al *AllowList) QueryAllowlistItems() *AllowListItemQuery { - return NewAllowListClient(al.config).QueryAllowlistItems(al) +func (_m *AllowList) QueryAllowlistItems() *AllowListItemQuery { + return NewAllowListClient(_m.config).QueryAllowlistItems(_m) } // Update returns a builder for updating this AllowList. // Note that you need to call AllowList.Unwrap() before calling this method if this AllowList // was returned from a transaction, and the transaction was committed or rolled back. -func (al *AllowList) Update() *AllowListUpdateOne { - return NewAllowListClient(al.config).UpdateOne(al) +func (_m *AllowList) Update() *AllowListUpdateOne { + return NewAllowListClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the AllowList 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 (al *AllowList) Unwrap() *AllowList { - _tx, ok := al.config.driver.(*txDriver) +func (_m *AllowList) Unwrap() *AllowList { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: AllowList is not a transactional entity") } - al.config.driver = _tx.drv - return al + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (al *AllowList) String() string { +func (_m *AllowList) String() string { var builder strings.Builder builder.WriteString("AllowList(") - builder.WriteString(fmt.Sprintf("id=%v, ", al.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(al.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(al.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("name=") - builder.WriteString(al.Name) + builder.WriteString(_m.Name) builder.WriteString(", ") builder.WriteString("from_console=") - builder.WriteString(fmt.Sprintf("%v", al.FromConsole)) + builder.WriteString(fmt.Sprintf("%v", _m.FromConsole)) builder.WriteString(", ") builder.WriteString("description=") - builder.WriteString(al.Description) + builder.WriteString(_m.Description) builder.WriteString(", ") builder.WriteString("allowlist_id=") - builder.WriteString(al.AllowlistID) + builder.WriteString(_m.AllowlistID) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/allowlist_create.go b/pkg/database/ent/allowlist_create.go index 4ff2ea442..c49855533 100644 --- a/pkg/database/ent/allowlist_create.go +++ b/pkg/database/ent/allowlist_create.go @@ -24,102 +24,102 @@ type AllowListCreate struct { } // SetCreatedAt sets the "created_at" field. -func (alc *AllowListCreate) SetCreatedAt(t time.Time) *AllowListCreate { - alc.mutation.SetCreatedAt(t) - return alc +func (_c *AllowListCreate) SetCreatedAt(v time.Time) *AllowListCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (alc *AllowListCreate) SetNillableCreatedAt(t *time.Time) *AllowListCreate { - if t != nil { - alc.SetCreatedAt(*t) +func (_c *AllowListCreate) SetNillableCreatedAt(v *time.Time) *AllowListCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return alc + return _c } // SetUpdatedAt sets the "updated_at" field. -func (alc *AllowListCreate) SetUpdatedAt(t time.Time) *AllowListCreate { - alc.mutation.SetUpdatedAt(t) - return alc +func (_c *AllowListCreate) SetUpdatedAt(v time.Time) *AllowListCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (alc *AllowListCreate) SetNillableUpdatedAt(t *time.Time) *AllowListCreate { - if t != nil { - alc.SetUpdatedAt(*t) +func (_c *AllowListCreate) SetNillableUpdatedAt(v *time.Time) *AllowListCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return alc + return _c } // SetName sets the "name" field. -func (alc *AllowListCreate) SetName(s string) *AllowListCreate { - alc.mutation.SetName(s) - return alc +func (_c *AllowListCreate) SetName(v string) *AllowListCreate { + _c.mutation.SetName(v) + return _c } // SetFromConsole sets the "from_console" field. -func (alc *AllowListCreate) SetFromConsole(b bool) *AllowListCreate { - alc.mutation.SetFromConsole(b) - return alc +func (_c *AllowListCreate) SetFromConsole(v bool) *AllowListCreate { + _c.mutation.SetFromConsole(v) + return _c } // SetDescription sets the "description" field. -func (alc *AllowListCreate) SetDescription(s string) *AllowListCreate { - alc.mutation.SetDescription(s) - return alc +func (_c *AllowListCreate) SetDescription(v string) *AllowListCreate { + _c.mutation.SetDescription(v) + return _c } // SetNillableDescription sets the "description" field if the given value is not nil. -func (alc *AllowListCreate) SetNillableDescription(s *string) *AllowListCreate { - if s != nil { - alc.SetDescription(*s) +func (_c *AllowListCreate) SetNillableDescription(v *string) *AllowListCreate { + if v != nil { + _c.SetDescription(*v) } - return alc + return _c } // SetAllowlistID sets the "allowlist_id" field. -func (alc *AllowListCreate) SetAllowlistID(s string) *AllowListCreate { - alc.mutation.SetAllowlistID(s) - return alc +func (_c *AllowListCreate) SetAllowlistID(v string) *AllowListCreate { + _c.mutation.SetAllowlistID(v) + return _c } // SetNillableAllowlistID sets the "allowlist_id" field if the given value is not nil. -func (alc *AllowListCreate) SetNillableAllowlistID(s *string) *AllowListCreate { - if s != nil { - alc.SetAllowlistID(*s) +func (_c *AllowListCreate) SetNillableAllowlistID(v *string) *AllowListCreate { + if v != nil { + _c.SetAllowlistID(*v) } - return alc + return _c } // AddAllowlistItemIDs adds the "allowlist_items" edge to the AllowListItem entity by IDs. -func (alc *AllowListCreate) AddAllowlistItemIDs(ids ...int) *AllowListCreate { - alc.mutation.AddAllowlistItemIDs(ids...) - return alc +func (_c *AllowListCreate) AddAllowlistItemIDs(ids ...int) *AllowListCreate { + _c.mutation.AddAllowlistItemIDs(ids...) + return _c } // AddAllowlistItems adds the "allowlist_items" edges to the AllowListItem entity. -func (alc *AllowListCreate) AddAllowlistItems(a ...*AllowListItem) *AllowListCreate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_c *AllowListCreate) AddAllowlistItems(v ...*AllowListItem) *AllowListCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return alc.AddAllowlistItemIDs(ids...) + return _c.AddAllowlistItemIDs(ids...) } // Mutation returns the AllowListMutation object of the builder. -func (alc *AllowListCreate) Mutation() *AllowListMutation { - return alc.mutation +func (_c *AllowListCreate) Mutation() *AllowListMutation { + return _c.mutation } // Save creates the AllowList in the database. -func (alc *AllowListCreate) Save(ctx context.Context) (*AllowList, error) { - alc.defaults() - return withHooks(ctx, alc.sqlSave, alc.mutation, alc.hooks) +func (_c *AllowListCreate) Save(ctx context.Context) (*AllowList, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (alc *AllowListCreate) SaveX(ctx context.Context) *AllowList { - v, err := alc.Save(ctx) +func (_c *AllowListCreate) SaveX(ctx context.Context) *AllowList { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -127,53 +127,53 @@ func (alc *AllowListCreate) SaveX(ctx context.Context) *AllowList { } // Exec executes the query. -func (alc *AllowListCreate) Exec(ctx context.Context) error { - _, err := alc.Save(ctx) +func (_c *AllowListCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (alc *AllowListCreate) ExecX(ctx context.Context) { - if err := alc.Exec(ctx); err != nil { +func (_c *AllowListCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (alc *AllowListCreate) defaults() { - if _, ok := alc.mutation.CreatedAt(); !ok { +func (_c *AllowListCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := allowlist.DefaultCreatedAt() - alc.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := alc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := allowlist.DefaultUpdatedAt() - alc.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (alc *AllowListCreate) check() error { - if _, ok := alc.mutation.CreatedAt(); !ok { +func (_c *AllowListCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "AllowList.created_at"`)} } - if _, ok := alc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AllowList.updated_at"`)} } - if _, ok := alc.mutation.Name(); !ok { + if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "AllowList.name"`)} } - if _, ok := alc.mutation.FromConsole(); !ok { + if _, ok := _c.mutation.FromConsole(); !ok { return &ValidationError{Name: "from_console", err: errors.New(`ent: missing required field "AllowList.from_console"`)} } return nil } -func (alc *AllowListCreate) sqlSave(ctx context.Context) (*AllowList, error) { - if err := alc.check(); err != nil { +func (_c *AllowListCreate) sqlSave(ctx context.Context) (*AllowList, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := alc.createSpec() - if err := sqlgraph.CreateNode(ctx, alc.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -181,42 +181,42 @@ func (alc *AllowListCreate) sqlSave(ctx context.Context) (*AllowList, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - alc.mutation.id = &_node.ID - alc.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (alc *AllowListCreate) createSpec() (*AllowList, *sqlgraph.CreateSpec) { +func (_c *AllowListCreate) createSpec() (*AllowList, *sqlgraph.CreateSpec) { var ( - _node = &AllowList{config: alc.config} + _node = &AllowList{config: _c.config} _spec = sqlgraph.NewCreateSpec(allowlist.Table, sqlgraph.NewFieldSpec(allowlist.FieldID, field.TypeInt)) ) - _spec.OnConflict = alc.conflict - if value, ok := alc.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(allowlist.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := alc.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(allowlist.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := alc.mutation.Name(); ok { + if value, ok := _c.mutation.Name(); ok { _spec.SetField(allowlist.FieldName, field.TypeString, value) _node.Name = value } - if value, ok := alc.mutation.FromConsole(); ok { + if value, ok := _c.mutation.FromConsole(); ok { _spec.SetField(allowlist.FieldFromConsole, field.TypeBool, value) _node.FromConsole = value } - if value, ok := alc.mutation.Description(); ok { + if value, ok := _c.mutation.Description(); ok { _spec.SetField(allowlist.FieldDescription, field.TypeString, value) _node.Description = value } - if value, ok := alc.mutation.AllowlistID(); ok { + if value, ok := _c.mutation.AllowlistID(); ok { _spec.SetField(allowlist.FieldAllowlistID, field.TypeString, value) _node.AllowlistID = value } - if nodes := alc.mutation.AllowlistItemsIDs(); len(nodes) > 0 { + if nodes := _c.mutation.AllowlistItemsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: false, @@ -251,10 +251,10 @@ func (alc *AllowListCreate) createSpec() (*AllowList, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (alc *AllowListCreate) OnConflict(opts ...sql.ConflictOption) *AllowListUpsertOne { - alc.conflict = opts +func (_c *AllowListCreate) OnConflict(opts ...sql.ConflictOption) *AllowListUpsertOne { + _c.conflict = opts return &AllowListUpsertOne{ - create: alc, + create: _c, } } @@ -264,10 +264,10 @@ func (alc *AllowListCreate) OnConflict(opts ...sql.ConflictOption) *AllowListUps // client.AllowList.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (alc *AllowListCreate) OnConflictColumns(columns ...string) *AllowListUpsertOne { - alc.conflict = append(alc.conflict, sql.ConflictColumns(columns...)) +func (_c *AllowListCreate) OnConflictColumns(columns ...string) *AllowListUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AllowListUpsertOne{ - create: alc, + create: _c, } } @@ -491,16 +491,16 @@ type AllowListCreateBulk struct { } // Save creates the AllowList entities in the database. -func (alcb *AllowListCreateBulk) Save(ctx context.Context) ([]*AllowList, error) { - if alcb.err != nil { - return nil, alcb.err +func (_c *AllowListCreateBulk) Save(ctx context.Context) ([]*AllowList, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(alcb.builders)) - nodes := make([]*AllowList, len(alcb.builders)) - mutators := make([]Mutator, len(alcb.builders)) - for i := range alcb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*AllowList, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := alcb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*AllowListMutation) @@ -514,12 +514,12 @@ func (alcb *AllowListCreateBulk) Save(ctx context.Context) ([]*AllowList, error) var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, alcb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = alcb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, alcb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -543,7 +543,7 @@ func (alcb *AllowListCreateBulk) Save(ctx context.Context) ([]*AllowList, error) }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, alcb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -551,8 +551,8 @@ func (alcb *AllowListCreateBulk) Save(ctx context.Context) ([]*AllowList, error) } // SaveX is like Save, but panics if an error occurs. -func (alcb *AllowListCreateBulk) SaveX(ctx context.Context) []*AllowList { - v, err := alcb.Save(ctx) +func (_c *AllowListCreateBulk) SaveX(ctx context.Context) []*AllowList { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -560,14 +560,14 @@ func (alcb *AllowListCreateBulk) SaveX(ctx context.Context) []*AllowList { } // Exec executes the query. -func (alcb *AllowListCreateBulk) Exec(ctx context.Context) error { - _, err := alcb.Save(ctx) +func (_c *AllowListCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (alcb *AllowListCreateBulk) ExecX(ctx context.Context) { - if err := alcb.Exec(ctx); err != nil { +func (_c *AllowListCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -587,10 +587,10 @@ func (alcb *AllowListCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (alcb *AllowListCreateBulk) OnConflict(opts ...sql.ConflictOption) *AllowListUpsertBulk { - alcb.conflict = opts +func (_c *AllowListCreateBulk) OnConflict(opts ...sql.ConflictOption) *AllowListUpsertBulk { + _c.conflict = opts return &AllowListUpsertBulk{ - create: alcb, + create: _c, } } @@ -600,10 +600,10 @@ func (alcb *AllowListCreateBulk) OnConflict(opts ...sql.ConflictOption) *AllowLi // client.AllowList.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (alcb *AllowListCreateBulk) OnConflictColumns(columns ...string) *AllowListUpsertBulk { - alcb.conflict = append(alcb.conflict, sql.ConflictColumns(columns...)) +func (_c *AllowListCreateBulk) OnConflictColumns(columns ...string) *AllowListUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AllowListUpsertBulk{ - create: alcb, + create: _c, } } diff --git a/pkg/database/ent/allowlist_delete.go b/pkg/database/ent/allowlist_delete.go index dcfaa214f..34cc8b142 100644 --- a/pkg/database/ent/allowlist_delete.go +++ b/pkg/database/ent/allowlist_delete.go @@ -20,56 +20,56 @@ type AllowListDelete struct { } // Where appends a list predicates to the AllowListDelete builder. -func (ald *AllowListDelete) Where(ps ...predicate.AllowList) *AllowListDelete { - ald.mutation.Where(ps...) - return ald +func (_d *AllowListDelete) Where(ps ...predicate.AllowList) *AllowListDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (ald *AllowListDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, ald.sqlExec, ald.mutation, ald.hooks) +func (_d *AllowListDelete) 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 (ald *AllowListDelete) ExecX(ctx context.Context) int { - n, err := ald.Exec(ctx) +func (_d *AllowListDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (ald *AllowListDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *AllowListDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(allowlist.Table, sqlgraph.NewFieldSpec(allowlist.FieldID, field.TypeInt)) - if ps := ald.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, ald.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - ald.mutation.done = true + _d.mutation.done = true return affected, err } // AllowListDeleteOne is the builder for deleting a single AllowList entity. type AllowListDeleteOne struct { - ald *AllowListDelete + _d *AllowListDelete } // Where appends a list predicates to the AllowListDelete builder. -func (aldo *AllowListDeleteOne) Where(ps ...predicate.AllowList) *AllowListDeleteOne { - aldo.ald.mutation.Where(ps...) - return aldo +func (_d *AllowListDeleteOne) Where(ps ...predicate.AllowList) *AllowListDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (aldo *AllowListDeleteOne) Exec(ctx context.Context) error { - n, err := aldo.ald.Exec(ctx) +func (_d *AllowListDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (aldo *AllowListDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (aldo *AllowListDeleteOne) ExecX(ctx context.Context) { - if err := aldo.Exec(ctx); err != nil { +func (_d *AllowListDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/allowlist_query.go b/pkg/database/ent/allowlist_query.go index 8ea40ee0c..28b230197 100644 --- a/pkg/database/ent/allowlist_query.go +++ b/pkg/database/ent/allowlist_query.go @@ -31,44 +31,44 @@ type AllowListQuery struct { } // Where adds a new predicate for the AllowListQuery builder. -func (alq *AllowListQuery) Where(ps ...predicate.AllowList) *AllowListQuery { - alq.predicates = append(alq.predicates, ps...) - return alq +func (_q *AllowListQuery) Where(ps ...predicate.AllowList) *AllowListQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (alq *AllowListQuery) Limit(limit int) *AllowListQuery { - alq.ctx.Limit = &limit - return alq +func (_q *AllowListQuery) Limit(limit int) *AllowListQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (alq *AllowListQuery) Offset(offset int) *AllowListQuery { - alq.ctx.Offset = &offset - return alq +func (_q *AllowListQuery) Offset(offset int) *AllowListQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (alq *AllowListQuery) Unique(unique bool) *AllowListQuery { - alq.ctx.Unique = &unique - return alq +func (_q *AllowListQuery) Unique(unique bool) *AllowListQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (alq *AllowListQuery) Order(o ...allowlist.OrderOption) *AllowListQuery { - alq.order = append(alq.order, o...) - return alq +func (_q *AllowListQuery) Order(o ...allowlist.OrderOption) *AllowListQuery { + _q.order = append(_q.order, o...) + return _q } // QueryAllowlistItems chains the current query on the "allowlist_items" edge. -func (alq *AllowListQuery) QueryAllowlistItems() *AllowListItemQuery { - query := (&AllowListItemClient{config: alq.config}).Query() +func (_q *AllowListQuery) QueryAllowlistItems() *AllowListItemQuery { + query := (&AllowListItemClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := alq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := alq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -77,7 +77,7 @@ func (alq *AllowListQuery) QueryAllowlistItems() *AllowListItemQuery { sqlgraph.To(allowlistitem.Table, allowlistitem.FieldID), sqlgraph.Edge(sqlgraph.M2M, false, allowlist.AllowlistItemsTable, allowlist.AllowlistItemsPrimaryKey...), ) - fromU = sqlgraph.SetNeighbors(alq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query @@ -85,8 +85,8 @@ func (alq *AllowListQuery) QueryAllowlistItems() *AllowListItemQuery { // First returns the first AllowList entity from the query. // Returns a *NotFoundError when no AllowList was found. -func (alq *AllowListQuery) First(ctx context.Context) (*AllowList, error) { - nodes, err := alq.Limit(1).All(setContextOp(ctx, alq.ctx, ent.OpQueryFirst)) +func (_q *AllowListQuery) First(ctx context.Context) (*AllowList, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -97,8 +97,8 @@ func (alq *AllowListQuery) First(ctx context.Context) (*AllowList, error) { } // FirstX is like First, but panics if an error occurs. -func (alq *AllowListQuery) FirstX(ctx context.Context) *AllowList { - node, err := alq.First(ctx) +func (_q *AllowListQuery) FirstX(ctx context.Context) *AllowList { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -107,9 +107,9 @@ func (alq *AllowListQuery) FirstX(ctx context.Context) *AllowList { // FirstID returns the first AllowList ID from the query. // Returns a *NotFoundError when no AllowList ID was found. -func (alq *AllowListQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *AllowListQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = alq.Limit(1).IDs(setContextOp(ctx, alq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -120,8 +120,8 @@ func (alq *AllowListQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (alq *AllowListQuery) FirstIDX(ctx context.Context) int { - id, err := alq.FirstID(ctx) +func (_q *AllowListQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -131,8 +131,8 @@ func (alq *AllowListQuery) FirstIDX(ctx context.Context) int { // Only returns a single AllowList entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one AllowList entity is found. // Returns a *NotFoundError when no AllowList entities are found. -func (alq *AllowListQuery) Only(ctx context.Context) (*AllowList, error) { - nodes, err := alq.Limit(2).All(setContextOp(ctx, alq.ctx, ent.OpQueryOnly)) +func (_q *AllowListQuery) Only(ctx context.Context) (*AllowList, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -147,8 +147,8 @@ func (alq *AllowListQuery) Only(ctx context.Context) (*AllowList, error) { } // OnlyX is like Only, but panics if an error occurs. -func (alq *AllowListQuery) OnlyX(ctx context.Context) *AllowList { - node, err := alq.Only(ctx) +func (_q *AllowListQuery) OnlyX(ctx context.Context) *AllowList { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -158,9 +158,9 @@ func (alq *AllowListQuery) OnlyX(ctx context.Context) *AllowList { // OnlyID is like Only, but returns the only AllowList ID in the query. // Returns a *NotSingularError when more than one AllowList ID is found. // Returns a *NotFoundError when no entities are found. -func (alq *AllowListQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *AllowListQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = alq.Limit(2).IDs(setContextOp(ctx, alq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -175,8 +175,8 @@ func (alq *AllowListQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (alq *AllowListQuery) OnlyIDX(ctx context.Context) int { - id, err := alq.OnlyID(ctx) +func (_q *AllowListQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -184,18 +184,18 @@ func (alq *AllowListQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of AllowLists. -func (alq *AllowListQuery) All(ctx context.Context) ([]*AllowList, error) { - ctx = setContextOp(ctx, alq.ctx, ent.OpQueryAll) - if err := alq.prepareQuery(ctx); err != nil { +func (_q *AllowListQuery) All(ctx context.Context) ([]*AllowList, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*AllowList, *AllowListQuery]() - return withInterceptors[[]*AllowList](ctx, alq, qr, alq.inters) + return withInterceptors[[]*AllowList](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (alq *AllowListQuery) AllX(ctx context.Context) []*AllowList { - nodes, err := alq.All(ctx) +func (_q *AllowListQuery) AllX(ctx context.Context) []*AllowList { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -203,20 +203,20 @@ func (alq *AllowListQuery) AllX(ctx context.Context) []*AllowList { } // IDs executes the query and returns a list of AllowList IDs. -func (alq *AllowListQuery) IDs(ctx context.Context) (ids []int, err error) { - if alq.ctx.Unique == nil && alq.path != nil { - alq.Unique(true) +func (_q *AllowListQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, alq.ctx, ent.OpQueryIDs) - if err = alq.Select(allowlist.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(allowlist.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (alq *AllowListQuery) IDsX(ctx context.Context) []int { - ids, err := alq.IDs(ctx) +func (_q *AllowListQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -224,17 +224,17 @@ func (alq *AllowListQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (alq *AllowListQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, alq.ctx, ent.OpQueryCount) - if err := alq.prepareQuery(ctx); err != nil { +func (_q *AllowListQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, alq, querierCount[*AllowListQuery](), alq.inters) + return withInterceptors[int](ctx, _q, querierCount[*AllowListQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (alq *AllowListQuery) CountX(ctx context.Context) int { - count, err := alq.Count(ctx) +func (_q *AllowListQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -242,9 +242,9 @@ func (alq *AllowListQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (alq *AllowListQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, alq.ctx, ent.OpQueryExist) - switch _, err := alq.FirstID(ctx); { +func (_q *AllowListQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -255,8 +255,8 @@ func (alq *AllowListQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (alq *AllowListQuery) ExistX(ctx context.Context) bool { - exist, err := alq.Exist(ctx) +func (_q *AllowListQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -265,32 +265,32 @@ func (alq *AllowListQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the AllowListQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (alq *AllowListQuery) Clone() *AllowListQuery { - if alq == nil { +func (_q *AllowListQuery) Clone() *AllowListQuery { + if _q == nil { return nil } return &AllowListQuery{ - config: alq.config, - ctx: alq.ctx.Clone(), - order: append([]allowlist.OrderOption{}, alq.order...), - inters: append([]Interceptor{}, alq.inters...), - predicates: append([]predicate.AllowList{}, alq.predicates...), - withAllowlistItems: alq.withAllowlistItems.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]allowlist.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.AllowList{}, _q.predicates...), + withAllowlistItems: _q.withAllowlistItems.Clone(), // clone intermediate query. - sql: alq.sql.Clone(), - path: alq.path, + sql: _q.sql.Clone(), + path: _q.path, } } // WithAllowlistItems tells the query-builder to eager-load the nodes that are connected to // the "allowlist_items" edge. The optional arguments are used to configure the query builder of the edge. -func (alq *AllowListQuery) WithAllowlistItems(opts ...func(*AllowListItemQuery)) *AllowListQuery { - query := (&AllowListItemClient{config: alq.config}).Query() +func (_q *AllowListQuery) WithAllowlistItems(opts ...func(*AllowListItemQuery)) *AllowListQuery { + query := (&AllowListItemClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - alq.withAllowlistItems = query - return alq + _q.withAllowlistItems = query + return _q } // GroupBy is used to group vertices by one or more fields/columns. @@ -307,10 +307,10 @@ func (alq *AllowListQuery) WithAllowlistItems(opts ...func(*AllowListItemQuery)) // GroupBy(allowlist.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (alq *AllowListQuery) GroupBy(field string, fields ...string) *AllowListGroupBy { - alq.ctx.Fields = append([]string{field}, fields...) - grbuild := &AllowListGroupBy{build: alq} - grbuild.flds = &alq.ctx.Fields +func (_q *AllowListQuery) GroupBy(field string, fields ...string) *AllowListGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &AllowListGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = allowlist.Label grbuild.scan = grbuild.Scan return grbuild @@ -328,58 +328,58 @@ func (alq *AllowListQuery) GroupBy(field string, fields ...string) *AllowListGro // client.AllowList.Query(). // Select(allowlist.FieldCreatedAt). // Scan(ctx, &v) -func (alq *AllowListQuery) Select(fields ...string) *AllowListSelect { - alq.ctx.Fields = append(alq.ctx.Fields, fields...) - sbuild := &AllowListSelect{AllowListQuery: alq} +func (_q *AllowListQuery) Select(fields ...string) *AllowListSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &AllowListSelect{AllowListQuery: _q} sbuild.label = allowlist.Label - sbuild.flds, sbuild.scan = &alq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a AllowListSelect configured with the given aggregations. -func (alq *AllowListQuery) Aggregate(fns ...AggregateFunc) *AllowListSelect { - return alq.Select().Aggregate(fns...) +func (_q *AllowListQuery) Aggregate(fns ...AggregateFunc) *AllowListSelect { + return _q.Select().Aggregate(fns...) } -func (alq *AllowListQuery) prepareQuery(ctx context.Context) error { - for _, inter := range alq.inters { +func (_q *AllowListQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, alq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range alq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !allowlist.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if alq.path != nil { - prev, err := alq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - alq.sql = prev + _q.sql = prev } return nil } -func (alq *AllowListQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AllowList, error) { +func (_q *AllowListQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AllowList, error) { var ( nodes = []*AllowList{} - _spec = alq.querySpec() + _spec = _q.querySpec() loadedTypes = [1]bool{ - alq.withAllowlistItems != nil, + _q.withAllowlistItems != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*AllowList).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &AllowList{config: alq.config} + node := &AllowList{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) @@ -387,14 +387,14 @@ func (alq *AllowListQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, alq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := alq.withAllowlistItems; query != nil { - if err := alq.loadAllowlistItems(ctx, query, nodes, + if query := _q.withAllowlistItems; query != nil { + if err := _q.loadAllowlistItems(ctx, query, nodes, func(n *AllowList) { n.Edges.AllowlistItems = []*AllowListItem{} }, func(n *AllowList, e *AllowListItem) { n.Edges.AllowlistItems = append(n.Edges.AllowlistItems, e) }); err != nil { return nil, err @@ -403,7 +403,7 @@ func (alq *AllowListQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A return nodes, nil } -func (alq *AllowListQuery) loadAllowlistItems(ctx context.Context, query *AllowListItemQuery, nodes []*AllowList, init func(*AllowList), assign func(*AllowList, *AllowListItem)) error { +func (_q *AllowListQuery) loadAllowlistItems(ctx context.Context, query *AllowListItemQuery, nodes []*AllowList, init func(*AllowList), assign func(*AllowList, *AllowListItem)) error { edgeIDs := make([]driver.Value, len(nodes)) byID := make(map[int]*AllowList) nids := make(map[int]map[*AllowList]struct{}) @@ -465,24 +465,24 @@ func (alq *AllowListQuery) loadAllowlistItems(ctx context.Context, query *AllowL return nil } -func (alq *AllowListQuery) sqlCount(ctx context.Context) (int, error) { - _spec := alq.querySpec() - _spec.Node.Columns = alq.ctx.Fields - if len(alq.ctx.Fields) > 0 { - _spec.Unique = alq.ctx.Unique != nil && *alq.ctx.Unique +func (_q *AllowListQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, alq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (alq *AllowListQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *AllowListQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(allowlist.Table, allowlist.Columns, sqlgraph.NewFieldSpec(allowlist.FieldID, field.TypeInt)) - _spec.From = alq.sql - if unique := alq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if alq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := alq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, allowlist.FieldID) for i := range fields { @@ -491,20 +491,20 @@ func (alq *AllowListQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := alq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := alq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := alq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := alq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -514,33 +514,33 @@ func (alq *AllowListQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (alq *AllowListQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(alq.driver.Dialect()) +func (_q *AllowListQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(allowlist.Table) - columns := alq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = allowlist.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if alq.sql != nil { - selector = alq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if alq.ctx.Unique != nil && *alq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range alq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range alq.order { + for _, p := range _q.order { p(selector) } - if offset := alq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := alq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -553,41 +553,41 @@ type AllowListGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (algb *AllowListGroupBy) Aggregate(fns ...AggregateFunc) *AllowListGroupBy { - algb.fns = append(algb.fns, fns...) - return algb +func (_g *AllowListGroupBy) Aggregate(fns ...AggregateFunc) *AllowListGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (algb *AllowListGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, algb.build.ctx, ent.OpQueryGroupBy) - if err := algb.build.prepareQuery(ctx); err != nil { +func (_g *AllowListGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AllowListQuery, *AllowListGroupBy](ctx, algb.build, algb, algb.build.inters, v) + return scanWithInterceptors[*AllowListQuery, *AllowListGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (algb *AllowListGroupBy) sqlScan(ctx context.Context, root *AllowListQuery, v any) error { +func (_g *AllowListGroupBy) sqlScan(ctx context.Context, root *AllowListQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(algb.fns)) - for _, fn := range algb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*algb.flds)+len(algb.fns)) - for _, f := range *algb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*algb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := algb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -601,27 +601,27 @@ type AllowListSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (als *AllowListSelect) Aggregate(fns ...AggregateFunc) *AllowListSelect { - als.fns = append(als.fns, fns...) - return als +func (_s *AllowListSelect) Aggregate(fns ...AggregateFunc) *AllowListSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (als *AllowListSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, als.ctx, ent.OpQuerySelect) - if err := als.prepareQuery(ctx); err != nil { +func (_s *AllowListSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AllowListQuery, *AllowListSelect](ctx, als.AllowListQuery, als, als.inters, v) + return scanWithInterceptors[*AllowListQuery, *AllowListSelect](ctx, _s.AllowListQuery, _s, _s.inters, v) } -func (als *AllowListSelect) sqlScan(ctx context.Context, root *AllowListQuery, v any) error { +func (_s *AllowListSelect) sqlScan(ctx context.Context, root *AllowListQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(als.fns)) - for _, fn := range als.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*als.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -629,7 +629,7 @@ func (als *AllowListSelect) sqlScan(ctx context.Context, root *AllowListQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := als.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/allowlist_update.go b/pkg/database/ent/allowlist_update.go index 0c871946f..a6d1b2009 100644 --- a/pkg/database/ent/allowlist_update.go +++ b/pkg/database/ent/allowlist_update.go @@ -24,115 +24,115 @@ type AllowListUpdate struct { } // Where appends a list predicates to the AllowListUpdate builder. -func (alu *AllowListUpdate) Where(ps ...predicate.AllowList) *AllowListUpdate { - alu.mutation.Where(ps...) - return alu +func (_u *AllowListUpdate) Where(ps ...predicate.AllowList) *AllowListUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (alu *AllowListUpdate) SetUpdatedAt(t time.Time) *AllowListUpdate { - alu.mutation.SetUpdatedAt(t) - return alu +func (_u *AllowListUpdate) SetUpdatedAt(v time.Time) *AllowListUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetName sets the "name" field. -func (alu *AllowListUpdate) SetName(s string) *AllowListUpdate { - alu.mutation.SetName(s) - return alu +func (_u *AllowListUpdate) SetName(v string) *AllowListUpdate { + _u.mutation.SetName(v) + return _u } // SetNillableName sets the "name" field if the given value is not nil. -func (alu *AllowListUpdate) SetNillableName(s *string) *AllowListUpdate { - if s != nil { - alu.SetName(*s) +func (_u *AllowListUpdate) SetNillableName(v *string) *AllowListUpdate { + if v != nil { + _u.SetName(*v) } - return alu + return _u } // SetFromConsole sets the "from_console" field. -func (alu *AllowListUpdate) SetFromConsole(b bool) *AllowListUpdate { - alu.mutation.SetFromConsole(b) - return alu +func (_u *AllowListUpdate) SetFromConsole(v bool) *AllowListUpdate { + _u.mutation.SetFromConsole(v) + return _u } // SetNillableFromConsole sets the "from_console" field if the given value is not nil. -func (alu *AllowListUpdate) SetNillableFromConsole(b *bool) *AllowListUpdate { - if b != nil { - alu.SetFromConsole(*b) +func (_u *AllowListUpdate) SetNillableFromConsole(v *bool) *AllowListUpdate { + if v != nil { + _u.SetFromConsole(*v) } - return alu + return _u } // SetDescription sets the "description" field. -func (alu *AllowListUpdate) SetDescription(s string) *AllowListUpdate { - alu.mutation.SetDescription(s) - return alu +func (_u *AllowListUpdate) SetDescription(v string) *AllowListUpdate { + _u.mutation.SetDescription(v) + return _u } // SetNillableDescription sets the "description" field if the given value is not nil. -func (alu *AllowListUpdate) SetNillableDescription(s *string) *AllowListUpdate { - if s != nil { - alu.SetDescription(*s) +func (_u *AllowListUpdate) SetNillableDescription(v *string) *AllowListUpdate { + if v != nil { + _u.SetDescription(*v) } - return alu + return _u } // ClearDescription clears the value of the "description" field. -func (alu *AllowListUpdate) ClearDescription() *AllowListUpdate { - alu.mutation.ClearDescription() - return alu +func (_u *AllowListUpdate) ClearDescription() *AllowListUpdate { + _u.mutation.ClearDescription() + return _u } // AddAllowlistItemIDs adds the "allowlist_items" edge to the AllowListItem entity by IDs. -func (alu *AllowListUpdate) AddAllowlistItemIDs(ids ...int) *AllowListUpdate { - alu.mutation.AddAllowlistItemIDs(ids...) - return alu +func (_u *AllowListUpdate) AddAllowlistItemIDs(ids ...int) *AllowListUpdate { + _u.mutation.AddAllowlistItemIDs(ids...) + return _u } // AddAllowlistItems adds the "allowlist_items" edges to the AllowListItem entity. -func (alu *AllowListUpdate) AddAllowlistItems(a ...*AllowListItem) *AllowListUpdate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListUpdate) AddAllowlistItems(v ...*AllowListItem) *AllowListUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return alu.AddAllowlistItemIDs(ids...) + return _u.AddAllowlistItemIDs(ids...) } // Mutation returns the AllowListMutation object of the builder. -func (alu *AllowListUpdate) Mutation() *AllowListMutation { - return alu.mutation +func (_u *AllowListUpdate) Mutation() *AllowListMutation { + return _u.mutation } // ClearAllowlistItems clears all "allowlist_items" edges to the AllowListItem entity. -func (alu *AllowListUpdate) ClearAllowlistItems() *AllowListUpdate { - alu.mutation.ClearAllowlistItems() - return alu +func (_u *AllowListUpdate) ClearAllowlistItems() *AllowListUpdate { + _u.mutation.ClearAllowlistItems() + return _u } // RemoveAllowlistItemIDs removes the "allowlist_items" edge to AllowListItem entities by IDs. -func (alu *AllowListUpdate) RemoveAllowlistItemIDs(ids ...int) *AllowListUpdate { - alu.mutation.RemoveAllowlistItemIDs(ids...) - return alu +func (_u *AllowListUpdate) RemoveAllowlistItemIDs(ids ...int) *AllowListUpdate { + _u.mutation.RemoveAllowlistItemIDs(ids...) + return _u } // RemoveAllowlistItems removes "allowlist_items" edges to AllowListItem entities. -func (alu *AllowListUpdate) RemoveAllowlistItems(a ...*AllowListItem) *AllowListUpdate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListUpdate) RemoveAllowlistItems(v ...*AllowListItem) *AllowListUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return alu.RemoveAllowlistItemIDs(ids...) + return _u.RemoveAllowlistItemIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. -func (alu *AllowListUpdate) Save(ctx context.Context) (int, error) { - alu.defaults() - return withHooks(ctx, alu.sqlSave, alu.mutation, alu.hooks) +func (_u *AllowListUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (alu *AllowListUpdate) SaveX(ctx context.Context) int { - affected, err := alu.Save(ctx) +func (_u *AllowListUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -140,54 +140,54 @@ func (alu *AllowListUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (alu *AllowListUpdate) Exec(ctx context.Context) error { - _, err := alu.Save(ctx) +func (_u *AllowListUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (alu *AllowListUpdate) ExecX(ctx context.Context) { - if err := alu.Exec(ctx); err != nil { +func (_u *AllowListUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (alu *AllowListUpdate) defaults() { - if _, ok := alu.mutation.UpdatedAt(); !ok { +func (_u *AllowListUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := allowlist.UpdateDefaultUpdatedAt() - alu.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (alu *AllowListUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *AllowListUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(allowlist.Table, allowlist.Columns, sqlgraph.NewFieldSpec(allowlist.FieldID, field.TypeInt)) - if ps := alu.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 := alu.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(allowlist.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := alu.mutation.Name(); ok { + if value, ok := _u.mutation.Name(); ok { _spec.SetField(allowlist.FieldName, field.TypeString, value) } - if value, ok := alu.mutation.FromConsole(); ok { + if value, ok := _u.mutation.FromConsole(); ok { _spec.SetField(allowlist.FieldFromConsole, field.TypeBool, value) } - if value, ok := alu.mutation.Description(); ok { + if value, ok := _u.mutation.Description(); ok { _spec.SetField(allowlist.FieldDescription, field.TypeString, value) } - if alu.mutation.DescriptionCleared() { + if _u.mutation.DescriptionCleared() { _spec.ClearField(allowlist.FieldDescription, field.TypeString) } - if alu.mutation.AllowlistIDCleared() { + if _u.mutation.AllowlistIDCleared() { _spec.ClearField(allowlist.FieldAllowlistID, field.TypeString) } - if alu.mutation.AllowlistItemsCleared() { + if _u.mutation.AllowlistItemsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: false, @@ -200,7 +200,7 @@ func (alu *AllowListUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := alu.mutation.RemovedAllowlistItemsIDs(); len(nodes) > 0 && !alu.mutation.AllowlistItemsCleared() { + if nodes := _u.mutation.RemovedAllowlistItemsIDs(); len(nodes) > 0 && !_u.mutation.AllowlistItemsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: false, @@ -216,7 +216,7 @@ func (alu *AllowListUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := alu.mutation.AllowlistItemsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.AllowlistItemsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: false, @@ -232,7 +232,7 @@ func (alu *AllowListUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if n, err = sqlgraph.UpdateNodes(ctx, alu.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{allowlist.Label} } else if sqlgraph.IsConstraintError(err) { @@ -240,8 +240,8 @@ func (alu *AllowListUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - alu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // AllowListUpdateOne is the builder for updating a single AllowList entity. @@ -253,122 +253,122 @@ type AllowListUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (aluo *AllowListUpdateOne) SetUpdatedAt(t time.Time) *AllowListUpdateOne { - aluo.mutation.SetUpdatedAt(t) - return aluo +func (_u *AllowListUpdateOne) SetUpdatedAt(v time.Time) *AllowListUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetName sets the "name" field. -func (aluo *AllowListUpdateOne) SetName(s string) *AllowListUpdateOne { - aluo.mutation.SetName(s) - return aluo +func (_u *AllowListUpdateOne) SetName(v string) *AllowListUpdateOne { + _u.mutation.SetName(v) + return _u } // SetNillableName sets the "name" field if the given value is not nil. -func (aluo *AllowListUpdateOne) SetNillableName(s *string) *AllowListUpdateOne { - if s != nil { - aluo.SetName(*s) +func (_u *AllowListUpdateOne) SetNillableName(v *string) *AllowListUpdateOne { + if v != nil { + _u.SetName(*v) } - return aluo + return _u } // SetFromConsole sets the "from_console" field. -func (aluo *AllowListUpdateOne) SetFromConsole(b bool) *AllowListUpdateOne { - aluo.mutation.SetFromConsole(b) - return aluo +func (_u *AllowListUpdateOne) SetFromConsole(v bool) *AllowListUpdateOne { + _u.mutation.SetFromConsole(v) + return _u } // SetNillableFromConsole sets the "from_console" field if the given value is not nil. -func (aluo *AllowListUpdateOne) SetNillableFromConsole(b *bool) *AllowListUpdateOne { - if b != nil { - aluo.SetFromConsole(*b) +func (_u *AllowListUpdateOne) SetNillableFromConsole(v *bool) *AllowListUpdateOne { + if v != nil { + _u.SetFromConsole(*v) } - return aluo + return _u } // SetDescription sets the "description" field. -func (aluo *AllowListUpdateOne) SetDescription(s string) *AllowListUpdateOne { - aluo.mutation.SetDescription(s) - return aluo +func (_u *AllowListUpdateOne) SetDescription(v string) *AllowListUpdateOne { + _u.mutation.SetDescription(v) + return _u } // SetNillableDescription sets the "description" field if the given value is not nil. -func (aluo *AllowListUpdateOne) SetNillableDescription(s *string) *AllowListUpdateOne { - if s != nil { - aluo.SetDescription(*s) +func (_u *AllowListUpdateOne) SetNillableDescription(v *string) *AllowListUpdateOne { + if v != nil { + _u.SetDescription(*v) } - return aluo + return _u } // ClearDescription clears the value of the "description" field. -func (aluo *AllowListUpdateOne) ClearDescription() *AllowListUpdateOne { - aluo.mutation.ClearDescription() - return aluo +func (_u *AllowListUpdateOne) ClearDescription() *AllowListUpdateOne { + _u.mutation.ClearDescription() + return _u } // AddAllowlistItemIDs adds the "allowlist_items" edge to the AllowListItem entity by IDs. -func (aluo *AllowListUpdateOne) AddAllowlistItemIDs(ids ...int) *AllowListUpdateOne { - aluo.mutation.AddAllowlistItemIDs(ids...) - return aluo +func (_u *AllowListUpdateOne) AddAllowlistItemIDs(ids ...int) *AllowListUpdateOne { + _u.mutation.AddAllowlistItemIDs(ids...) + return _u } // AddAllowlistItems adds the "allowlist_items" edges to the AllowListItem entity. -func (aluo *AllowListUpdateOne) AddAllowlistItems(a ...*AllowListItem) *AllowListUpdateOne { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListUpdateOne) AddAllowlistItems(v ...*AllowListItem) *AllowListUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return aluo.AddAllowlistItemIDs(ids...) + return _u.AddAllowlistItemIDs(ids...) } // Mutation returns the AllowListMutation object of the builder. -func (aluo *AllowListUpdateOne) Mutation() *AllowListMutation { - return aluo.mutation +func (_u *AllowListUpdateOne) Mutation() *AllowListMutation { + return _u.mutation } // ClearAllowlistItems clears all "allowlist_items" edges to the AllowListItem entity. -func (aluo *AllowListUpdateOne) ClearAllowlistItems() *AllowListUpdateOne { - aluo.mutation.ClearAllowlistItems() - return aluo +func (_u *AllowListUpdateOne) ClearAllowlistItems() *AllowListUpdateOne { + _u.mutation.ClearAllowlistItems() + return _u } // RemoveAllowlistItemIDs removes the "allowlist_items" edge to AllowListItem entities by IDs. -func (aluo *AllowListUpdateOne) RemoveAllowlistItemIDs(ids ...int) *AllowListUpdateOne { - aluo.mutation.RemoveAllowlistItemIDs(ids...) - return aluo +func (_u *AllowListUpdateOne) RemoveAllowlistItemIDs(ids ...int) *AllowListUpdateOne { + _u.mutation.RemoveAllowlistItemIDs(ids...) + return _u } // RemoveAllowlistItems removes "allowlist_items" edges to AllowListItem entities. -func (aluo *AllowListUpdateOne) RemoveAllowlistItems(a ...*AllowListItem) *AllowListUpdateOne { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListUpdateOne) RemoveAllowlistItems(v ...*AllowListItem) *AllowListUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return aluo.RemoveAllowlistItemIDs(ids...) + return _u.RemoveAllowlistItemIDs(ids...) } // Where appends a list predicates to the AllowListUpdate builder. -func (aluo *AllowListUpdateOne) Where(ps ...predicate.AllowList) *AllowListUpdateOne { - aluo.mutation.Where(ps...) - return aluo +func (_u *AllowListUpdateOne) Where(ps ...predicate.AllowList) *AllowListUpdateOne { + _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 (aluo *AllowListUpdateOne) Select(field string, fields ...string) *AllowListUpdateOne { - aluo.fields = append([]string{field}, fields...) - return aluo +func (_u *AllowListUpdateOne) Select(field string, fields ...string) *AllowListUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated AllowList entity. -func (aluo *AllowListUpdateOne) Save(ctx context.Context) (*AllowList, error) { - aluo.defaults() - return withHooks(ctx, aluo.sqlSave, aluo.mutation, aluo.hooks) +func (_u *AllowListUpdateOne) Save(ctx context.Context) (*AllowList, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (aluo *AllowListUpdateOne) SaveX(ctx context.Context) *AllowList { - node, err := aluo.Save(ctx) +func (_u *AllowListUpdateOne) SaveX(ctx context.Context) *AllowList { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -376,34 +376,34 @@ func (aluo *AllowListUpdateOne) SaveX(ctx context.Context) *AllowList { } // Exec executes the query on the entity. -func (aluo *AllowListUpdateOne) Exec(ctx context.Context) error { - _, err := aluo.Save(ctx) +func (_u *AllowListUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (aluo *AllowListUpdateOne) ExecX(ctx context.Context) { - if err := aluo.Exec(ctx); err != nil { +func (_u *AllowListUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (aluo *AllowListUpdateOne) defaults() { - if _, ok := aluo.mutation.UpdatedAt(); !ok { +func (_u *AllowListUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := allowlist.UpdateDefaultUpdatedAt() - aluo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (aluo *AllowListUpdateOne) sqlSave(ctx context.Context) (_node *AllowList, err error) { +func (_u *AllowListUpdateOne) sqlSave(ctx context.Context) (_node *AllowList, err error) { _spec := sqlgraph.NewUpdateSpec(allowlist.Table, allowlist.Columns, sqlgraph.NewFieldSpec(allowlist.FieldID, field.TypeInt)) - id, ok := aluo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AllowList.id" for update`)} } _spec.Node.ID.Value = id - if fields := aluo.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, allowlist.FieldID) for _, f := range fields { @@ -415,32 +415,32 @@ func (aluo *AllowListUpdateOne) sqlSave(ctx context.Context) (_node *AllowList, } } } - if ps := aluo.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 := aluo.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(allowlist.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := aluo.mutation.Name(); ok { + if value, ok := _u.mutation.Name(); ok { _spec.SetField(allowlist.FieldName, field.TypeString, value) } - if value, ok := aluo.mutation.FromConsole(); ok { + if value, ok := _u.mutation.FromConsole(); ok { _spec.SetField(allowlist.FieldFromConsole, field.TypeBool, value) } - if value, ok := aluo.mutation.Description(); ok { + if value, ok := _u.mutation.Description(); ok { _spec.SetField(allowlist.FieldDescription, field.TypeString, value) } - if aluo.mutation.DescriptionCleared() { + if _u.mutation.DescriptionCleared() { _spec.ClearField(allowlist.FieldDescription, field.TypeString) } - if aluo.mutation.AllowlistIDCleared() { + if _u.mutation.AllowlistIDCleared() { _spec.ClearField(allowlist.FieldAllowlistID, field.TypeString) } - if aluo.mutation.AllowlistItemsCleared() { + if _u.mutation.AllowlistItemsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: false, @@ -453,7 +453,7 @@ func (aluo *AllowListUpdateOne) sqlSave(ctx context.Context) (_node *AllowList, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := aluo.mutation.RemovedAllowlistItemsIDs(); len(nodes) > 0 && !aluo.mutation.AllowlistItemsCleared() { + if nodes := _u.mutation.RemovedAllowlistItemsIDs(); len(nodes) > 0 && !_u.mutation.AllowlistItemsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: false, @@ -469,7 +469,7 @@ func (aluo *AllowListUpdateOne) sqlSave(ctx context.Context) (_node *AllowList, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := aluo.mutation.AllowlistItemsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.AllowlistItemsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: false, @@ -485,10 +485,10 @@ func (aluo *AllowListUpdateOne) sqlSave(ctx context.Context) (_node *AllowList, } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - _node = &AllowList{config: aluo.config} + _node = &AllowList{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, aluo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{allowlist.Label} } else if sqlgraph.IsConstraintError(err) { @@ -496,6 +496,6 @@ func (aluo *AllowListUpdateOne) sqlSave(ctx context.Context) (_node *AllowList, } return nil, err } - aluo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/allowlistitem.go b/pkg/database/ent/allowlistitem.go index 2c0d997b1..ccbba74ff 100644 --- a/pkg/database/ent/allowlistitem.go +++ b/pkg/database/ent/allowlistitem.go @@ -81,7 +81,7 @@ func (*AllowListItem) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the AllowListItem fields. -func (ali *AllowListItem) assignValues(columns []string, values []any) error { +func (_m *AllowListItem) 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) } @@ -92,69 +92,69 @@ func (ali *AllowListItem) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - ali.ID = int(value.Int64) + _m.ID = int(value.Int64) case allowlistitem.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - ali.CreatedAt = value.Time + _m.CreatedAt = value.Time } case allowlistitem.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - ali.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case allowlistitem.FieldExpiresAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field expires_at", values[i]) } else if value.Valid { - ali.ExpiresAt = value.Time + _m.ExpiresAt = value.Time } case allowlistitem.FieldComment: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field comment", values[i]) } else if value.Valid { - ali.Comment = value.String + _m.Comment = value.String } case allowlistitem.FieldValue: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field value", values[i]) } else if value.Valid { - ali.Value = value.String + _m.Value = value.String } case allowlistitem.FieldStartIP: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field start_ip", values[i]) } else if value.Valid { - ali.StartIP = value.Int64 + _m.StartIP = value.Int64 } case allowlistitem.FieldEndIP: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field end_ip", values[i]) } else if value.Valid { - ali.EndIP = value.Int64 + _m.EndIP = value.Int64 } case allowlistitem.FieldStartSuffix: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field start_suffix", values[i]) } else if value.Valid { - ali.StartSuffix = value.Int64 + _m.StartSuffix = value.Int64 } case allowlistitem.FieldEndSuffix: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field end_suffix", values[i]) } else if value.Valid { - ali.EndSuffix = value.Int64 + _m.EndSuffix = value.Int64 } case allowlistitem.FieldIPSize: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field ip_size", values[i]) } else if value.Valid { - ali.IPSize = value.Int64 + _m.IPSize = value.Int64 } default: - ali.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -162,67 +162,67 @@ func (ali *AllowListItem) assignValues(columns []string, values []any) error { // GetValue returns the ent.Value that was dynamically selected and assigned to the AllowListItem. // This includes values selected through modifiers, order, etc. -func (ali *AllowListItem) GetValue(name string) (ent.Value, error) { - return ali.selectValues.Get(name) +func (_m *AllowListItem) GetValue(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // QueryAllowlist queries the "allowlist" edge of the AllowListItem entity. -func (ali *AllowListItem) QueryAllowlist() *AllowListQuery { - return NewAllowListItemClient(ali.config).QueryAllowlist(ali) +func (_m *AllowListItem) QueryAllowlist() *AllowListQuery { + return NewAllowListItemClient(_m.config).QueryAllowlist(_m) } // Update returns a builder for updating this AllowListItem. // Note that you need to call AllowListItem.Unwrap() before calling this method if this AllowListItem // was returned from a transaction, and the transaction was committed or rolled back. -func (ali *AllowListItem) Update() *AllowListItemUpdateOne { - return NewAllowListItemClient(ali.config).UpdateOne(ali) +func (_m *AllowListItem) Update() *AllowListItemUpdateOne { + return NewAllowListItemClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the AllowListItem 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 (ali *AllowListItem) Unwrap() *AllowListItem { - _tx, ok := ali.config.driver.(*txDriver) +func (_m *AllowListItem) Unwrap() *AllowListItem { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: AllowListItem is not a transactional entity") } - ali.config.driver = _tx.drv - return ali + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (ali *AllowListItem) String() string { +func (_m *AllowListItem) String() string { var builder strings.Builder builder.WriteString("AllowListItem(") - builder.WriteString(fmt.Sprintf("id=%v, ", ali.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(ali.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(ali.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("expires_at=") - builder.WriteString(ali.ExpiresAt.Format(time.ANSIC)) + builder.WriteString(_m.ExpiresAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("comment=") - builder.WriteString(ali.Comment) + builder.WriteString(_m.Comment) builder.WriteString(", ") builder.WriteString("value=") - builder.WriteString(ali.Value) + builder.WriteString(_m.Value) builder.WriteString(", ") builder.WriteString("start_ip=") - builder.WriteString(fmt.Sprintf("%v", ali.StartIP)) + builder.WriteString(fmt.Sprintf("%v", _m.StartIP)) builder.WriteString(", ") builder.WriteString("end_ip=") - builder.WriteString(fmt.Sprintf("%v", ali.EndIP)) + builder.WriteString(fmt.Sprintf("%v", _m.EndIP)) builder.WriteString(", ") builder.WriteString("start_suffix=") - builder.WriteString(fmt.Sprintf("%v", ali.StartSuffix)) + builder.WriteString(fmt.Sprintf("%v", _m.StartSuffix)) builder.WriteString(", ") builder.WriteString("end_suffix=") - builder.WriteString(fmt.Sprintf("%v", ali.EndSuffix)) + builder.WriteString(fmt.Sprintf("%v", _m.EndSuffix)) builder.WriteString(", ") builder.WriteString("ip_size=") - builder.WriteString(fmt.Sprintf("%v", ali.IPSize)) + builder.WriteString(fmt.Sprintf("%v", _m.IPSize)) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/allowlistitem_create.go b/pkg/database/ent/allowlistitem_create.go index 1adc9d3d4..644119c50 100644 --- a/pkg/database/ent/allowlistitem_create.go +++ b/pkg/database/ent/allowlistitem_create.go @@ -24,166 +24,166 @@ type AllowListItemCreate struct { } // SetCreatedAt sets the "created_at" field. -func (alic *AllowListItemCreate) SetCreatedAt(t time.Time) *AllowListItemCreate { - alic.mutation.SetCreatedAt(t) - return alic +func (_c *AllowListItemCreate) SetCreatedAt(v time.Time) *AllowListItemCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableCreatedAt(t *time.Time) *AllowListItemCreate { - if t != nil { - alic.SetCreatedAt(*t) +func (_c *AllowListItemCreate) SetNillableCreatedAt(v *time.Time) *AllowListItemCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return alic + return _c } // SetUpdatedAt sets the "updated_at" field. -func (alic *AllowListItemCreate) SetUpdatedAt(t time.Time) *AllowListItemCreate { - alic.mutation.SetUpdatedAt(t) - return alic +func (_c *AllowListItemCreate) SetUpdatedAt(v time.Time) *AllowListItemCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableUpdatedAt(t *time.Time) *AllowListItemCreate { - if t != nil { - alic.SetUpdatedAt(*t) +func (_c *AllowListItemCreate) SetNillableUpdatedAt(v *time.Time) *AllowListItemCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return alic + return _c } // SetExpiresAt sets the "expires_at" field. -func (alic *AllowListItemCreate) SetExpiresAt(t time.Time) *AllowListItemCreate { - alic.mutation.SetExpiresAt(t) - return alic +func (_c *AllowListItemCreate) SetExpiresAt(v time.Time) *AllowListItemCreate { + _c.mutation.SetExpiresAt(v) + return _c } // SetNillableExpiresAt sets the "expires_at" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableExpiresAt(t *time.Time) *AllowListItemCreate { - if t != nil { - alic.SetExpiresAt(*t) +func (_c *AllowListItemCreate) SetNillableExpiresAt(v *time.Time) *AllowListItemCreate { + if v != nil { + _c.SetExpiresAt(*v) } - return alic + return _c } // SetComment sets the "comment" field. -func (alic *AllowListItemCreate) SetComment(s string) *AllowListItemCreate { - alic.mutation.SetComment(s) - return alic +func (_c *AllowListItemCreate) SetComment(v string) *AllowListItemCreate { + _c.mutation.SetComment(v) + return _c } // SetNillableComment sets the "comment" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableComment(s *string) *AllowListItemCreate { - if s != nil { - alic.SetComment(*s) +func (_c *AllowListItemCreate) SetNillableComment(v *string) *AllowListItemCreate { + if v != nil { + _c.SetComment(*v) } - return alic + return _c } // SetValue sets the "value" field. -func (alic *AllowListItemCreate) SetValue(s string) *AllowListItemCreate { - alic.mutation.SetValue(s) - return alic +func (_c *AllowListItemCreate) SetValue(v string) *AllowListItemCreate { + _c.mutation.SetValue(v) + return _c } // SetStartIP sets the "start_ip" field. -func (alic *AllowListItemCreate) SetStartIP(i int64) *AllowListItemCreate { - alic.mutation.SetStartIP(i) - return alic +func (_c *AllowListItemCreate) SetStartIP(v int64) *AllowListItemCreate { + _c.mutation.SetStartIP(v) + return _c } // SetNillableStartIP sets the "start_ip" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableStartIP(i *int64) *AllowListItemCreate { - if i != nil { - alic.SetStartIP(*i) +func (_c *AllowListItemCreate) SetNillableStartIP(v *int64) *AllowListItemCreate { + if v != nil { + _c.SetStartIP(*v) } - return alic + return _c } // SetEndIP sets the "end_ip" field. -func (alic *AllowListItemCreate) SetEndIP(i int64) *AllowListItemCreate { - alic.mutation.SetEndIP(i) - return alic +func (_c *AllowListItemCreate) SetEndIP(v int64) *AllowListItemCreate { + _c.mutation.SetEndIP(v) + return _c } // SetNillableEndIP sets the "end_ip" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableEndIP(i *int64) *AllowListItemCreate { - if i != nil { - alic.SetEndIP(*i) +func (_c *AllowListItemCreate) SetNillableEndIP(v *int64) *AllowListItemCreate { + if v != nil { + _c.SetEndIP(*v) } - return alic + return _c } // SetStartSuffix sets the "start_suffix" field. -func (alic *AllowListItemCreate) SetStartSuffix(i int64) *AllowListItemCreate { - alic.mutation.SetStartSuffix(i) - return alic +func (_c *AllowListItemCreate) SetStartSuffix(v int64) *AllowListItemCreate { + _c.mutation.SetStartSuffix(v) + return _c } // SetNillableStartSuffix sets the "start_suffix" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableStartSuffix(i *int64) *AllowListItemCreate { - if i != nil { - alic.SetStartSuffix(*i) +func (_c *AllowListItemCreate) SetNillableStartSuffix(v *int64) *AllowListItemCreate { + if v != nil { + _c.SetStartSuffix(*v) } - return alic + return _c } // SetEndSuffix sets the "end_suffix" field. -func (alic *AllowListItemCreate) SetEndSuffix(i int64) *AllowListItemCreate { - alic.mutation.SetEndSuffix(i) - return alic +func (_c *AllowListItemCreate) SetEndSuffix(v int64) *AllowListItemCreate { + _c.mutation.SetEndSuffix(v) + return _c } // SetNillableEndSuffix sets the "end_suffix" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableEndSuffix(i *int64) *AllowListItemCreate { - if i != nil { - alic.SetEndSuffix(*i) +func (_c *AllowListItemCreate) SetNillableEndSuffix(v *int64) *AllowListItemCreate { + if v != nil { + _c.SetEndSuffix(*v) } - return alic + return _c } // SetIPSize sets the "ip_size" field. -func (alic *AllowListItemCreate) SetIPSize(i int64) *AllowListItemCreate { - alic.mutation.SetIPSize(i) - return alic +func (_c *AllowListItemCreate) SetIPSize(v int64) *AllowListItemCreate { + _c.mutation.SetIPSize(v) + return _c } // SetNillableIPSize sets the "ip_size" field if the given value is not nil. -func (alic *AllowListItemCreate) SetNillableIPSize(i *int64) *AllowListItemCreate { - if i != nil { - alic.SetIPSize(*i) +func (_c *AllowListItemCreate) SetNillableIPSize(v *int64) *AllowListItemCreate { + if v != nil { + _c.SetIPSize(*v) } - return alic + return _c } // AddAllowlistIDs adds the "allowlist" edge to the AllowList entity by IDs. -func (alic *AllowListItemCreate) AddAllowlistIDs(ids ...int) *AllowListItemCreate { - alic.mutation.AddAllowlistIDs(ids...) - return alic +func (_c *AllowListItemCreate) AddAllowlistIDs(ids ...int) *AllowListItemCreate { + _c.mutation.AddAllowlistIDs(ids...) + return _c } // AddAllowlist adds the "allowlist" edges to the AllowList entity. -func (alic *AllowListItemCreate) AddAllowlist(a ...*AllowList) *AllowListItemCreate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_c *AllowListItemCreate) AddAllowlist(v ...*AllowList) *AllowListItemCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return alic.AddAllowlistIDs(ids...) + return _c.AddAllowlistIDs(ids...) } // Mutation returns the AllowListItemMutation object of the builder. -func (alic *AllowListItemCreate) Mutation() *AllowListItemMutation { - return alic.mutation +func (_c *AllowListItemCreate) Mutation() *AllowListItemMutation { + return _c.mutation } // Save creates the AllowListItem in the database. -func (alic *AllowListItemCreate) Save(ctx context.Context) (*AllowListItem, error) { - alic.defaults() - return withHooks(ctx, alic.sqlSave, alic.mutation, alic.hooks) +func (_c *AllowListItemCreate) Save(ctx context.Context) (*AllowListItem, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (alic *AllowListItemCreate) SaveX(ctx context.Context) *AllowListItem { - v, err := alic.Save(ctx) +func (_c *AllowListItemCreate) SaveX(ctx context.Context) *AllowListItem { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -191,50 +191,50 @@ func (alic *AllowListItemCreate) SaveX(ctx context.Context) *AllowListItem { } // Exec executes the query. -func (alic *AllowListItemCreate) Exec(ctx context.Context) error { - _, err := alic.Save(ctx) +func (_c *AllowListItemCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (alic *AllowListItemCreate) ExecX(ctx context.Context) { - if err := alic.Exec(ctx); err != nil { +func (_c *AllowListItemCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (alic *AllowListItemCreate) defaults() { - if _, ok := alic.mutation.CreatedAt(); !ok { +func (_c *AllowListItemCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := allowlistitem.DefaultCreatedAt() - alic.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := alic.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := allowlistitem.DefaultUpdatedAt() - alic.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (alic *AllowListItemCreate) check() error { - if _, ok := alic.mutation.CreatedAt(); !ok { +func (_c *AllowListItemCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "AllowListItem.created_at"`)} } - if _, ok := alic.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AllowListItem.updated_at"`)} } - if _, ok := alic.mutation.Value(); !ok { + if _, ok := _c.mutation.Value(); !ok { return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "AllowListItem.value"`)} } return nil } -func (alic *AllowListItemCreate) sqlSave(ctx context.Context) (*AllowListItem, error) { - if err := alic.check(); err != nil { +func (_c *AllowListItemCreate) sqlSave(ctx context.Context) (*AllowListItem, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := alic.createSpec() - if err := sqlgraph.CreateNode(ctx, alic.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -242,58 +242,58 @@ func (alic *AllowListItemCreate) sqlSave(ctx context.Context) (*AllowListItem, e } id := _spec.ID.Value.(int64) _node.ID = int(id) - alic.mutation.id = &_node.ID - alic.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (alic *AllowListItemCreate) createSpec() (*AllowListItem, *sqlgraph.CreateSpec) { +func (_c *AllowListItemCreate) createSpec() (*AllowListItem, *sqlgraph.CreateSpec) { var ( - _node = &AllowListItem{config: alic.config} + _node = &AllowListItem{config: _c.config} _spec = sqlgraph.NewCreateSpec(allowlistitem.Table, sqlgraph.NewFieldSpec(allowlistitem.FieldID, field.TypeInt)) ) - _spec.OnConflict = alic.conflict - if value, ok := alic.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(allowlistitem.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := alic.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(allowlistitem.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := alic.mutation.ExpiresAt(); ok { + if value, ok := _c.mutation.ExpiresAt(); ok { _spec.SetField(allowlistitem.FieldExpiresAt, field.TypeTime, value) _node.ExpiresAt = value } - if value, ok := alic.mutation.Comment(); ok { + if value, ok := _c.mutation.Comment(); ok { _spec.SetField(allowlistitem.FieldComment, field.TypeString, value) _node.Comment = value } - if value, ok := alic.mutation.Value(); ok { + if value, ok := _c.mutation.Value(); ok { _spec.SetField(allowlistitem.FieldValue, field.TypeString, value) _node.Value = value } - if value, ok := alic.mutation.StartIP(); ok { + if value, ok := _c.mutation.StartIP(); ok { _spec.SetField(allowlistitem.FieldStartIP, field.TypeInt64, value) _node.StartIP = value } - if value, ok := alic.mutation.EndIP(); ok { + if value, ok := _c.mutation.EndIP(); ok { _spec.SetField(allowlistitem.FieldEndIP, field.TypeInt64, value) _node.EndIP = value } - if value, ok := alic.mutation.StartSuffix(); ok { + if value, ok := _c.mutation.StartSuffix(); ok { _spec.SetField(allowlistitem.FieldStartSuffix, field.TypeInt64, value) _node.StartSuffix = value } - if value, ok := alic.mutation.EndSuffix(); ok { + if value, ok := _c.mutation.EndSuffix(); ok { _spec.SetField(allowlistitem.FieldEndSuffix, field.TypeInt64, value) _node.EndSuffix = value } - if value, ok := alic.mutation.IPSize(); ok { + if value, ok := _c.mutation.IPSize(); ok { _spec.SetField(allowlistitem.FieldIPSize, field.TypeInt64, value) _node.IPSize = value } - if nodes := alic.mutation.AllowlistIDs(); len(nodes) > 0 { + if nodes := _c.mutation.AllowlistIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, @@ -328,10 +328,10 @@ func (alic *AllowListItemCreate) createSpec() (*AllowListItem, *sqlgraph.CreateS // SetCreatedAt(v+v). // }). // Exec(ctx) -func (alic *AllowListItemCreate) OnConflict(opts ...sql.ConflictOption) *AllowListItemUpsertOne { - alic.conflict = opts +func (_c *AllowListItemCreate) OnConflict(opts ...sql.ConflictOption) *AllowListItemUpsertOne { + _c.conflict = opts return &AllowListItemUpsertOne{ - create: alic, + create: _c, } } @@ -341,10 +341,10 @@ func (alic *AllowListItemCreate) OnConflict(opts ...sql.ConflictOption) *AllowLi // client.AllowListItem.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (alic *AllowListItemCreate) OnConflictColumns(columns ...string) *AllowListItemUpsertOne { - alic.conflict = append(alic.conflict, sql.ConflictColumns(columns...)) +func (_c *AllowListItemCreate) OnConflictColumns(columns ...string) *AllowListItemUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AllowListItemUpsertOne{ - create: alic, + create: _c, } } @@ -534,16 +534,16 @@ type AllowListItemCreateBulk struct { } // Save creates the AllowListItem entities in the database. -func (alicb *AllowListItemCreateBulk) Save(ctx context.Context) ([]*AllowListItem, error) { - if alicb.err != nil { - return nil, alicb.err +func (_c *AllowListItemCreateBulk) Save(ctx context.Context) ([]*AllowListItem, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(alicb.builders)) - nodes := make([]*AllowListItem, len(alicb.builders)) - mutators := make([]Mutator, len(alicb.builders)) - for i := range alicb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*AllowListItem, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := alicb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*AllowListItemMutation) @@ -557,12 +557,12 @@ func (alicb *AllowListItemCreateBulk) Save(ctx context.Context) ([]*AllowListIte var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, alicb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = alicb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, alicb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -586,7 +586,7 @@ func (alicb *AllowListItemCreateBulk) Save(ctx context.Context) ([]*AllowListIte }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, alicb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -594,8 +594,8 @@ func (alicb *AllowListItemCreateBulk) Save(ctx context.Context) ([]*AllowListIte } // SaveX is like Save, but panics if an error occurs. -func (alicb *AllowListItemCreateBulk) SaveX(ctx context.Context) []*AllowListItem { - v, err := alicb.Save(ctx) +func (_c *AllowListItemCreateBulk) SaveX(ctx context.Context) []*AllowListItem { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -603,14 +603,14 @@ func (alicb *AllowListItemCreateBulk) SaveX(ctx context.Context) []*AllowListIte } // Exec executes the query. -func (alicb *AllowListItemCreateBulk) Exec(ctx context.Context) error { - _, err := alicb.Save(ctx) +func (_c *AllowListItemCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (alicb *AllowListItemCreateBulk) ExecX(ctx context.Context) { - if err := alicb.Exec(ctx); err != nil { +func (_c *AllowListItemCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -630,10 +630,10 @@ func (alicb *AllowListItemCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (alicb *AllowListItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *AllowListItemUpsertBulk { - alicb.conflict = opts +func (_c *AllowListItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *AllowListItemUpsertBulk { + _c.conflict = opts return &AllowListItemUpsertBulk{ - create: alicb, + create: _c, } } @@ -643,10 +643,10 @@ func (alicb *AllowListItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *Al // client.AllowListItem.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (alicb *AllowListItemCreateBulk) OnConflictColumns(columns ...string) *AllowListItemUpsertBulk { - alicb.conflict = append(alicb.conflict, sql.ConflictColumns(columns...)) +func (_c *AllowListItemCreateBulk) OnConflictColumns(columns ...string) *AllowListItemUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &AllowListItemUpsertBulk{ - create: alicb, + create: _c, } } diff --git a/pkg/database/ent/allowlistitem_delete.go b/pkg/database/ent/allowlistitem_delete.go index 87b340012..377012622 100644 --- a/pkg/database/ent/allowlistitem_delete.go +++ b/pkg/database/ent/allowlistitem_delete.go @@ -20,56 +20,56 @@ type AllowListItemDelete struct { } // Where appends a list predicates to the AllowListItemDelete builder. -func (alid *AllowListItemDelete) Where(ps ...predicate.AllowListItem) *AllowListItemDelete { - alid.mutation.Where(ps...) - return alid +func (_d *AllowListItemDelete) Where(ps ...predicate.AllowListItem) *AllowListItemDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (alid *AllowListItemDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, alid.sqlExec, alid.mutation, alid.hooks) +func (_d *AllowListItemDelete) 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 (alid *AllowListItemDelete) ExecX(ctx context.Context) int { - n, err := alid.Exec(ctx) +func (_d *AllowListItemDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (alid *AllowListItemDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *AllowListItemDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(allowlistitem.Table, sqlgraph.NewFieldSpec(allowlistitem.FieldID, field.TypeInt)) - if ps := alid.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, alid.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - alid.mutation.done = true + _d.mutation.done = true return affected, err } // AllowListItemDeleteOne is the builder for deleting a single AllowListItem entity. type AllowListItemDeleteOne struct { - alid *AllowListItemDelete + _d *AllowListItemDelete } // Where appends a list predicates to the AllowListItemDelete builder. -func (alido *AllowListItemDeleteOne) Where(ps ...predicate.AllowListItem) *AllowListItemDeleteOne { - alido.alid.mutation.Where(ps...) - return alido +func (_d *AllowListItemDeleteOne) Where(ps ...predicate.AllowListItem) *AllowListItemDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (alido *AllowListItemDeleteOne) Exec(ctx context.Context) error { - n, err := alido.alid.Exec(ctx) +func (_d *AllowListItemDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (alido *AllowListItemDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (alido *AllowListItemDeleteOne) ExecX(ctx context.Context) { - if err := alido.Exec(ctx); err != nil { +func (_d *AllowListItemDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/allowlistitem_query.go b/pkg/database/ent/allowlistitem_query.go index 4dccd30fa..e7fc849fb 100644 --- a/pkg/database/ent/allowlistitem_query.go +++ b/pkg/database/ent/allowlistitem_query.go @@ -31,44 +31,44 @@ type AllowListItemQuery struct { } // Where adds a new predicate for the AllowListItemQuery builder. -func (aliq *AllowListItemQuery) Where(ps ...predicate.AllowListItem) *AllowListItemQuery { - aliq.predicates = append(aliq.predicates, ps...) - return aliq +func (_q *AllowListItemQuery) Where(ps ...predicate.AllowListItem) *AllowListItemQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (aliq *AllowListItemQuery) Limit(limit int) *AllowListItemQuery { - aliq.ctx.Limit = &limit - return aliq +func (_q *AllowListItemQuery) Limit(limit int) *AllowListItemQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (aliq *AllowListItemQuery) Offset(offset int) *AllowListItemQuery { - aliq.ctx.Offset = &offset - return aliq +func (_q *AllowListItemQuery) Offset(offset int) *AllowListItemQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (aliq *AllowListItemQuery) Unique(unique bool) *AllowListItemQuery { - aliq.ctx.Unique = &unique - return aliq +func (_q *AllowListItemQuery) Unique(unique bool) *AllowListItemQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (aliq *AllowListItemQuery) Order(o ...allowlistitem.OrderOption) *AllowListItemQuery { - aliq.order = append(aliq.order, o...) - return aliq +func (_q *AllowListItemQuery) Order(o ...allowlistitem.OrderOption) *AllowListItemQuery { + _q.order = append(_q.order, o...) + return _q } // QueryAllowlist chains the current query on the "allowlist" edge. -func (aliq *AllowListItemQuery) QueryAllowlist() *AllowListQuery { - query := (&AllowListClient{config: aliq.config}).Query() +func (_q *AllowListItemQuery) QueryAllowlist() *AllowListQuery { + query := (&AllowListClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := aliq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := aliq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -77,7 +77,7 @@ func (aliq *AllowListItemQuery) QueryAllowlist() *AllowListQuery { sqlgraph.To(allowlist.Table, allowlist.FieldID), sqlgraph.Edge(sqlgraph.M2M, true, allowlistitem.AllowlistTable, allowlistitem.AllowlistPrimaryKey...), ) - fromU = sqlgraph.SetNeighbors(aliq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query @@ -85,8 +85,8 @@ func (aliq *AllowListItemQuery) QueryAllowlist() *AllowListQuery { // First returns the first AllowListItem entity from the query. // Returns a *NotFoundError when no AllowListItem was found. -func (aliq *AllowListItemQuery) First(ctx context.Context) (*AllowListItem, error) { - nodes, err := aliq.Limit(1).All(setContextOp(ctx, aliq.ctx, ent.OpQueryFirst)) +func (_q *AllowListItemQuery) First(ctx context.Context) (*AllowListItem, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -97,8 +97,8 @@ func (aliq *AllowListItemQuery) First(ctx context.Context) (*AllowListItem, erro } // FirstX is like First, but panics if an error occurs. -func (aliq *AllowListItemQuery) FirstX(ctx context.Context) *AllowListItem { - node, err := aliq.First(ctx) +func (_q *AllowListItemQuery) FirstX(ctx context.Context) *AllowListItem { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -107,9 +107,9 @@ func (aliq *AllowListItemQuery) FirstX(ctx context.Context) *AllowListItem { // FirstID returns the first AllowListItem ID from the query. // Returns a *NotFoundError when no AllowListItem ID was found. -func (aliq *AllowListItemQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *AllowListItemQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = aliq.Limit(1).IDs(setContextOp(ctx, aliq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -120,8 +120,8 @@ func (aliq *AllowListItemQuery) FirstID(ctx context.Context) (id int, err error) } // FirstIDX is like FirstID, but panics if an error occurs. -func (aliq *AllowListItemQuery) FirstIDX(ctx context.Context) int { - id, err := aliq.FirstID(ctx) +func (_q *AllowListItemQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -131,8 +131,8 @@ func (aliq *AllowListItemQuery) FirstIDX(ctx context.Context) int { // Only returns a single AllowListItem entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one AllowListItem entity is found. // Returns a *NotFoundError when no AllowListItem entities are found. -func (aliq *AllowListItemQuery) Only(ctx context.Context) (*AllowListItem, error) { - nodes, err := aliq.Limit(2).All(setContextOp(ctx, aliq.ctx, ent.OpQueryOnly)) +func (_q *AllowListItemQuery) Only(ctx context.Context) (*AllowListItem, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -147,8 +147,8 @@ func (aliq *AllowListItemQuery) Only(ctx context.Context) (*AllowListItem, error } // OnlyX is like Only, but panics if an error occurs. -func (aliq *AllowListItemQuery) OnlyX(ctx context.Context) *AllowListItem { - node, err := aliq.Only(ctx) +func (_q *AllowListItemQuery) OnlyX(ctx context.Context) *AllowListItem { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -158,9 +158,9 @@ func (aliq *AllowListItemQuery) OnlyX(ctx context.Context) *AllowListItem { // OnlyID is like Only, but returns the only AllowListItem ID in the query. // Returns a *NotSingularError when more than one AllowListItem ID is found. // Returns a *NotFoundError when no entities are found. -func (aliq *AllowListItemQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *AllowListItemQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = aliq.Limit(2).IDs(setContextOp(ctx, aliq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -175,8 +175,8 @@ func (aliq *AllowListItemQuery) OnlyID(ctx context.Context) (id int, err error) } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (aliq *AllowListItemQuery) OnlyIDX(ctx context.Context) int { - id, err := aliq.OnlyID(ctx) +func (_q *AllowListItemQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -184,18 +184,18 @@ func (aliq *AllowListItemQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of AllowListItems. -func (aliq *AllowListItemQuery) All(ctx context.Context) ([]*AllowListItem, error) { - ctx = setContextOp(ctx, aliq.ctx, ent.OpQueryAll) - if err := aliq.prepareQuery(ctx); err != nil { +func (_q *AllowListItemQuery) All(ctx context.Context) ([]*AllowListItem, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*AllowListItem, *AllowListItemQuery]() - return withInterceptors[[]*AllowListItem](ctx, aliq, qr, aliq.inters) + return withInterceptors[[]*AllowListItem](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (aliq *AllowListItemQuery) AllX(ctx context.Context) []*AllowListItem { - nodes, err := aliq.All(ctx) +func (_q *AllowListItemQuery) AllX(ctx context.Context) []*AllowListItem { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -203,20 +203,20 @@ func (aliq *AllowListItemQuery) AllX(ctx context.Context) []*AllowListItem { } // IDs executes the query and returns a list of AllowListItem IDs. -func (aliq *AllowListItemQuery) IDs(ctx context.Context) (ids []int, err error) { - if aliq.ctx.Unique == nil && aliq.path != nil { - aliq.Unique(true) +func (_q *AllowListItemQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, aliq.ctx, ent.OpQueryIDs) - if err = aliq.Select(allowlistitem.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(allowlistitem.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (aliq *AllowListItemQuery) IDsX(ctx context.Context) []int { - ids, err := aliq.IDs(ctx) +func (_q *AllowListItemQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -224,17 +224,17 @@ func (aliq *AllowListItemQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (aliq *AllowListItemQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, aliq.ctx, ent.OpQueryCount) - if err := aliq.prepareQuery(ctx); err != nil { +func (_q *AllowListItemQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, aliq, querierCount[*AllowListItemQuery](), aliq.inters) + return withInterceptors[int](ctx, _q, querierCount[*AllowListItemQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (aliq *AllowListItemQuery) CountX(ctx context.Context) int { - count, err := aliq.Count(ctx) +func (_q *AllowListItemQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -242,9 +242,9 @@ func (aliq *AllowListItemQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (aliq *AllowListItemQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, aliq.ctx, ent.OpQueryExist) - switch _, err := aliq.FirstID(ctx); { +func (_q *AllowListItemQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -255,8 +255,8 @@ func (aliq *AllowListItemQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (aliq *AllowListItemQuery) ExistX(ctx context.Context) bool { - exist, err := aliq.Exist(ctx) +func (_q *AllowListItemQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -265,32 +265,32 @@ func (aliq *AllowListItemQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the AllowListItemQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (aliq *AllowListItemQuery) Clone() *AllowListItemQuery { - if aliq == nil { +func (_q *AllowListItemQuery) Clone() *AllowListItemQuery { + if _q == nil { return nil } return &AllowListItemQuery{ - config: aliq.config, - ctx: aliq.ctx.Clone(), - order: append([]allowlistitem.OrderOption{}, aliq.order...), - inters: append([]Interceptor{}, aliq.inters...), - predicates: append([]predicate.AllowListItem{}, aliq.predicates...), - withAllowlist: aliq.withAllowlist.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]allowlistitem.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.AllowListItem{}, _q.predicates...), + withAllowlist: _q.withAllowlist.Clone(), // clone intermediate query. - sql: aliq.sql.Clone(), - path: aliq.path, + sql: _q.sql.Clone(), + path: _q.path, } } // WithAllowlist tells the query-builder to eager-load the nodes that are connected to // the "allowlist" edge. The optional arguments are used to configure the query builder of the edge. -func (aliq *AllowListItemQuery) WithAllowlist(opts ...func(*AllowListQuery)) *AllowListItemQuery { - query := (&AllowListClient{config: aliq.config}).Query() +func (_q *AllowListItemQuery) WithAllowlist(opts ...func(*AllowListQuery)) *AllowListItemQuery { + query := (&AllowListClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - aliq.withAllowlist = query - return aliq + _q.withAllowlist = query + return _q } // GroupBy is used to group vertices by one or more fields/columns. @@ -307,10 +307,10 @@ func (aliq *AllowListItemQuery) WithAllowlist(opts ...func(*AllowListQuery)) *Al // GroupBy(allowlistitem.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (aliq *AllowListItemQuery) GroupBy(field string, fields ...string) *AllowListItemGroupBy { - aliq.ctx.Fields = append([]string{field}, fields...) - grbuild := &AllowListItemGroupBy{build: aliq} - grbuild.flds = &aliq.ctx.Fields +func (_q *AllowListItemQuery) GroupBy(field string, fields ...string) *AllowListItemGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &AllowListItemGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = allowlistitem.Label grbuild.scan = grbuild.Scan return grbuild @@ -328,58 +328,58 @@ func (aliq *AllowListItemQuery) GroupBy(field string, fields ...string) *AllowLi // client.AllowListItem.Query(). // Select(allowlistitem.FieldCreatedAt). // Scan(ctx, &v) -func (aliq *AllowListItemQuery) Select(fields ...string) *AllowListItemSelect { - aliq.ctx.Fields = append(aliq.ctx.Fields, fields...) - sbuild := &AllowListItemSelect{AllowListItemQuery: aliq} +func (_q *AllowListItemQuery) Select(fields ...string) *AllowListItemSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &AllowListItemSelect{AllowListItemQuery: _q} sbuild.label = allowlistitem.Label - sbuild.flds, sbuild.scan = &aliq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a AllowListItemSelect configured with the given aggregations. -func (aliq *AllowListItemQuery) Aggregate(fns ...AggregateFunc) *AllowListItemSelect { - return aliq.Select().Aggregate(fns...) +func (_q *AllowListItemQuery) Aggregate(fns ...AggregateFunc) *AllowListItemSelect { + return _q.Select().Aggregate(fns...) } -func (aliq *AllowListItemQuery) prepareQuery(ctx context.Context) error { - for _, inter := range aliq.inters { +func (_q *AllowListItemQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, aliq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range aliq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !allowlistitem.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if aliq.path != nil { - prev, err := aliq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - aliq.sql = prev + _q.sql = prev } return nil } -func (aliq *AllowListItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AllowListItem, error) { +func (_q *AllowListItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*AllowListItem, error) { var ( nodes = []*AllowListItem{} - _spec = aliq.querySpec() + _spec = _q.querySpec() loadedTypes = [1]bool{ - aliq.withAllowlist != nil, + _q.withAllowlist != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*AllowListItem).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &AllowListItem{config: aliq.config} + node := &AllowListItem{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) @@ -387,14 +387,14 @@ func (aliq *AllowListItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, aliq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := aliq.withAllowlist; query != nil { - if err := aliq.loadAllowlist(ctx, query, nodes, + if query := _q.withAllowlist; query != nil { + if err := _q.loadAllowlist(ctx, query, nodes, func(n *AllowListItem) { n.Edges.Allowlist = []*AllowList{} }, func(n *AllowListItem, e *AllowList) { n.Edges.Allowlist = append(n.Edges.Allowlist, e) }); err != nil { return nil, err @@ -403,7 +403,7 @@ func (aliq *AllowListItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) return nodes, nil } -func (aliq *AllowListItemQuery) loadAllowlist(ctx context.Context, query *AllowListQuery, nodes []*AllowListItem, init func(*AllowListItem), assign func(*AllowListItem, *AllowList)) error { +func (_q *AllowListItemQuery) loadAllowlist(ctx context.Context, query *AllowListQuery, nodes []*AllowListItem, init func(*AllowListItem), assign func(*AllowListItem, *AllowList)) error { edgeIDs := make([]driver.Value, len(nodes)) byID := make(map[int]*AllowListItem) nids := make(map[int]map[*AllowListItem]struct{}) @@ -465,24 +465,24 @@ func (aliq *AllowListItemQuery) loadAllowlist(ctx context.Context, query *AllowL return nil } -func (aliq *AllowListItemQuery) sqlCount(ctx context.Context) (int, error) { - _spec := aliq.querySpec() - _spec.Node.Columns = aliq.ctx.Fields - if len(aliq.ctx.Fields) > 0 { - _spec.Unique = aliq.ctx.Unique != nil && *aliq.ctx.Unique +func (_q *AllowListItemQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, aliq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (aliq *AllowListItemQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *AllowListItemQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(allowlistitem.Table, allowlistitem.Columns, sqlgraph.NewFieldSpec(allowlistitem.FieldID, field.TypeInt)) - _spec.From = aliq.sql - if unique := aliq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if aliq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := aliq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, allowlistitem.FieldID) for i := range fields { @@ -491,20 +491,20 @@ func (aliq *AllowListItemQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := aliq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := aliq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := aliq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := aliq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -514,33 +514,33 @@ func (aliq *AllowListItemQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (aliq *AllowListItemQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(aliq.driver.Dialect()) +func (_q *AllowListItemQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(allowlistitem.Table) - columns := aliq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = allowlistitem.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if aliq.sql != nil { - selector = aliq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if aliq.ctx.Unique != nil && *aliq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range aliq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range aliq.order { + for _, p := range _q.order { p(selector) } - if offset := aliq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := aliq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -553,41 +553,41 @@ type AllowListItemGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (aligb *AllowListItemGroupBy) Aggregate(fns ...AggregateFunc) *AllowListItemGroupBy { - aligb.fns = append(aligb.fns, fns...) - return aligb +func (_g *AllowListItemGroupBy) Aggregate(fns ...AggregateFunc) *AllowListItemGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (aligb *AllowListItemGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, aligb.build.ctx, ent.OpQueryGroupBy) - if err := aligb.build.prepareQuery(ctx); err != nil { +func (_g *AllowListItemGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AllowListItemQuery, *AllowListItemGroupBy](ctx, aligb.build, aligb, aligb.build.inters, v) + return scanWithInterceptors[*AllowListItemQuery, *AllowListItemGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (aligb *AllowListItemGroupBy) sqlScan(ctx context.Context, root *AllowListItemQuery, v any) error { +func (_g *AllowListItemGroupBy) sqlScan(ctx context.Context, root *AllowListItemQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(aligb.fns)) - for _, fn := range aligb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*aligb.flds)+len(aligb.fns)) - for _, f := range *aligb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*aligb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := aligb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -601,27 +601,27 @@ type AllowListItemSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (alis *AllowListItemSelect) Aggregate(fns ...AggregateFunc) *AllowListItemSelect { - alis.fns = append(alis.fns, fns...) - return alis +func (_s *AllowListItemSelect) Aggregate(fns ...AggregateFunc) *AllowListItemSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (alis *AllowListItemSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, alis.ctx, ent.OpQuerySelect) - if err := alis.prepareQuery(ctx); err != nil { +func (_s *AllowListItemSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AllowListItemQuery, *AllowListItemSelect](ctx, alis.AllowListItemQuery, alis, alis.inters, v) + return scanWithInterceptors[*AllowListItemQuery, *AllowListItemSelect](ctx, _s.AllowListItemQuery, _s, _s.inters, v) } -func (alis *AllowListItemSelect) sqlScan(ctx context.Context, root *AllowListItemQuery, v any) error { +func (_s *AllowListItemSelect) sqlScan(ctx context.Context, root *AllowListItemQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(alis.fns)) - for _, fn := range alis.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*alis.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -629,7 +629,7 @@ func (alis *AllowListItemSelect) sqlScan(ctx context.Context, root *AllowListIte } rows := &sql.Rows{} query, args := selector.Query() - if err := alis.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/allowlistitem_update.go b/pkg/database/ent/allowlistitem_update.go index e6878955a..98086db22 100644 --- a/pkg/database/ent/allowlistitem_update.go +++ b/pkg/database/ent/allowlistitem_update.go @@ -24,87 +24,87 @@ type AllowListItemUpdate struct { } // Where appends a list predicates to the AllowListItemUpdate builder. -func (aliu *AllowListItemUpdate) Where(ps ...predicate.AllowListItem) *AllowListItemUpdate { - aliu.mutation.Where(ps...) - return aliu +func (_u *AllowListItemUpdate) Where(ps ...predicate.AllowListItem) *AllowListItemUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (aliu *AllowListItemUpdate) SetUpdatedAt(t time.Time) *AllowListItemUpdate { - aliu.mutation.SetUpdatedAt(t) - return aliu +func (_u *AllowListItemUpdate) SetUpdatedAt(v time.Time) *AllowListItemUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetExpiresAt sets the "expires_at" field. -func (aliu *AllowListItemUpdate) SetExpiresAt(t time.Time) *AllowListItemUpdate { - aliu.mutation.SetExpiresAt(t) - return aliu +func (_u *AllowListItemUpdate) SetExpiresAt(v time.Time) *AllowListItemUpdate { + _u.mutation.SetExpiresAt(v) + return _u } // SetNillableExpiresAt sets the "expires_at" field if the given value is not nil. -func (aliu *AllowListItemUpdate) SetNillableExpiresAt(t *time.Time) *AllowListItemUpdate { - if t != nil { - aliu.SetExpiresAt(*t) +func (_u *AllowListItemUpdate) SetNillableExpiresAt(v *time.Time) *AllowListItemUpdate { + if v != nil { + _u.SetExpiresAt(*v) } - return aliu + return _u } // ClearExpiresAt clears the value of the "expires_at" field. -func (aliu *AllowListItemUpdate) ClearExpiresAt() *AllowListItemUpdate { - aliu.mutation.ClearExpiresAt() - return aliu +func (_u *AllowListItemUpdate) ClearExpiresAt() *AllowListItemUpdate { + _u.mutation.ClearExpiresAt() + return _u } // AddAllowlistIDs adds the "allowlist" edge to the AllowList entity by IDs. -func (aliu *AllowListItemUpdate) AddAllowlistIDs(ids ...int) *AllowListItemUpdate { - aliu.mutation.AddAllowlistIDs(ids...) - return aliu +func (_u *AllowListItemUpdate) AddAllowlistIDs(ids ...int) *AllowListItemUpdate { + _u.mutation.AddAllowlistIDs(ids...) + return _u } // AddAllowlist adds the "allowlist" edges to the AllowList entity. -func (aliu *AllowListItemUpdate) AddAllowlist(a ...*AllowList) *AllowListItemUpdate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListItemUpdate) AddAllowlist(v ...*AllowList) *AllowListItemUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return aliu.AddAllowlistIDs(ids...) + return _u.AddAllowlistIDs(ids...) } // Mutation returns the AllowListItemMutation object of the builder. -func (aliu *AllowListItemUpdate) Mutation() *AllowListItemMutation { - return aliu.mutation +func (_u *AllowListItemUpdate) Mutation() *AllowListItemMutation { + return _u.mutation } // ClearAllowlist clears all "allowlist" edges to the AllowList entity. -func (aliu *AllowListItemUpdate) ClearAllowlist() *AllowListItemUpdate { - aliu.mutation.ClearAllowlist() - return aliu +func (_u *AllowListItemUpdate) ClearAllowlist() *AllowListItemUpdate { + _u.mutation.ClearAllowlist() + return _u } // RemoveAllowlistIDs removes the "allowlist" edge to AllowList entities by IDs. -func (aliu *AllowListItemUpdate) RemoveAllowlistIDs(ids ...int) *AllowListItemUpdate { - aliu.mutation.RemoveAllowlistIDs(ids...) - return aliu +func (_u *AllowListItemUpdate) RemoveAllowlistIDs(ids ...int) *AllowListItemUpdate { + _u.mutation.RemoveAllowlistIDs(ids...) + return _u } // RemoveAllowlist removes "allowlist" edges to AllowList entities. -func (aliu *AllowListItemUpdate) RemoveAllowlist(a ...*AllowList) *AllowListItemUpdate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListItemUpdate) RemoveAllowlist(v ...*AllowList) *AllowListItemUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return aliu.RemoveAllowlistIDs(ids...) + return _u.RemoveAllowlistIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. -func (aliu *AllowListItemUpdate) Save(ctx context.Context) (int, error) { - aliu.defaults() - return withHooks(ctx, aliu.sqlSave, aliu.mutation, aliu.hooks) +func (_u *AllowListItemUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (aliu *AllowListItemUpdate) SaveX(ctx context.Context) int { - affected, err := aliu.Save(ctx) +func (_u *AllowListItemUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -112,63 +112,63 @@ func (aliu *AllowListItemUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (aliu *AllowListItemUpdate) Exec(ctx context.Context) error { - _, err := aliu.Save(ctx) +func (_u *AllowListItemUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (aliu *AllowListItemUpdate) ExecX(ctx context.Context) { - if err := aliu.Exec(ctx); err != nil { +func (_u *AllowListItemUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (aliu *AllowListItemUpdate) defaults() { - if _, ok := aliu.mutation.UpdatedAt(); !ok { +func (_u *AllowListItemUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := allowlistitem.UpdateDefaultUpdatedAt() - aliu.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (aliu *AllowListItemUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *AllowListItemUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(allowlistitem.Table, allowlistitem.Columns, sqlgraph.NewFieldSpec(allowlistitem.FieldID, field.TypeInt)) - if ps := aliu.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 := aliu.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(allowlistitem.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := aliu.mutation.ExpiresAt(); ok { + if value, ok := _u.mutation.ExpiresAt(); ok { _spec.SetField(allowlistitem.FieldExpiresAt, field.TypeTime, value) } - if aliu.mutation.ExpiresAtCleared() { + if _u.mutation.ExpiresAtCleared() { _spec.ClearField(allowlistitem.FieldExpiresAt, field.TypeTime) } - if aliu.mutation.CommentCleared() { + if _u.mutation.CommentCleared() { _spec.ClearField(allowlistitem.FieldComment, field.TypeString) } - if aliu.mutation.StartIPCleared() { + if _u.mutation.StartIPCleared() { _spec.ClearField(allowlistitem.FieldStartIP, field.TypeInt64) } - if aliu.mutation.EndIPCleared() { + if _u.mutation.EndIPCleared() { _spec.ClearField(allowlistitem.FieldEndIP, field.TypeInt64) } - if aliu.mutation.StartSuffixCleared() { + if _u.mutation.StartSuffixCleared() { _spec.ClearField(allowlistitem.FieldStartSuffix, field.TypeInt64) } - if aliu.mutation.EndSuffixCleared() { + if _u.mutation.EndSuffixCleared() { _spec.ClearField(allowlistitem.FieldEndSuffix, field.TypeInt64) } - if aliu.mutation.IPSizeCleared() { + if _u.mutation.IPSizeCleared() { _spec.ClearField(allowlistitem.FieldIPSize, field.TypeInt64) } - if aliu.mutation.AllowlistCleared() { + if _u.mutation.AllowlistCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, @@ -181,7 +181,7 @@ func (aliu *AllowListItemUpdate) sqlSave(ctx context.Context) (n int, err error) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := aliu.mutation.RemovedAllowlistIDs(); len(nodes) > 0 && !aliu.mutation.AllowlistCleared() { + if nodes := _u.mutation.RemovedAllowlistIDs(); len(nodes) > 0 && !_u.mutation.AllowlistCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, @@ -197,7 +197,7 @@ func (aliu *AllowListItemUpdate) sqlSave(ctx context.Context) (n int, err error) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := aliu.mutation.AllowlistIDs(); len(nodes) > 0 { + if nodes := _u.mutation.AllowlistIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, @@ -213,7 +213,7 @@ func (aliu *AllowListItemUpdate) sqlSave(ctx context.Context) (n int, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if n, err = sqlgraph.UpdateNodes(ctx, aliu.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{allowlistitem.Label} } else if sqlgraph.IsConstraintError(err) { @@ -221,8 +221,8 @@ func (aliu *AllowListItemUpdate) sqlSave(ctx context.Context) (n int, err error) } return 0, err } - aliu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // AllowListItemUpdateOne is the builder for updating a single AllowListItem entity. @@ -234,94 +234,94 @@ type AllowListItemUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (aliuo *AllowListItemUpdateOne) SetUpdatedAt(t time.Time) *AllowListItemUpdateOne { - aliuo.mutation.SetUpdatedAt(t) - return aliuo +func (_u *AllowListItemUpdateOne) SetUpdatedAt(v time.Time) *AllowListItemUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetExpiresAt sets the "expires_at" field. -func (aliuo *AllowListItemUpdateOne) SetExpiresAt(t time.Time) *AllowListItemUpdateOne { - aliuo.mutation.SetExpiresAt(t) - return aliuo +func (_u *AllowListItemUpdateOne) SetExpiresAt(v time.Time) *AllowListItemUpdateOne { + _u.mutation.SetExpiresAt(v) + return _u } // SetNillableExpiresAt sets the "expires_at" field if the given value is not nil. -func (aliuo *AllowListItemUpdateOne) SetNillableExpiresAt(t *time.Time) *AllowListItemUpdateOne { - if t != nil { - aliuo.SetExpiresAt(*t) +func (_u *AllowListItemUpdateOne) SetNillableExpiresAt(v *time.Time) *AllowListItemUpdateOne { + if v != nil { + _u.SetExpiresAt(*v) } - return aliuo + return _u } // ClearExpiresAt clears the value of the "expires_at" field. -func (aliuo *AllowListItemUpdateOne) ClearExpiresAt() *AllowListItemUpdateOne { - aliuo.mutation.ClearExpiresAt() - return aliuo +func (_u *AllowListItemUpdateOne) ClearExpiresAt() *AllowListItemUpdateOne { + _u.mutation.ClearExpiresAt() + return _u } // AddAllowlistIDs adds the "allowlist" edge to the AllowList entity by IDs. -func (aliuo *AllowListItemUpdateOne) AddAllowlistIDs(ids ...int) *AllowListItemUpdateOne { - aliuo.mutation.AddAllowlistIDs(ids...) - return aliuo +func (_u *AllowListItemUpdateOne) AddAllowlistIDs(ids ...int) *AllowListItemUpdateOne { + _u.mutation.AddAllowlistIDs(ids...) + return _u } // AddAllowlist adds the "allowlist" edges to the AllowList entity. -func (aliuo *AllowListItemUpdateOne) AddAllowlist(a ...*AllowList) *AllowListItemUpdateOne { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListItemUpdateOne) AddAllowlist(v ...*AllowList) *AllowListItemUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return aliuo.AddAllowlistIDs(ids...) + return _u.AddAllowlistIDs(ids...) } // Mutation returns the AllowListItemMutation object of the builder. -func (aliuo *AllowListItemUpdateOne) Mutation() *AllowListItemMutation { - return aliuo.mutation +func (_u *AllowListItemUpdateOne) Mutation() *AllowListItemMutation { + return _u.mutation } // ClearAllowlist clears all "allowlist" edges to the AllowList entity. -func (aliuo *AllowListItemUpdateOne) ClearAllowlist() *AllowListItemUpdateOne { - aliuo.mutation.ClearAllowlist() - return aliuo +func (_u *AllowListItemUpdateOne) ClearAllowlist() *AllowListItemUpdateOne { + _u.mutation.ClearAllowlist() + return _u } // RemoveAllowlistIDs removes the "allowlist" edge to AllowList entities by IDs. -func (aliuo *AllowListItemUpdateOne) RemoveAllowlistIDs(ids ...int) *AllowListItemUpdateOne { - aliuo.mutation.RemoveAllowlistIDs(ids...) - return aliuo +func (_u *AllowListItemUpdateOne) RemoveAllowlistIDs(ids ...int) *AllowListItemUpdateOne { + _u.mutation.RemoveAllowlistIDs(ids...) + return _u } // RemoveAllowlist removes "allowlist" edges to AllowList entities. -func (aliuo *AllowListItemUpdateOne) RemoveAllowlist(a ...*AllowList) *AllowListItemUpdateOne { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *AllowListItemUpdateOne) RemoveAllowlist(v ...*AllowList) *AllowListItemUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return aliuo.RemoveAllowlistIDs(ids...) + return _u.RemoveAllowlistIDs(ids...) } // Where appends a list predicates to the AllowListItemUpdate builder. -func (aliuo *AllowListItemUpdateOne) Where(ps ...predicate.AllowListItem) *AllowListItemUpdateOne { - aliuo.mutation.Where(ps...) - return aliuo +func (_u *AllowListItemUpdateOne) Where(ps ...predicate.AllowListItem) *AllowListItemUpdateOne { + _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 (aliuo *AllowListItemUpdateOne) Select(field string, fields ...string) *AllowListItemUpdateOne { - aliuo.fields = append([]string{field}, fields...) - return aliuo +func (_u *AllowListItemUpdateOne) Select(field string, fields ...string) *AllowListItemUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated AllowListItem entity. -func (aliuo *AllowListItemUpdateOne) Save(ctx context.Context) (*AllowListItem, error) { - aliuo.defaults() - return withHooks(ctx, aliuo.sqlSave, aliuo.mutation, aliuo.hooks) +func (_u *AllowListItemUpdateOne) Save(ctx context.Context) (*AllowListItem, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (aliuo *AllowListItemUpdateOne) SaveX(ctx context.Context) *AllowListItem { - node, err := aliuo.Save(ctx) +func (_u *AllowListItemUpdateOne) SaveX(ctx context.Context) *AllowListItem { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -329,34 +329,34 @@ func (aliuo *AllowListItemUpdateOne) SaveX(ctx context.Context) *AllowListItem { } // Exec executes the query on the entity. -func (aliuo *AllowListItemUpdateOne) Exec(ctx context.Context) error { - _, err := aliuo.Save(ctx) +func (_u *AllowListItemUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (aliuo *AllowListItemUpdateOne) ExecX(ctx context.Context) { - if err := aliuo.Exec(ctx); err != nil { +func (_u *AllowListItemUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (aliuo *AllowListItemUpdateOne) defaults() { - if _, ok := aliuo.mutation.UpdatedAt(); !ok { +func (_u *AllowListItemUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := allowlistitem.UpdateDefaultUpdatedAt() - aliuo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (aliuo *AllowListItemUpdateOne) sqlSave(ctx context.Context) (_node *AllowListItem, err error) { +func (_u *AllowListItemUpdateOne) sqlSave(ctx context.Context) (_node *AllowListItem, err error) { _spec := sqlgraph.NewUpdateSpec(allowlistitem.Table, allowlistitem.Columns, sqlgraph.NewFieldSpec(allowlistitem.FieldID, field.TypeInt)) - id, ok := aliuo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AllowListItem.id" for update`)} } _spec.Node.ID.Value = id - if fields := aliuo.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, allowlistitem.FieldID) for _, f := range fields { @@ -368,41 +368,41 @@ func (aliuo *AllowListItemUpdateOne) sqlSave(ctx context.Context) (_node *AllowL } } } - if ps := aliuo.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 := aliuo.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(allowlistitem.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := aliuo.mutation.ExpiresAt(); ok { + if value, ok := _u.mutation.ExpiresAt(); ok { _spec.SetField(allowlistitem.FieldExpiresAt, field.TypeTime, value) } - if aliuo.mutation.ExpiresAtCleared() { + if _u.mutation.ExpiresAtCleared() { _spec.ClearField(allowlistitem.FieldExpiresAt, field.TypeTime) } - if aliuo.mutation.CommentCleared() { + if _u.mutation.CommentCleared() { _spec.ClearField(allowlistitem.FieldComment, field.TypeString) } - if aliuo.mutation.StartIPCleared() { + if _u.mutation.StartIPCleared() { _spec.ClearField(allowlistitem.FieldStartIP, field.TypeInt64) } - if aliuo.mutation.EndIPCleared() { + if _u.mutation.EndIPCleared() { _spec.ClearField(allowlistitem.FieldEndIP, field.TypeInt64) } - if aliuo.mutation.StartSuffixCleared() { + if _u.mutation.StartSuffixCleared() { _spec.ClearField(allowlistitem.FieldStartSuffix, field.TypeInt64) } - if aliuo.mutation.EndSuffixCleared() { + if _u.mutation.EndSuffixCleared() { _spec.ClearField(allowlistitem.FieldEndSuffix, field.TypeInt64) } - if aliuo.mutation.IPSizeCleared() { + if _u.mutation.IPSizeCleared() { _spec.ClearField(allowlistitem.FieldIPSize, field.TypeInt64) } - if aliuo.mutation.AllowlistCleared() { + if _u.mutation.AllowlistCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, @@ -415,7 +415,7 @@ func (aliuo *AllowListItemUpdateOne) sqlSave(ctx context.Context) (_node *AllowL } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := aliuo.mutation.RemovedAllowlistIDs(); len(nodes) > 0 && !aliuo.mutation.AllowlistCleared() { + if nodes := _u.mutation.RemovedAllowlistIDs(); len(nodes) > 0 && !_u.mutation.AllowlistCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, @@ -431,7 +431,7 @@ func (aliuo *AllowListItemUpdateOne) sqlSave(ctx context.Context) (_node *AllowL } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := aliuo.mutation.AllowlistIDs(); len(nodes) > 0 { + if nodes := _u.mutation.AllowlistIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2M, Inverse: true, @@ -447,10 +447,10 @@ func (aliuo *AllowListItemUpdateOne) sqlSave(ctx context.Context) (_node *AllowL } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - _node = &AllowListItem{config: aliuo.config} + _node = &AllowListItem{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, aliuo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{allowlistitem.Label} } else if sqlgraph.IsConstraintError(err) { @@ -458,6 +458,6 @@ func (aliuo *AllowListItemUpdateOne) sqlSave(ctx context.Context) (_node *AllowL } return nil, err } - aliuo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/bouncer.go b/pkg/database/ent/bouncer.go index e50fc9ee7..9482e2172 100644 --- a/pkg/database/ent/bouncer.go +++ b/pkg/database/ent/bouncer.go @@ -72,7 +72,7 @@ func (*Bouncer) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Bouncer fields. -func (b *Bouncer) assignValues(columns []string, values []any) error { +func (_m *Bouncer) 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) } @@ -83,100 +83,100 @@ func (b *Bouncer) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - b.ID = int(value.Int64) + _m.ID = int(value.Int64) case bouncer.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - b.CreatedAt = value.Time + _m.CreatedAt = value.Time } case bouncer.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - b.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case bouncer.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { - b.Name = value.String + _m.Name = value.String } case bouncer.FieldAPIKey: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field api_key", values[i]) } else if value.Valid { - b.APIKey = value.String + _m.APIKey = value.String } case bouncer.FieldRevoked: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field revoked", values[i]) } else if value.Valid { - b.Revoked = value.Bool + _m.Revoked = value.Bool } case bouncer.FieldIPAddress: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field ip_address", values[i]) } else if value.Valid { - b.IPAddress = value.String + _m.IPAddress = value.String } case bouncer.FieldType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field type", values[i]) } else if value.Valid { - b.Type = value.String + _m.Type = value.String } case bouncer.FieldVersion: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field version", values[i]) } else if value.Valid { - b.Version = value.String + _m.Version = value.String } case bouncer.FieldLastPull: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field last_pull", values[i]) } else if value.Valid { - b.LastPull = new(time.Time) - *b.LastPull = value.Time + _m.LastPull = new(time.Time) + *_m.LastPull = value.Time } case bouncer.FieldAuthType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field auth_type", values[i]) } else if value.Valid { - b.AuthType = value.String + _m.AuthType = value.String } case bouncer.FieldOsname: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field osname", values[i]) } else if value.Valid { - b.Osname = value.String + _m.Osname = value.String } case bouncer.FieldOsfamily: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field osfamily", values[i]) } else if value.Valid { - b.Osfamily = value.String + _m.Osfamily = value.String } case bouncer.FieldOsversion: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field osversion", values[i]) } else if value.Valid { - b.Osversion = value.String + _m.Osversion = value.String } case bouncer.FieldFeatureflags: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field featureflags", values[i]) } else if value.Valid { - b.Featureflags = value.String + _m.Featureflags = value.String } case bouncer.FieldAutoCreated: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field auto_created", values[i]) } else if value.Valid { - b.AutoCreated = value.Bool + _m.AutoCreated = value.Bool } default: - b.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -184,78 +184,78 @@ func (b *Bouncer) assignValues(columns []string, values []any) error { // Value returns the ent.Value that was dynamically selected and assigned to the Bouncer. // This includes values selected through modifiers, order, etc. -func (b *Bouncer) Value(name string) (ent.Value, error) { - return b.selectValues.Get(name) +func (_m *Bouncer) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // Update returns a builder for updating this Bouncer. // Note that you need to call Bouncer.Unwrap() before calling this method if this Bouncer // was returned from a transaction, and the transaction was committed or rolled back. -func (b *Bouncer) Update() *BouncerUpdateOne { - return NewBouncerClient(b.config).UpdateOne(b) +func (_m *Bouncer) Update() *BouncerUpdateOne { + return NewBouncerClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Bouncer 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 (b *Bouncer) Unwrap() *Bouncer { - _tx, ok := b.config.driver.(*txDriver) +func (_m *Bouncer) Unwrap() *Bouncer { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Bouncer is not a transactional entity") } - b.config.driver = _tx.drv - return b + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (b *Bouncer) String() string { +func (_m *Bouncer) String() string { var builder strings.Builder builder.WriteString("Bouncer(") - builder.WriteString(fmt.Sprintf("id=%v, ", b.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(b.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(b.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("name=") - builder.WriteString(b.Name) + builder.WriteString(_m.Name) builder.WriteString(", ") builder.WriteString("api_key=") builder.WriteString(", ") builder.WriteString("revoked=") - builder.WriteString(fmt.Sprintf("%v", b.Revoked)) + builder.WriteString(fmt.Sprintf("%v", _m.Revoked)) builder.WriteString(", ") builder.WriteString("ip_address=") - builder.WriteString(b.IPAddress) + builder.WriteString(_m.IPAddress) builder.WriteString(", ") builder.WriteString("type=") - builder.WriteString(b.Type) + builder.WriteString(_m.Type) builder.WriteString(", ") builder.WriteString("version=") - builder.WriteString(b.Version) + builder.WriteString(_m.Version) builder.WriteString(", ") - if v := b.LastPull; v != nil { + if v := _m.LastPull; v != nil { builder.WriteString("last_pull=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("auth_type=") - builder.WriteString(b.AuthType) + builder.WriteString(_m.AuthType) builder.WriteString(", ") builder.WriteString("osname=") - builder.WriteString(b.Osname) + builder.WriteString(_m.Osname) builder.WriteString(", ") builder.WriteString("osfamily=") - builder.WriteString(b.Osfamily) + builder.WriteString(_m.Osfamily) builder.WriteString(", ") builder.WriteString("osversion=") - builder.WriteString(b.Osversion) + builder.WriteString(_m.Osversion) builder.WriteString(", ") builder.WriteString("featureflags=") - builder.WriteString(b.Featureflags) + builder.WriteString(_m.Featureflags) builder.WriteString(", ") builder.WriteString("auto_created=") - builder.WriteString(fmt.Sprintf("%v", b.AutoCreated)) + builder.WriteString(fmt.Sprintf("%v", _m.AutoCreated)) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/bouncer_create.go b/pkg/database/ent/bouncer_create.go index cd5fd7097..41094285d 100644 --- a/pkg/database/ent/bouncer_create.go +++ b/pkg/database/ent/bouncer_create.go @@ -23,205 +23,205 @@ type BouncerCreate struct { } // SetCreatedAt sets the "created_at" field. -func (bc *BouncerCreate) SetCreatedAt(t time.Time) *BouncerCreate { - bc.mutation.SetCreatedAt(t) - return bc +func (_c *BouncerCreate) SetCreatedAt(v time.Time) *BouncerCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableCreatedAt(t *time.Time) *BouncerCreate { - if t != nil { - bc.SetCreatedAt(*t) +func (_c *BouncerCreate) SetNillableCreatedAt(v *time.Time) *BouncerCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return bc + return _c } // SetUpdatedAt sets the "updated_at" field. -func (bc *BouncerCreate) SetUpdatedAt(t time.Time) *BouncerCreate { - bc.mutation.SetUpdatedAt(t) - return bc +func (_c *BouncerCreate) SetUpdatedAt(v time.Time) *BouncerCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableUpdatedAt(t *time.Time) *BouncerCreate { - if t != nil { - bc.SetUpdatedAt(*t) +func (_c *BouncerCreate) SetNillableUpdatedAt(v *time.Time) *BouncerCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return bc + return _c } // SetName sets the "name" field. -func (bc *BouncerCreate) SetName(s string) *BouncerCreate { - bc.mutation.SetName(s) - return bc +func (_c *BouncerCreate) SetName(v string) *BouncerCreate { + _c.mutation.SetName(v) + return _c } // SetAPIKey sets the "api_key" field. -func (bc *BouncerCreate) SetAPIKey(s string) *BouncerCreate { - bc.mutation.SetAPIKey(s) - return bc +func (_c *BouncerCreate) SetAPIKey(v string) *BouncerCreate { + _c.mutation.SetAPIKey(v) + return _c } // SetRevoked sets the "revoked" field. -func (bc *BouncerCreate) SetRevoked(b bool) *BouncerCreate { - bc.mutation.SetRevoked(b) - return bc +func (_c *BouncerCreate) SetRevoked(v bool) *BouncerCreate { + _c.mutation.SetRevoked(v) + return _c } // SetIPAddress sets the "ip_address" field. -func (bc *BouncerCreate) SetIPAddress(s string) *BouncerCreate { - bc.mutation.SetIPAddress(s) - return bc +func (_c *BouncerCreate) SetIPAddress(v string) *BouncerCreate { + _c.mutation.SetIPAddress(v) + return _c } // SetNillableIPAddress sets the "ip_address" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableIPAddress(s *string) *BouncerCreate { - if s != nil { - bc.SetIPAddress(*s) +func (_c *BouncerCreate) SetNillableIPAddress(v *string) *BouncerCreate { + if v != nil { + _c.SetIPAddress(*v) } - return bc + return _c } // SetType sets the "type" field. -func (bc *BouncerCreate) SetType(s string) *BouncerCreate { - bc.mutation.SetType(s) - return bc +func (_c *BouncerCreate) SetType(v string) *BouncerCreate { + _c.mutation.SetType(v) + return _c } // SetNillableType sets the "type" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableType(s *string) *BouncerCreate { - if s != nil { - bc.SetType(*s) +func (_c *BouncerCreate) SetNillableType(v *string) *BouncerCreate { + if v != nil { + _c.SetType(*v) } - return bc + return _c } // SetVersion sets the "version" field. -func (bc *BouncerCreate) SetVersion(s string) *BouncerCreate { - bc.mutation.SetVersion(s) - return bc +func (_c *BouncerCreate) SetVersion(v string) *BouncerCreate { + _c.mutation.SetVersion(v) + return _c } // SetNillableVersion sets the "version" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableVersion(s *string) *BouncerCreate { - if s != nil { - bc.SetVersion(*s) +func (_c *BouncerCreate) SetNillableVersion(v *string) *BouncerCreate { + if v != nil { + _c.SetVersion(*v) } - return bc + return _c } // SetLastPull sets the "last_pull" field. -func (bc *BouncerCreate) SetLastPull(t time.Time) *BouncerCreate { - bc.mutation.SetLastPull(t) - return bc +func (_c *BouncerCreate) SetLastPull(v time.Time) *BouncerCreate { + _c.mutation.SetLastPull(v) + return _c } // SetNillableLastPull sets the "last_pull" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableLastPull(t *time.Time) *BouncerCreate { - if t != nil { - bc.SetLastPull(*t) +func (_c *BouncerCreate) SetNillableLastPull(v *time.Time) *BouncerCreate { + if v != nil { + _c.SetLastPull(*v) } - return bc + return _c } // SetAuthType sets the "auth_type" field. -func (bc *BouncerCreate) SetAuthType(s string) *BouncerCreate { - bc.mutation.SetAuthType(s) - return bc +func (_c *BouncerCreate) SetAuthType(v string) *BouncerCreate { + _c.mutation.SetAuthType(v) + return _c } // SetNillableAuthType sets the "auth_type" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableAuthType(s *string) *BouncerCreate { - if s != nil { - bc.SetAuthType(*s) +func (_c *BouncerCreate) SetNillableAuthType(v *string) *BouncerCreate { + if v != nil { + _c.SetAuthType(*v) } - return bc + return _c } // SetOsname sets the "osname" field. -func (bc *BouncerCreate) SetOsname(s string) *BouncerCreate { - bc.mutation.SetOsname(s) - return bc +func (_c *BouncerCreate) SetOsname(v string) *BouncerCreate { + _c.mutation.SetOsname(v) + return _c } // SetNillableOsname sets the "osname" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableOsname(s *string) *BouncerCreate { - if s != nil { - bc.SetOsname(*s) +func (_c *BouncerCreate) SetNillableOsname(v *string) *BouncerCreate { + if v != nil { + _c.SetOsname(*v) } - return bc + return _c } // SetOsfamily sets the "osfamily" field. -func (bc *BouncerCreate) SetOsfamily(s string) *BouncerCreate { - bc.mutation.SetOsfamily(s) - return bc +func (_c *BouncerCreate) SetOsfamily(v string) *BouncerCreate { + _c.mutation.SetOsfamily(v) + return _c } // SetNillableOsfamily sets the "osfamily" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableOsfamily(s *string) *BouncerCreate { - if s != nil { - bc.SetOsfamily(*s) +func (_c *BouncerCreate) SetNillableOsfamily(v *string) *BouncerCreate { + if v != nil { + _c.SetOsfamily(*v) } - return bc + return _c } // SetOsversion sets the "osversion" field. -func (bc *BouncerCreate) SetOsversion(s string) *BouncerCreate { - bc.mutation.SetOsversion(s) - return bc +func (_c *BouncerCreate) SetOsversion(v string) *BouncerCreate { + _c.mutation.SetOsversion(v) + return _c } // SetNillableOsversion sets the "osversion" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableOsversion(s *string) *BouncerCreate { - if s != nil { - bc.SetOsversion(*s) +func (_c *BouncerCreate) SetNillableOsversion(v *string) *BouncerCreate { + if v != nil { + _c.SetOsversion(*v) } - return bc + return _c } // SetFeatureflags sets the "featureflags" field. -func (bc *BouncerCreate) SetFeatureflags(s string) *BouncerCreate { - bc.mutation.SetFeatureflags(s) - return bc +func (_c *BouncerCreate) SetFeatureflags(v string) *BouncerCreate { + _c.mutation.SetFeatureflags(v) + return _c } // SetNillableFeatureflags sets the "featureflags" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableFeatureflags(s *string) *BouncerCreate { - if s != nil { - bc.SetFeatureflags(*s) +func (_c *BouncerCreate) SetNillableFeatureflags(v *string) *BouncerCreate { + if v != nil { + _c.SetFeatureflags(*v) } - return bc + return _c } // SetAutoCreated sets the "auto_created" field. -func (bc *BouncerCreate) SetAutoCreated(b bool) *BouncerCreate { - bc.mutation.SetAutoCreated(b) - return bc +func (_c *BouncerCreate) SetAutoCreated(v bool) *BouncerCreate { + _c.mutation.SetAutoCreated(v) + return _c } // SetNillableAutoCreated sets the "auto_created" field if the given value is not nil. -func (bc *BouncerCreate) SetNillableAutoCreated(b *bool) *BouncerCreate { - if b != nil { - bc.SetAutoCreated(*b) +func (_c *BouncerCreate) SetNillableAutoCreated(v *bool) *BouncerCreate { + if v != nil { + _c.SetAutoCreated(*v) } - return bc + return _c } // Mutation returns the BouncerMutation object of the builder. -func (bc *BouncerCreate) Mutation() *BouncerMutation { - return bc.mutation +func (_c *BouncerCreate) Mutation() *BouncerMutation { + return _c.mutation } // Save creates the Bouncer in the database. -func (bc *BouncerCreate) Save(ctx context.Context) (*Bouncer, error) { - bc.defaults() - return withHooks(ctx, bc.sqlSave, bc.mutation, bc.hooks) +func (_c *BouncerCreate) Save(ctx context.Context) (*Bouncer, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (bc *BouncerCreate) SaveX(ctx context.Context) *Bouncer { - v, err := bc.Save(ctx) +func (_c *BouncerCreate) SaveX(ctx context.Context) *Bouncer { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -229,74 +229,74 @@ func (bc *BouncerCreate) SaveX(ctx context.Context) *Bouncer { } // Exec executes the query. -func (bc *BouncerCreate) Exec(ctx context.Context) error { - _, err := bc.Save(ctx) +func (_c *BouncerCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (bc *BouncerCreate) ExecX(ctx context.Context) { - if err := bc.Exec(ctx); err != nil { +func (_c *BouncerCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (bc *BouncerCreate) defaults() { - if _, ok := bc.mutation.CreatedAt(); !ok { +func (_c *BouncerCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := bouncer.DefaultCreatedAt() - bc.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := bc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := bouncer.DefaultUpdatedAt() - bc.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } - if _, ok := bc.mutation.IPAddress(); !ok { + if _, ok := _c.mutation.IPAddress(); !ok { v := bouncer.DefaultIPAddress - bc.mutation.SetIPAddress(v) + _c.mutation.SetIPAddress(v) } - if _, ok := bc.mutation.AuthType(); !ok { + if _, ok := _c.mutation.AuthType(); !ok { v := bouncer.DefaultAuthType - bc.mutation.SetAuthType(v) + _c.mutation.SetAuthType(v) } - if _, ok := bc.mutation.AutoCreated(); !ok { + if _, ok := _c.mutation.AutoCreated(); !ok { v := bouncer.DefaultAutoCreated - bc.mutation.SetAutoCreated(v) + _c.mutation.SetAutoCreated(v) } } // check runs all checks and user-defined validators on the builder. -func (bc *BouncerCreate) check() error { - if _, ok := bc.mutation.CreatedAt(); !ok { +func (_c *BouncerCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Bouncer.created_at"`)} } - if _, ok := bc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Bouncer.updated_at"`)} } - if _, ok := bc.mutation.Name(); !ok { + if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Bouncer.name"`)} } - if _, ok := bc.mutation.APIKey(); !ok { + if _, ok := _c.mutation.APIKey(); !ok { return &ValidationError{Name: "api_key", err: errors.New(`ent: missing required field "Bouncer.api_key"`)} } - if _, ok := bc.mutation.Revoked(); !ok { + if _, ok := _c.mutation.Revoked(); !ok { return &ValidationError{Name: "revoked", err: errors.New(`ent: missing required field "Bouncer.revoked"`)} } - if _, ok := bc.mutation.AuthType(); !ok { + if _, ok := _c.mutation.AuthType(); !ok { return &ValidationError{Name: "auth_type", err: errors.New(`ent: missing required field "Bouncer.auth_type"`)} } - if _, ok := bc.mutation.AutoCreated(); !ok { + if _, ok := _c.mutation.AutoCreated(); !ok { return &ValidationError{Name: "auto_created", err: errors.New(`ent: missing required field "Bouncer.auto_created"`)} } return nil } -func (bc *BouncerCreate) sqlSave(ctx context.Context) (*Bouncer, error) { - if err := bc.check(); err != nil { +func (_c *BouncerCreate) sqlSave(ctx context.Context) (*Bouncer, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := bc.createSpec() - if err := sqlgraph.CreateNode(ctx, bc.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -304,74 +304,74 @@ func (bc *BouncerCreate) sqlSave(ctx context.Context) (*Bouncer, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - bc.mutation.id = &_node.ID - bc.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (bc *BouncerCreate) createSpec() (*Bouncer, *sqlgraph.CreateSpec) { +func (_c *BouncerCreate) createSpec() (*Bouncer, *sqlgraph.CreateSpec) { var ( - _node = &Bouncer{config: bc.config} + _node = &Bouncer{config: _c.config} _spec = sqlgraph.NewCreateSpec(bouncer.Table, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt)) ) - _spec.OnConflict = bc.conflict - if value, ok := bc.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(bouncer.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := bc.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := bc.mutation.Name(); ok { + if value, ok := _c.mutation.Name(); ok { _spec.SetField(bouncer.FieldName, field.TypeString, value) _node.Name = value } - if value, ok := bc.mutation.APIKey(); ok { + if value, ok := _c.mutation.APIKey(); ok { _spec.SetField(bouncer.FieldAPIKey, field.TypeString, value) _node.APIKey = value } - if value, ok := bc.mutation.Revoked(); ok { + if value, ok := _c.mutation.Revoked(); ok { _spec.SetField(bouncer.FieldRevoked, field.TypeBool, value) _node.Revoked = value } - if value, ok := bc.mutation.IPAddress(); ok { + if value, ok := _c.mutation.IPAddress(); ok { _spec.SetField(bouncer.FieldIPAddress, field.TypeString, value) _node.IPAddress = value } - if value, ok := bc.mutation.GetType(); ok { + if value, ok := _c.mutation.GetType(); ok { _spec.SetField(bouncer.FieldType, field.TypeString, value) _node.Type = value } - if value, ok := bc.mutation.Version(); ok { + if value, ok := _c.mutation.Version(); ok { _spec.SetField(bouncer.FieldVersion, field.TypeString, value) _node.Version = value } - if value, ok := bc.mutation.LastPull(); ok { + if value, ok := _c.mutation.LastPull(); ok { _spec.SetField(bouncer.FieldLastPull, field.TypeTime, value) _node.LastPull = &value } - if value, ok := bc.mutation.AuthType(); ok { + if value, ok := _c.mutation.AuthType(); ok { _spec.SetField(bouncer.FieldAuthType, field.TypeString, value) _node.AuthType = value } - if value, ok := bc.mutation.Osname(); ok { + if value, ok := _c.mutation.Osname(); ok { _spec.SetField(bouncer.FieldOsname, field.TypeString, value) _node.Osname = value } - if value, ok := bc.mutation.Osfamily(); ok { + if value, ok := _c.mutation.Osfamily(); ok { _spec.SetField(bouncer.FieldOsfamily, field.TypeString, value) _node.Osfamily = value } - if value, ok := bc.mutation.Osversion(); ok { + if value, ok := _c.mutation.Osversion(); ok { _spec.SetField(bouncer.FieldOsversion, field.TypeString, value) _node.Osversion = value } - if value, ok := bc.mutation.Featureflags(); ok { + if value, ok := _c.mutation.Featureflags(); ok { _spec.SetField(bouncer.FieldFeatureflags, field.TypeString, value) _node.Featureflags = value } - if value, ok := bc.mutation.AutoCreated(); ok { + if value, ok := _c.mutation.AutoCreated(); ok { _spec.SetField(bouncer.FieldAutoCreated, field.TypeBool, value) _node.AutoCreated = value } @@ -394,10 +394,10 @@ func (bc *BouncerCreate) createSpec() (*Bouncer, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (bc *BouncerCreate) OnConflict(opts ...sql.ConflictOption) *BouncerUpsertOne { - bc.conflict = opts +func (_c *BouncerCreate) OnConflict(opts ...sql.ConflictOption) *BouncerUpsertOne { + _c.conflict = opts return &BouncerUpsertOne{ - create: bc, + create: _c, } } @@ -407,10 +407,10 @@ func (bc *BouncerCreate) OnConflict(opts ...sql.ConflictOption) *BouncerUpsertOn // client.Bouncer.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (bc *BouncerCreate) OnConflictColumns(columns ...string) *BouncerUpsertOne { - bc.conflict = append(bc.conflict, sql.ConflictColumns(columns...)) +func (_c *BouncerCreate) OnConflictColumns(columns ...string) *BouncerUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BouncerUpsertOne{ - create: bc, + create: _c, } } @@ -936,16 +936,16 @@ type BouncerCreateBulk struct { } // Save creates the Bouncer entities in the database. -func (bcb *BouncerCreateBulk) Save(ctx context.Context) ([]*Bouncer, error) { - if bcb.err != nil { - return nil, bcb.err +func (_c *BouncerCreateBulk) Save(ctx context.Context) ([]*Bouncer, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(bcb.builders)) - nodes := make([]*Bouncer, len(bcb.builders)) - mutators := make([]Mutator, len(bcb.builders)) - for i := range bcb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Bouncer, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := bcb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*BouncerMutation) @@ -959,12 +959,12 @@ func (bcb *BouncerCreateBulk) Save(ctx context.Context) ([]*Bouncer, error) { var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, bcb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = bcb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, bcb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -988,7 +988,7 @@ func (bcb *BouncerCreateBulk) Save(ctx context.Context) ([]*Bouncer, error) { }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, bcb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -996,8 +996,8 @@ func (bcb *BouncerCreateBulk) Save(ctx context.Context) ([]*Bouncer, error) { } // SaveX is like Save, but panics if an error occurs. -func (bcb *BouncerCreateBulk) SaveX(ctx context.Context) []*Bouncer { - v, err := bcb.Save(ctx) +func (_c *BouncerCreateBulk) SaveX(ctx context.Context) []*Bouncer { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -1005,14 +1005,14 @@ func (bcb *BouncerCreateBulk) SaveX(ctx context.Context) []*Bouncer { } // Exec executes the query. -func (bcb *BouncerCreateBulk) Exec(ctx context.Context) error { - _, err := bcb.Save(ctx) +func (_c *BouncerCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (bcb *BouncerCreateBulk) ExecX(ctx context.Context) { - if err := bcb.Exec(ctx); err != nil { +func (_c *BouncerCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -1032,10 +1032,10 @@ func (bcb *BouncerCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (bcb *BouncerCreateBulk) OnConflict(opts ...sql.ConflictOption) *BouncerUpsertBulk { - bcb.conflict = opts +func (_c *BouncerCreateBulk) OnConflict(opts ...sql.ConflictOption) *BouncerUpsertBulk { + _c.conflict = opts return &BouncerUpsertBulk{ - create: bcb, + create: _c, } } @@ -1045,10 +1045,10 @@ func (bcb *BouncerCreateBulk) OnConflict(opts ...sql.ConflictOption) *BouncerUps // client.Bouncer.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (bcb *BouncerCreateBulk) OnConflictColumns(columns ...string) *BouncerUpsertBulk { - bcb.conflict = append(bcb.conflict, sql.ConflictColumns(columns...)) +func (_c *BouncerCreateBulk) OnConflictColumns(columns ...string) *BouncerUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &BouncerUpsertBulk{ - create: bcb, + create: _c, } } diff --git a/pkg/database/ent/bouncer_delete.go b/pkg/database/ent/bouncer_delete.go index bf459e77e..b6ef650a5 100644 --- a/pkg/database/ent/bouncer_delete.go +++ b/pkg/database/ent/bouncer_delete.go @@ -20,56 +20,56 @@ type BouncerDelete struct { } // Where appends a list predicates to the BouncerDelete builder. -func (bd *BouncerDelete) Where(ps ...predicate.Bouncer) *BouncerDelete { - bd.mutation.Where(ps...) - return bd +func (_d *BouncerDelete) Where(ps ...predicate.Bouncer) *BouncerDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (bd *BouncerDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, bd.sqlExec, bd.mutation, bd.hooks) +func (_d *BouncerDelete) 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 (bd *BouncerDelete) ExecX(ctx context.Context) int { - n, err := bd.Exec(ctx) +func (_d *BouncerDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (bd *BouncerDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *BouncerDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(bouncer.Table, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt)) - if ps := bd.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, bd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - bd.mutation.done = true + _d.mutation.done = true return affected, err } // BouncerDeleteOne is the builder for deleting a single Bouncer entity. type BouncerDeleteOne struct { - bd *BouncerDelete + _d *BouncerDelete } // Where appends a list predicates to the BouncerDelete builder. -func (bdo *BouncerDeleteOne) Where(ps ...predicate.Bouncer) *BouncerDeleteOne { - bdo.bd.mutation.Where(ps...) - return bdo +func (_d *BouncerDeleteOne) Where(ps ...predicate.Bouncer) *BouncerDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (bdo *BouncerDeleteOne) Exec(ctx context.Context) error { - n, err := bdo.bd.Exec(ctx) +func (_d *BouncerDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (bdo *BouncerDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (bdo *BouncerDeleteOne) ExecX(ctx context.Context) { - if err := bdo.Exec(ctx); err != nil { +func (_d *BouncerDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/bouncer_query.go b/pkg/database/ent/bouncer_query.go index 4277dbc0f..656776ddf 100644 --- a/pkg/database/ent/bouncer_query.go +++ b/pkg/database/ent/bouncer_query.go @@ -28,40 +28,40 @@ type BouncerQuery struct { } // Where adds a new predicate for the BouncerQuery builder. -func (bq *BouncerQuery) Where(ps ...predicate.Bouncer) *BouncerQuery { - bq.predicates = append(bq.predicates, ps...) - return bq +func (_q *BouncerQuery) Where(ps ...predicate.Bouncer) *BouncerQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (bq *BouncerQuery) Limit(limit int) *BouncerQuery { - bq.ctx.Limit = &limit - return bq +func (_q *BouncerQuery) Limit(limit int) *BouncerQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (bq *BouncerQuery) Offset(offset int) *BouncerQuery { - bq.ctx.Offset = &offset - return bq +func (_q *BouncerQuery) Offset(offset int) *BouncerQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (bq *BouncerQuery) Unique(unique bool) *BouncerQuery { - bq.ctx.Unique = &unique - return bq +func (_q *BouncerQuery) Unique(unique bool) *BouncerQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (bq *BouncerQuery) Order(o ...bouncer.OrderOption) *BouncerQuery { - bq.order = append(bq.order, o...) - return bq +func (_q *BouncerQuery) Order(o ...bouncer.OrderOption) *BouncerQuery { + _q.order = append(_q.order, o...) + return _q } // First returns the first Bouncer entity from the query. // Returns a *NotFoundError when no Bouncer was found. -func (bq *BouncerQuery) First(ctx context.Context) (*Bouncer, error) { - nodes, err := bq.Limit(1).All(setContextOp(ctx, bq.ctx, ent.OpQueryFirst)) +func (_q *BouncerQuery) First(ctx context.Context) (*Bouncer, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -72,8 +72,8 @@ func (bq *BouncerQuery) First(ctx context.Context) (*Bouncer, error) { } // FirstX is like First, but panics if an error occurs. -func (bq *BouncerQuery) FirstX(ctx context.Context) *Bouncer { - node, err := bq.First(ctx) +func (_q *BouncerQuery) FirstX(ctx context.Context) *Bouncer { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -82,9 +82,9 @@ func (bq *BouncerQuery) FirstX(ctx context.Context) *Bouncer { // FirstID returns the first Bouncer ID from the query. // Returns a *NotFoundError when no Bouncer ID was found. -func (bq *BouncerQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *BouncerQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = bq.Limit(1).IDs(setContextOp(ctx, bq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -95,8 +95,8 @@ func (bq *BouncerQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (bq *BouncerQuery) FirstIDX(ctx context.Context) int { - id, err := bq.FirstID(ctx) +func (_q *BouncerQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -106,8 +106,8 @@ func (bq *BouncerQuery) FirstIDX(ctx context.Context) int { // Only returns a single Bouncer entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Bouncer entity is found. // Returns a *NotFoundError when no Bouncer entities are found. -func (bq *BouncerQuery) Only(ctx context.Context) (*Bouncer, error) { - nodes, err := bq.Limit(2).All(setContextOp(ctx, bq.ctx, ent.OpQueryOnly)) +func (_q *BouncerQuery) Only(ctx context.Context) (*Bouncer, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -122,8 +122,8 @@ func (bq *BouncerQuery) Only(ctx context.Context) (*Bouncer, error) { } // OnlyX is like Only, but panics if an error occurs. -func (bq *BouncerQuery) OnlyX(ctx context.Context) *Bouncer { - node, err := bq.Only(ctx) +func (_q *BouncerQuery) OnlyX(ctx context.Context) *Bouncer { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -133,9 +133,9 @@ func (bq *BouncerQuery) OnlyX(ctx context.Context) *Bouncer { // OnlyID is like Only, but returns the only Bouncer ID in the query. // Returns a *NotSingularError when more than one Bouncer ID is found. // Returns a *NotFoundError when no entities are found. -func (bq *BouncerQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *BouncerQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = bq.Limit(2).IDs(setContextOp(ctx, bq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -150,8 +150,8 @@ func (bq *BouncerQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (bq *BouncerQuery) OnlyIDX(ctx context.Context) int { - id, err := bq.OnlyID(ctx) +func (_q *BouncerQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -159,18 +159,18 @@ func (bq *BouncerQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of Bouncers. -func (bq *BouncerQuery) All(ctx context.Context) ([]*Bouncer, error) { - ctx = setContextOp(ctx, bq.ctx, ent.OpQueryAll) - if err := bq.prepareQuery(ctx); err != nil { +func (_q *BouncerQuery) All(ctx context.Context) ([]*Bouncer, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Bouncer, *BouncerQuery]() - return withInterceptors[[]*Bouncer](ctx, bq, qr, bq.inters) + return withInterceptors[[]*Bouncer](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (bq *BouncerQuery) AllX(ctx context.Context) []*Bouncer { - nodes, err := bq.All(ctx) +func (_q *BouncerQuery) AllX(ctx context.Context) []*Bouncer { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -178,20 +178,20 @@ func (bq *BouncerQuery) AllX(ctx context.Context) []*Bouncer { } // IDs executes the query and returns a list of Bouncer IDs. -func (bq *BouncerQuery) IDs(ctx context.Context) (ids []int, err error) { - if bq.ctx.Unique == nil && bq.path != nil { - bq.Unique(true) +func (_q *BouncerQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, bq.ctx, ent.OpQueryIDs) - if err = bq.Select(bouncer.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(bouncer.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (bq *BouncerQuery) IDsX(ctx context.Context) []int { - ids, err := bq.IDs(ctx) +func (_q *BouncerQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -199,17 +199,17 @@ func (bq *BouncerQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (bq *BouncerQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, bq.ctx, ent.OpQueryCount) - if err := bq.prepareQuery(ctx); err != nil { +func (_q *BouncerQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, bq, querierCount[*BouncerQuery](), bq.inters) + return withInterceptors[int](ctx, _q, querierCount[*BouncerQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (bq *BouncerQuery) CountX(ctx context.Context) int { - count, err := bq.Count(ctx) +func (_q *BouncerQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -217,9 +217,9 @@ func (bq *BouncerQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (bq *BouncerQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, bq.ctx, ent.OpQueryExist) - switch _, err := bq.FirstID(ctx); { +func (_q *BouncerQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -230,8 +230,8 @@ func (bq *BouncerQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (bq *BouncerQuery) ExistX(ctx context.Context) bool { - exist, err := bq.Exist(ctx) +func (_q *BouncerQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -240,19 +240,19 @@ func (bq *BouncerQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the BouncerQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (bq *BouncerQuery) Clone() *BouncerQuery { - if bq == nil { +func (_q *BouncerQuery) Clone() *BouncerQuery { + if _q == nil { return nil } return &BouncerQuery{ - config: bq.config, - ctx: bq.ctx.Clone(), - order: append([]bouncer.OrderOption{}, bq.order...), - inters: append([]Interceptor{}, bq.inters...), - predicates: append([]predicate.Bouncer{}, bq.predicates...), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]bouncer.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Bouncer{}, _q.predicates...), // clone intermediate query. - sql: bq.sql.Clone(), - path: bq.path, + sql: _q.sql.Clone(), + path: _q.path, } } @@ -270,10 +270,10 @@ func (bq *BouncerQuery) Clone() *BouncerQuery { // GroupBy(bouncer.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (bq *BouncerQuery) GroupBy(field string, fields ...string) *BouncerGroupBy { - bq.ctx.Fields = append([]string{field}, fields...) - grbuild := &BouncerGroupBy{build: bq} - grbuild.flds = &bq.ctx.Fields +func (_q *BouncerQuery) GroupBy(field string, fields ...string) *BouncerGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &BouncerGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = bouncer.Label grbuild.scan = grbuild.Scan return grbuild @@ -291,62 +291,62 @@ func (bq *BouncerQuery) GroupBy(field string, fields ...string) *BouncerGroupBy // client.Bouncer.Query(). // Select(bouncer.FieldCreatedAt). // Scan(ctx, &v) -func (bq *BouncerQuery) Select(fields ...string) *BouncerSelect { - bq.ctx.Fields = append(bq.ctx.Fields, fields...) - sbuild := &BouncerSelect{BouncerQuery: bq} +func (_q *BouncerQuery) Select(fields ...string) *BouncerSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &BouncerSelect{BouncerQuery: _q} sbuild.label = bouncer.Label - sbuild.flds, sbuild.scan = &bq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a BouncerSelect configured with the given aggregations. -func (bq *BouncerQuery) Aggregate(fns ...AggregateFunc) *BouncerSelect { - return bq.Select().Aggregate(fns...) +func (_q *BouncerQuery) Aggregate(fns ...AggregateFunc) *BouncerSelect { + return _q.Select().Aggregate(fns...) } -func (bq *BouncerQuery) prepareQuery(ctx context.Context) error { - for _, inter := range bq.inters { +func (_q *BouncerQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, bq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range bq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !bouncer.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if bq.path != nil { - prev, err := bq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - bq.sql = prev + _q.sql = prev } return nil } -func (bq *BouncerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Bouncer, error) { +func (_q *BouncerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Bouncer, error) { var ( nodes = []*Bouncer{} - _spec = bq.querySpec() + _spec = _q.querySpec() ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Bouncer).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Bouncer{config: bq.config} + node := &Bouncer{config: _q.config} nodes = append(nodes, node) return node.assignValues(columns, values) } for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, bq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { @@ -355,24 +355,24 @@ func (bq *BouncerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Boun return nodes, nil } -func (bq *BouncerQuery) sqlCount(ctx context.Context) (int, error) { - _spec := bq.querySpec() - _spec.Node.Columns = bq.ctx.Fields - if len(bq.ctx.Fields) > 0 { - _spec.Unique = bq.ctx.Unique != nil && *bq.ctx.Unique +func (_q *BouncerQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, bq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (bq *BouncerQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *BouncerQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(bouncer.Table, bouncer.Columns, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt)) - _spec.From = bq.sql - if unique := bq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if bq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := bq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, bouncer.FieldID) for i := range fields { @@ -381,20 +381,20 @@ func (bq *BouncerQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := bq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := bq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := bq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := bq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -404,33 +404,33 @@ func (bq *BouncerQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (bq *BouncerQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(bq.driver.Dialect()) +func (_q *BouncerQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(bouncer.Table) - columns := bq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = bouncer.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if bq.sql != nil { - selector = bq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if bq.ctx.Unique != nil && *bq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range bq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range bq.order { + for _, p := range _q.order { p(selector) } - if offset := bq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := bq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -443,41 +443,41 @@ type BouncerGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (bgb *BouncerGroupBy) Aggregate(fns ...AggregateFunc) *BouncerGroupBy { - bgb.fns = append(bgb.fns, fns...) - return bgb +func (_g *BouncerGroupBy) Aggregate(fns ...AggregateFunc) *BouncerGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (bgb *BouncerGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bgb.build.ctx, ent.OpQueryGroupBy) - if err := bgb.build.prepareQuery(ctx); err != nil { +func (_g *BouncerGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BouncerQuery, *BouncerGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v) + return scanWithInterceptors[*BouncerQuery, *BouncerGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (bgb *BouncerGroupBy) sqlScan(ctx context.Context, root *BouncerQuery, v any) error { +func (_g *BouncerGroupBy) sqlScan(ctx context.Context, root *BouncerQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(bgb.fns)) - for _, fn := range bgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*bgb.flds)+len(bgb.fns)) - for _, f := range *bgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*bgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := bgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type BouncerSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (bs *BouncerSelect) Aggregate(fns ...AggregateFunc) *BouncerSelect { - bs.fns = append(bs.fns, fns...) - return bs +func (_s *BouncerSelect) Aggregate(fns ...AggregateFunc) *BouncerSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (bs *BouncerSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bs.ctx, ent.OpQuerySelect) - if err := bs.prepareQuery(ctx); err != nil { +func (_s *BouncerSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BouncerQuery, *BouncerSelect](ctx, bs.BouncerQuery, bs, bs.inters, v) + return scanWithInterceptors[*BouncerQuery, *BouncerSelect](ctx, _s.BouncerQuery, _s, _s.inters, v) } -func (bs *BouncerSelect) sqlScan(ctx context.Context, root *BouncerQuery, v any) error { +func (_s *BouncerSelect) sqlScan(ctx context.Context, root *BouncerQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(bs.fns)) - for _, fn := range bs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*bs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (bs *BouncerSelect) sqlScan(ctx context.Context, root *BouncerQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := bs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/bouncer_update.go b/pkg/database/ent/bouncer_update.go index d0d8d9616..ad8765636 100644 --- a/pkg/database/ent/bouncer_update.go +++ b/pkg/database/ent/bouncer_update.go @@ -23,233 +23,233 @@ type BouncerUpdate struct { } // Where appends a list predicates to the BouncerUpdate builder. -func (bu *BouncerUpdate) Where(ps ...predicate.Bouncer) *BouncerUpdate { - bu.mutation.Where(ps...) - return bu +func (_u *BouncerUpdate) Where(ps ...predicate.Bouncer) *BouncerUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (bu *BouncerUpdate) SetUpdatedAt(t time.Time) *BouncerUpdate { - bu.mutation.SetUpdatedAt(t) - return bu +func (_u *BouncerUpdate) SetUpdatedAt(v time.Time) *BouncerUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetAPIKey sets the "api_key" field. -func (bu *BouncerUpdate) SetAPIKey(s string) *BouncerUpdate { - bu.mutation.SetAPIKey(s) - return bu +func (_u *BouncerUpdate) SetAPIKey(v string) *BouncerUpdate { + _u.mutation.SetAPIKey(v) + return _u } // SetNillableAPIKey sets the "api_key" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableAPIKey(s *string) *BouncerUpdate { - if s != nil { - bu.SetAPIKey(*s) +func (_u *BouncerUpdate) SetNillableAPIKey(v *string) *BouncerUpdate { + if v != nil { + _u.SetAPIKey(*v) } - return bu + return _u } // SetRevoked sets the "revoked" field. -func (bu *BouncerUpdate) SetRevoked(b bool) *BouncerUpdate { - bu.mutation.SetRevoked(b) - return bu +func (_u *BouncerUpdate) SetRevoked(v bool) *BouncerUpdate { + _u.mutation.SetRevoked(v) + return _u } // SetNillableRevoked sets the "revoked" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableRevoked(b *bool) *BouncerUpdate { - if b != nil { - bu.SetRevoked(*b) +func (_u *BouncerUpdate) SetNillableRevoked(v *bool) *BouncerUpdate { + if v != nil { + _u.SetRevoked(*v) } - return bu + return _u } // SetIPAddress sets the "ip_address" field. -func (bu *BouncerUpdate) SetIPAddress(s string) *BouncerUpdate { - bu.mutation.SetIPAddress(s) - return bu +func (_u *BouncerUpdate) SetIPAddress(v string) *BouncerUpdate { + _u.mutation.SetIPAddress(v) + return _u } // SetNillableIPAddress sets the "ip_address" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableIPAddress(s *string) *BouncerUpdate { - if s != nil { - bu.SetIPAddress(*s) +func (_u *BouncerUpdate) SetNillableIPAddress(v *string) *BouncerUpdate { + if v != nil { + _u.SetIPAddress(*v) } - return bu + return _u } // ClearIPAddress clears the value of the "ip_address" field. -func (bu *BouncerUpdate) ClearIPAddress() *BouncerUpdate { - bu.mutation.ClearIPAddress() - return bu +func (_u *BouncerUpdate) ClearIPAddress() *BouncerUpdate { + _u.mutation.ClearIPAddress() + return _u } // SetType sets the "type" field. -func (bu *BouncerUpdate) SetType(s string) *BouncerUpdate { - bu.mutation.SetType(s) - return bu +func (_u *BouncerUpdate) SetType(v string) *BouncerUpdate { + _u.mutation.SetType(v) + return _u } // SetNillableType sets the "type" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableType(s *string) *BouncerUpdate { - if s != nil { - bu.SetType(*s) +func (_u *BouncerUpdate) SetNillableType(v *string) *BouncerUpdate { + if v != nil { + _u.SetType(*v) } - return bu + return _u } // ClearType clears the value of the "type" field. -func (bu *BouncerUpdate) ClearType() *BouncerUpdate { - bu.mutation.ClearType() - return bu +func (_u *BouncerUpdate) ClearType() *BouncerUpdate { + _u.mutation.ClearType() + return _u } // SetVersion sets the "version" field. -func (bu *BouncerUpdate) SetVersion(s string) *BouncerUpdate { - bu.mutation.SetVersion(s) - return bu +func (_u *BouncerUpdate) SetVersion(v string) *BouncerUpdate { + _u.mutation.SetVersion(v) + return _u } // SetNillableVersion sets the "version" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableVersion(s *string) *BouncerUpdate { - if s != nil { - bu.SetVersion(*s) +func (_u *BouncerUpdate) SetNillableVersion(v *string) *BouncerUpdate { + if v != nil { + _u.SetVersion(*v) } - return bu + return _u } // ClearVersion clears the value of the "version" field. -func (bu *BouncerUpdate) ClearVersion() *BouncerUpdate { - bu.mutation.ClearVersion() - return bu +func (_u *BouncerUpdate) ClearVersion() *BouncerUpdate { + _u.mutation.ClearVersion() + return _u } // SetLastPull sets the "last_pull" field. -func (bu *BouncerUpdate) SetLastPull(t time.Time) *BouncerUpdate { - bu.mutation.SetLastPull(t) - return bu +func (_u *BouncerUpdate) SetLastPull(v time.Time) *BouncerUpdate { + _u.mutation.SetLastPull(v) + return _u } // SetNillableLastPull sets the "last_pull" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableLastPull(t *time.Time) *BouncerUpdate { - if t != nil { - bu.SetLastPull(*t) +func (_u *BouncerUpdate) SetNillableLastPull(v *time.Time) *BouncerUpdate { + if v != nil { + _u.SetLastPull(*v) } - return bu + return _u } // ClearLastPull clears the value of the "last_pull" field. -func (bu *BouncerUpdate) ClearLastPull() *BouncerUpdate { - bu.mutation.ClearLastPull() - return bu +func (_u *BouncerUpdate) ClearLastPull() *BouncerUpdate { + _u.mutation.ClearLastPull() + return _u } // SetAuthType sets the "auth_type" field. -func (bu *BouncerUpdate) SetAuthType(s string) *BouncerUpdate { - bu.mutation.SetAuthType(s) - return bu +func (_u *BouncerUpdate) SetAuthType(v string) *BouncerUpdate { + _u.mutation.SetAuthType(v) + return _u } // SetNillableAuthType sets the "auth_type" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableAuthType(s *string) *BouncerUpdate { - if s != nil { - bu.SetAuthType(*s) +func (_u *BouncerUpdate) SetNillableAuthType(v *string) *BouncerUpdate { + if v != nil { + _u.SetAuthType(*v) } - return bu + return _u } // SetOsname sets the "osname" field. -func (bu *BouncerUpdate) SetOsname(s string) *BouncerUpdate { - bu.mutation.SetOsname(s) - return bu +func (_u *BouncerUpdate) SetOsname(v string) *BouncerUpdate { + _u.mutation.SetOsname(v) + return _u } // SetNillableOsname sets the "osname" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableOsname(s *string) *BouncerUpdate { - if s != nil { - bu.SetOsname(*s) +func (_u *BouncerUpdate) SetNillableOsname(v *string) *BouncerUpdate { + if v != nil { + _u.SetOsname(*v) } - return bu + return _u } // ClearOsname clears the value of the "osname" field. -func (bu *BouncerUpdate) ClearOsname() *BouncerUpdate { - bu.mutation.ClearOsname() - return bu +func (_u *BouncerUpdate) ClearOsname() *BouncerUpdate { + _u.mutation.ClearOsname() + return _u } // SetOsfamily sets the "osfamily" field. -func (bu *BouncerUpdate) SetOsfamily(s string) *BouncerUpdate { - bu.mutation.SetOsfamily(s) - return bu +func (_u *BouncerUpdate) SetOsfamily(v string) *BouncerUpdate { + _u.mutation.SetOsfamily(v) + return _u } // SetNillableOsfamily sets the "osfamily" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableOsfamily(s *string) *BouncerUpdate { - if s != nil { - bu.SetOsfamily(*s) +func (_u *BouncerUpdate) SetNillableOsfamily(v *string) *BouncerUpdate { + if v != nil { + _u.SetOsfamily(*v) } - return bu + return _u } // ClearOsfamily clears the value of the "osfamily" field. -func (bu *BouncerUpdate) ClearOsfamily() *BouncerUpdate { - bu.mutation.ClearOsfamily() - return bu +func (_u *BouncerUpdate) ClearOsfamily() *BouncerUpdate { + _u.mutation.ClearOsfamily() + return _u } // SetOsversion sets the "osversion" field. -func (bu *BouncerUpdate) SetOsversion(s string) *BouncerUpdate { - bu.mutation.SetOsversion(s) - return bu +func (_u *BouncerUpdate) SetOsversion(v string) *BouncerUpdate { + _u.mutation.SetOsversion(v) + return _u } // SetNillableOsversion sets the "osversion" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableOsversion(s *string) *BouncerUpdate { - if s != nil { - bu.SetOsversion(*s) +func (_u *BouncerUpdate) SetNillableOsversion(v *string) *BouncerUpdate { + if v != nil { + _u.SetOsversion(*v) } - return bu + return _u } // ClearOsversion clears the value of the "osversion" field. -func (bu *BouncerUpdate) ClearOsversion() *BouncerUpdate { - bu.mutation.ClearOsversion() - return bu +func (_u *BouncerUpdate) ClearOsversion() *BouncerUpdate { + _u.mutation.ClearOsversion() + return _u } // SetFeatureflags sets the "featureflags" field. -func (bu *BouncerUpdate) SetFeatureflags(s string) *BouncerUpdate { - bu.mutation.SetFeatureflags(s) - return bu +func (_u *BouncerUpdate) SetFeatureflags(v string) *BouncerUpdate { + _u.mutation.SetFeatureflags(v) + return _u } // SetNillableFeatureflags sets the "featureflags" field if the given value is not nil. -func (bu *BouncerUpdate) SetNillableFeatureflags(s *string) *BouncerUpdate { - if s != nil { - bu.SetFeatureflags(*s) +func (_u *BouncerUpdate) SetNillableFeatureflags(v *string) *BouncerUpdate { + if v != nil { + _u.SetFeatureflags(*v) } - return bu + return _u } // ClearFeatureflags clears the value of the "featureflags" field. -func (bu *BouncerUpdate) ClearFeatureflags() *BouncerUpdate { - bu.mutation.ClearFeatureflags() - return bu +func (_u *BouncerUpdate) ClearFeatureflags() *BouncerUpdate { + _u.mutation.ClearFeatureflags() + return _u } // Mutation returns the BouncerMutation object of the builder. -func (bu *BouncerUpdate) Mutation() *BouncerMutation { - return bu.mutation +func (_u *BouncerUpdate) Mutation() *BouncerMutation { + return _u.mutation } // Save executes the query and returns the number of nodes affected by the update operation. -func (bu *BouncerUpdate) Save(ctx context.Context) (int, error) { - bu.defaults() - return withHooks(ctx, bu.sqlSave, bu.mutation, bu.hooks) +func (_u *BouncerUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (bu *BouncerUpdate) SaveX(ctx context.Context) int { - affected, err := bu.Save(ctx) +func (_u *BouncerUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -257,96 +257,96 @@ func (bu *BouncerUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (bu *BouncerUpdate) Exec(ctx context.Context) error { - _, err := bu.Save(ctx) +func (_u *BouncerUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (bu *BouncerUpdate) ExecX(ctx context.Context) { - if err := bu.Exec(ctx); err != nil { +func (_u *BouncerUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (bu *BouncerUpdate) defaults() { - if _, ok := bu.mutation.UpdatedAt(); !ok { +func (_u *BouncerUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := bouncer.UpdateDefaultUpdatedAt() - bu.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (bu *BouncerUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *BouncerUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(bouncer.Table, bouncer.Columns, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt)) - if ps := bu.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 := bu.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := bu.mutation.APIKey(); ok { + if value, ok := _u.mutation.APIKey(); ok { _spec.SetField(bouncer.FieldAPIKey, field.TypeString, value) } - if value, ok := bu.mutation.Revoked(); ok { + if value, ok := _u.mutation.Revoked(); ok { _spec.SetField(bouncer.FieldRevoked, field.TypeBool, value) } - if value, ok := bu.mutation.IPAddress(); ok { + if value, ok := _u.mutation.IPAddress(); ok { _spec.SetField(bouncer.FieldIPAddress, field.TypeString, value) } - if bu.mutation.IPAddressCleared() { + if _u.mutation.IPAddressCleared() { _spec.ClearField(bouncer.FieldIPAddress, field.TypeString) } - if value, ok := bu.mutation.GetType(); ok { + if value, ok := _u.mutation.GetType(); ok { _spec.SetField(bouncer.FieldType, field.TypeString, value) } - if bu.mutation.TypeCleared() { + if _u.mutation.TypeCleared() { _spec.ClearField(bouncer.FieldType, field.TypeString) } - if value, ok := bu.mutation.Version(); ok { + if value, ok := _u.mutation.Version(); ok { _spec.SetField(bouncer.FieldVersion, field.TypeString, value) } - if bu.mutation.VersionCleared() { + if _u.mutation.VersionCleared() { _spec.ClearField(bouncer.FieldVersion, field.TypeString) } - if value, ok := bu.mutation.LastPull(); ok { + if value, ok := _u.mutation.LastPull(); ok { _spec.SetField(bouncer.FieldLastPull, field.TypeTime, value) } - if bu.mutation.LastPullCleared() { + if _u.mutation.LastPullCleared() { _spec.ClearField(bouncer.FieldLastPull, field.TypeTime) } - if value, ok := bu.mutation.AuthType(); ok { + if value, ok := _u.mutation.AuthType(); ok { _spec.SetField(bouncer.FieldAuthType, field.TypeString, value) } - if value, ok := bu.mutation.Osname(); ok { + if value, ok := _u.mutation.Osname(); ok { _spec.SetField(bouncer.FieldOsname, field.TypeString, value) } - if bu.mutation.OsnameCleared() { + if _u.mutation.OsnameCleared() { _spec.ClearField(bouncer.FieldOsname, field.TypeString) } - if value, ok := bu.mutation.Osfamily(); ok { + if value, ok := _u.mutation.Osfamily(); ok { _spec.SetField(bouncer.FieldOsfamily, field.TypeString, value) } - if bu.mutation.OsfamilyCleared() { + if _u.mutation.OsfamilyCleared() { _spec.ClearField(bouncer.FieldOsfamily, field.TypeString) } - if value, ok := bu.mutation.Osversion(); ok { + if value, ok := _u.mutation.Osversion(); ok { _spec.SetField(bouncer.FieldOsversion, field.TypeString, value) } - if bu.mutation.OsversionCleared() { + if _u.mutation.OsversionCleared() { _spec.ClearField(bouncer.FieldOsversion, field.TypeString) } - if value, ok := bu.mutation.Featureflags(); ok { + if value, ok := _u.mutation.Featureflags(); ok { _spec.SetField(bouncer.FieldFeatureflags, field.TypeString, value) } - if bu.mutation.FeatureflagsCleared() { + if _u.mutation.FeatureflagsCleared() { _spec.ClearField(bouncer.FieldFeatureflags, field.TypeString) } - if n, err = sqlgraph.UpdateNodes(ctx, bu.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{bouncer.Label} } else if sqlgraph.IsConstraintError(err) { @@ -354,8 +354,8 @@ func (bu *BouncerUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - bu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // BouncerUpdateOne is the builder for updating a single Bouncer entity. @@ -367,240 +367,240 @@ type BouncerUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (buo *BouncerUpdateOne) SetUpdatedAt(t time.Time) *BouncerUpdateOne { - buo.mutation.SetUpdatedAt(t) - return buo +func (_u *BouncerUpdateOne) SetUpdatedAt(v time.Time) *BouncerUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetAPIKey sets the "api_key" field. -func (buo *BouncerUpdateOne) SetAPIKey(s string) *BouncerUpdateOne { - buo.mutation.SetAPIKey(s) - return buo +func (_u *BouncerUpdateOne) SetAPIKey(v string) *BouncerUpdateOne { + _u.mutation.SetAPIKey(v) + return _u } // SetNillableAPIKey sets the "api_key" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableAPIKey(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetAPIKey(*s) +func (_u *BouncerUpdateOne) SetNillableAPIKey(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetAPIKey(*v) } - return buo + return _u } // SetRevoked sets the "revoked" field. -func (buo *BouncerUpdateOne) SetRevoked(b bool) *BouncerUpdateOne { - buo.mutation.SetRevoked(b) - return buo +func (_u *BouncerUpdateOne) SetRevoked(v bool) *BouncerUpdateOne { + _u.mutation.SetRevoked(v) + return _u } // SetNillableRevoked sets the "revoked" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableRevoked(b *bool) *BouncerUpdateOne { - if b != nil { - buo.SetRevoked(*b) +func (_u *BouncerUpdateOne) SetNillableRevoked(v *bool) *BouncerUpdateOne { + if v != nil { + _u.SetRevoked(*v) } - return buo + return _u } // SetIPAddress sets the "ip_address" field. -func (buo *BouncerUpdateOne) SetIPAddress(s string) *BouncerUpdateOne { - buo.mutation.SetIPAddress(s) - return buo +func (_u *BouncerUpdateOne) SetIPAddress(v string) *BouncerUpdateOne { + _u.mutation.SetIPAddress(v) + return _u } // SetNillableIPAddress sets the "ip_address" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableIPAddress(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetIPAddress(*s) +func (_u *BouncerUpdateOne) SetNillableIPAddress(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetIPAddress(*v) } - return buo + return _u } // ClearIPAddress clears the value of the "ip_address" field. -func (buo *BouncerUpdateOne) ClearIPAddress() *BouncerUpdateOne { - buo.mutation.ClearIPAddress() - return buo +func (_u *BouncerUpdateOne) ClearIPAddress() *BouncerUpdateOne { + _u.mutation.ClearIPAddress() + return _u } // SetType sets the "type" field. -func (buo *BouncerUpdateOne) SetType(s string) *BouncerUpdateOne { - buo.mutation.SetType(s) - return buo +func (_u *BouncerUpdateOne) SetType(v string) *BouncerUpdateOne { + _u.mutation.SetType(v) + return _u } // SetNillableType sets the "type" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableType(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetType(*s) +func (_u *BouncerUpdateOne) SetNillableType(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetType(*v) } - return buo + return _u } // ClearType clears the value of the "type" field. -func (buo *BouncerUpdateOne) ClearType() *BouncerUpdateOne { - buo.mutation.ClearType() - return buo +func (_u *BouncerUpdateOne) ClearType() *BouncerUpdateOne { + _u.mutation.ClearType() + return _u } // SetVersion sets the "version" field. -func (buo *BouncerUpdateOne) SetVersion(s string) *BouncerUpdateOne { - buo.mutation.SetVersion(s) - return buo +func (_u *BouncerUpdateOne) SetVersion(v string) *BouncerUpdateOne { + _u.mutation.SetVersion(v) + return _u } // SetNillableVersion sets the "version" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableVersion(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetVersion(*s) +func (_u *BouncerUpdateOne) SetNillableVersion(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetVersion(*v) } - return buo + return _u } // ClearVersion clears the value of the "version" field. -func (buo *BouncerUpdateOne) ClearVersion() *BouncerUpdateOne { - buo.mutation.ClearVersion() - return buo +func (_u *BouncerUpdateOne) ClearVersion() *BouncerUpdateOne { + _u.mutation.ClearVersion() + return _u } // SetLastPull sets the "last_pull" field. -func (buo *BouncerUpdateOne) SetLastPull(t time.Time) *BouncerUpdateOne { - buo.mutation.SetLastPull(t) - return buo +func (_u *BouncerUpdateOne) SetLastPull(v time.Time) *BouncerUpdateOne { + _u.mutation.SetLastPull(v) + return _u } // SetNillableLastPull sets the "last_pull" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableLastPull(t *time.Time) *BouncerUpdateOne { - if t != nil { - buo.SetLastPull(*t) +func (_u *BouncerUpdateOne) SetNillableLastPull(v *time.Time) *BouncerUpdateOne { + if v != nil { + _u.SetLastPull(*v) } - return buo + return _u } // ClearLastPull clears the value of the "last_pull" field. -func (buo *BouncerUpdateOne) ClearLastPull() *BouncerUpdateOne { - buo.mutation.ClearLastPull() - return buo +func (_u *BouncerUpdateOne) ClearLastPull() *BouncerUpdateOne { + _u.mutation.ClearLastPull() + return _u } // SetAuthType sets the "auth_type" field. -func (buo *BouncerUpdateOne) SetAuthType(s string) *BouncerUpdateOne { - buo.mutation.SetAuthType(s) - return buo +func (_u *BouncerUpdateOne) SetAuthType(v string) *BouncerUpdateOne { + _u.mutation.SetAuthType(v) + return _u } // SetNillableAuthType sets the "auth_type" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableAuthType(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetAuthType(*s) +func (_u *BouncerUpdateOne) SetNillableAuthType(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetAuthType(*v) } - return buo + return _u } // SetOsname sets the "osname" field. -func (buo *BouncerUpdateOne) SetOsname(s string) *BouncerUpdateOne { - buo.mutation.SetOsname(s) - return buo +func (_u *BouncerUpdateOne) SetOsname(v string) *BouncerUpdateOne { + _u.mutation.SetOsname(v) + return _u } // SetNillableOsname sets the "osname" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableOsname(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetOsname(*s) +func (_u *BouncerUpdateOne) SetNillableOsname(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetOsname(*v) } - return buo + return _u } // ClearOsname clears the value of the "osname" field. -func (buo *BouncerUpdateOne) ClearOsname() *BouncerUpdateOne { - buo.mutation.ClearOsname() - return buo +func (_u *BouncerUpdateOne) ClearOsname() *BouncerUpdateOne { + _u.mutation.ClearOsname() + return _u } // SetOsfamily sets the "osfamily" field. -func (buo *BouncerUpdateOne) SetOsfamily(s string) *BouncerUpdateOne { - buo.mutation.SetOsfamily(s) - return buo +func (_u *BouncerUpdateOne) SetOsfamily(v string) *BouncerUpdateOne { + _u.mutation.SetOsfamily(v) + return _u } // SetNillableOsfamily sets the "osfamily" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableOsfamily(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetOsfamily(*s) +func (_u *BouncerUpdateOne) SetNillableOsfamily(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetOsfamily(*v) } - return buo + return _u } // ClearOsfamily clears the value of the "osfamily" field. -func (buo *BouncerUpdateOne) ClearOsfamily() *BouncerUpdateOne { - buo.mutation.ClearOsfamily() - return buo +func (_u *BouncerUpdateOne) ClearOsfamily() *BouncerUpdateOne { + _u.mutation.ClearOsfamily() + return _u } // SetOsversion sets the "osversion" field. -func (buo *BouncerUpdateOne) SetOsversion(s string) *BouncerUpdateOne { - buo.mutation.SetOsversion(s) - return buo +func (_u *BouncerUpdateOne) SetOsversion(v string) *BouncerUpdateOne { + _u.mutation.SetOsversion(v) + return _u } // SetNillableOsversion sets the "osversion" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableOsversion(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetOsversion(*s) +func (_u *BouncerUpdateOne) SetNillableOsversion(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetOsversion(*v) } - return buo + return _u } // ClearOsversion clears the value of the "osversion" field. -func (buo *BouncerUpdateOne) ClearOsversion() *BouncerUpdateOne { - buo.mutation.ClearOsversion() - return buo +func (_u *BouncerUpdateOne) ClearOsversion() *BouncerUpdateOne { + _u.mutation.ClearOsversion() + return _u } // SetFeatureflags sets the "featureflags" field. -func (buo *BouncerUpdateOne) SetFeatureflags(s string) *BouncerUpdateOne { - buo.mutation.SetFeatureflags(s) - return buo +func (_u *BouncerUpdateOne) SetFeatureflags(v string) *BouncerUpdateOne { + _u.mutation.SetFeatureflags(v) + return _u } // SetNillableFeatureflags sets the "featureflags" field if the given value is not nil. -func (buo *BouncerUpdateOne) SetNillableFeatureflags(s *string) *BouncerUpdateOne { - if s != nil { - buo.SetFeatureflags(*s) +func (_u *BouncerUpdateOne) SetNillableFeatureflags(v *string) *BouncerUpdateOne { + if v != nil { + _u.SetFeatureflags(*v) } - return buo + return _u } // ClearFeatureflags clears the value of the "featureflags" field. -func (buo *BouncerUpdateOne) ClearFeatureflags() *BouncerUpdateOne { - buo.mutation.ClearFeatureflags() - return buo +func (_u *BouncerUpdateOne) ClearFeatureflags() *BouncerUpdateOne { + _u.mutation.ClearFeatureflags() + return _u } // Mutation returns the BouncerMutation object of the builder. -func (buo *BouncerUpdateOne) Mutation() *BouncerMutation { - return buo.mutation +func (_u *BouncerUpdateOne) Mutation() *BouncerMutation { + return _u.mutation } // Where appends a list predicates to the BouncerUpdate builder. -func (buo *BouncerUpdateOne) Where(ps ...predicate.Bouncer) *BouncerUpdateOne { - buo.mutation.Where(ps...) - return buo +func (_u *BouncerUpdateOne) Where(ps ...predicate.Bouncer) *BouncerUpdateOne { + _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 (buo *BouncerUpdateOne) Select(field string, fields ...string) *BouncerUpdateOne { - buo.fields = append([]string{field}, fields...) - return buo +func (_u *BouncerUpdateOne) Select(field string, fields ...string) *BouncerUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Bouncer entity. -func (buo *BouncerUpdateOne) Save(ctx context.Context) (*Bouncer, error) { - buo.defaults() - return withHooks(ctx, buo.sqlSave, buo.mutation, buo.hooks) +func (_u *BouncerUpdateOne) Save(ctx context.Context) (*Bouncer, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (buo *BouncerUpdateOne) SaveX(ctx context.Context) *Bouncer { - node, err := buo.Save(ctx) +func (_u *BouncerUpdateOne) SaveX(ctx context.Context) *Bouncer { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -608,34 +608,34 @@ func (buo *BouncerUpdateOne) SaveX(ctx context.Context) *Bouncer { } // Exec executes the query on the entity. -func (buo *BouncerUpdateOne) Exec(ctx context.Context) error { - _, err := buo.Save(ctx) +func (_u *BouncerUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (buo *BouncerUpdateOne) ExecX(ctx context.Context) { - if err := buo.Exec(ctx); err != nil { +func (_u *BouncerUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (buo *BouncerUpdateOne) defaults() { - if _, ok := buo.mutation.UpdatedAt(); !ok { +func (_u *BouncerUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := bouncer.UpdateDefaultUpdatedAt() - buo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (buo *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err error) { +func (_u *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err error) { _spec := sqlgraph.NewUpdateSpec(bouncer.Table, bouncer.Columns, sqlgraph.NewFieldSpec(bouncer.FieldID, field.TypeInt)) - id, ok := buo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Bouncer.id" for update`)} } _spec.Node.ID.Value = id - if fields := buo.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, bouncer.FieldID) for _, f := range fields { @@ -647,77 +647,77 @@ func (buo *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err e } } } - if ps := buo.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 := buo.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := buo.mutation.APIKey(); ok { + if value, ok := _u.mutation.APIKey(); ok { _spec.SetField(bouncer.FieldAPIKey, field.TypeString, value) } - if value, ok := buo.mutation.Revoked(); ok { + if value, ok := _u.mutation.Revoked(); ok { _spec.SetField(bouncer.FieldRevoked, field.TypeBool, value) } - if value, ok := buo.mutation.IPAddress(); ok { + if value, ok := _u.mutation.IPAddress(); ok { _spec.SetField(bouncer.FieldIPAddress, field.TypeString, value) } - if buo.mutation.IPAddressCleared() { + if _u.mutation.IPAddressCleared() { _spec.ClearField(bouncer.FieldIPAddress, field.TypeString) } - if value, ok := buo.mutation.GetType(); ok { + if value, ok := _u.mutation.GetType(); ok { _spec.SetField(bouncer.FieldType, field.TypeString, value) } - if buo.mutation.TypeCleared() { + if _u.mutation.TypeCleared() { _spec.ClearField(bouncer.FieldType, field.TypeString) } - if value, ok := buo.mutation.Version(); ok { + if value, ok := _u.mutation.Version(); ok { _spec.SetField(bouncer.FieldVersion, field.TypeString, value) } - if buo.mutation.VersionCleared() { + if _u.mutation.VersionCleared() { _spec.ClearField(bouncer.FieldVersion, field.TypeString) } - if value, ok := buo.mutation.LastPull(); ok { + if value, ok := _u.mutation.LastPull(); ok { _spec.SetField(bouncer.FieldLastPull, field.TypeTime, value) } - if buo.mutation.LastPullCleared() { + if _u.mutation.LastPullCleared() { _spec.ClearField(bouncer.FieldLastPull, field.TypeTime) } - if value, ok := buo.mutation.AuthType(); ok { + if value, ok := _u.mutation.AuthType(); ok { _spec.SetField(bouncer.FieldAuthType, field.TypeString, value) } - if value, ok := buo.mutation.Osname(); ok { + if value, ok := _u.mutation.Osname(); ok { _spec.SetField(bouncer.FieldOsname, field.TypeString, value) } - if buo.mutation.OsnameCleared() { + if _u.mutation.OsnameCleared() { _spec.ClearField(bouncer.FieldOsname, field.TypeString) } - if value, ok := buo.mutation.Osfamily(); ok { + if value, ok := _u.mutation.Osfamily(); ok { _spec.SetField(bouncer.FieldOsfamily, field.TypeString, value) } - if buo.mutation.OsfamilyCleared() { + if _u.mutation.OsfamilyCleared() { _spec.ClearField(bouncer.FieldOsfamily, field.TypeString) } - if value, ok := buo.mutation.Osversion(); ok { + if value, ok := _u.mutation.Osversion(); ok { _spec.SetField(bouncer.FieldOsversion, field.TypeString, value) } - if buo.mutation.OsversionCleared() { + if _u.mutation.OsversionCleared() { _spec.ClearField(bouncer.FieldOsversion, field.TypeString) } - if value, ok := buo.mutation.Featureflags(); ok { + if value, ok := _u.mutation.Featureflags(); ok { _spec.SetField(bouncer.FieldFeatureflags, field.TypeString, value) } - if buo.mutation.FeatureflagsCleared() { + if _u.mutation.FeatureflagsCleared() { _spec.ClearField(bouncer.FieldFeatureflags, field.TypeString) } - _node = &Bouncer{config: buo.config} + _node = &Bouncer{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, buo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{bouncer.Label} } else if sqlgraph.IsConstraintError(err) { @@ -725,6 +725,6 @@ func (buo *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err e } return nil, err } - buo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/client.go b/pkg/database/ent/client.go index bc7c03304..fbf9eb097 100644 --- a/pkg/database/ent/client.go +++ b/pkg/database/ent/client.go @@ -342,8 +342,8 @@ func (c *AlertClient) Update() *AlertUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *AlertClient) UpdateOne(a *Alert) *AlertUpdateOne { - mutation := newAlertMutation(c.config, OpUpdateOne, withAlert(a)) +func (c *AlertClient) UpdateOne(_m *Alert) *AlertUpdateOne { + mutation := newAlertMutation(c.config, OpUpdateOne, withAlert(_m)) return &AlertUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -360,8 +360,8 @@ func (c *AlertClient) Delete() *AlertDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *AlertClient) DeleteOne(a *Alert) *AlertDeleteOne { - return c.DeleteOneID(a.ID) +func (c *AlertClient) DeleteOne(_m *Alert) *AlertDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -396,64 +396,64 @@ func (c *AlertClient) GetX(ctx context.Context, id int) *Alert { } // QueryOwner queries the owner edge of a Alert. -func (c *AlertClient) QueryOwner(a *Alert) *MachineQuery { +func (c *AlertClient) QueryOwner(_m *Alert) *MachineQuery { query := (&MachineClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := a.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(alert.Table, alert.FieldID, id), sqlgraph.To(machine.Table, machine.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, alert.OwnerTable, alert.OwnerColumn), ) - fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryDecisions queries the decisions edge of a Alert. -func (c *AlertClient) QueryDecisions(a *Alert) *DecisionQuery { +func (c *AlertClient) QueryDecisions(_m *Alert) *DecisionQuery { query := (&DecisionClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := a.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(alert.Table, alert.FieldID, id), sqlgraph.To(decision.Table, decision.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, alert.DecisionsTable, alert.DecisionsColumn), ) - fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryEvents queries the events edge of a Alert. -func (c *AlertClient) QueryEvents(a *Alert) *EventQuery { +func (c *AlertClient) QueryEvents(_m *Alert) *EventQuery { query := (&EventClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := a.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(alert.Table, alert.FieldID, id), sqlgraph.To(event.Table, event.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, alert.EventsTable, alert.EventsColumn), ) - fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query } // QueryMetas queries the metas edge of a Alert. -func (c *AlertClient) QueryMetas(a *Alert) *MetaQuery { +func (c *AlertClient) QueryMetas(_m *Alert) *MetaQuery { query := (&MetaClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := a.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(alert.Table, alert.FieldID, id), sqlgraph.To(meta.Table, meta.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, alert.MetasTable, alert.MetasColumn), ) - fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query @@ -539,8 +539,8 @@ func (c *AllowListClient) Update() *AllowListUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *AllowListClient) UpdateOne(al *AllowList) *AllowListUpdateOne { - mutation := newAllowListMutation(c.config, OpUpdateOne, withAllowList(al)) +func (c *AllowListClient) UpdateOne(_m *AllowList) *AllowListUpdateOne { + mutation := newAllowListMutation(c.config, OpUpdateOne, withAllowList(_m)) return &AllowListUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -557,8 +557,8 @@ func (c *AllowListClient) Delete() *AllowListDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *AllowListClient) DeleteOne(al *AllowList) *AllowListDeleteOne { - return c.DeleteOneID(al.ID) +func (c *AllowListClient) DeleteOne(_m *AllowList) *AllowListDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -593,16 +593,16 @@ func (c *AllowListClient) GetX(ctx context.Context, id int) *AllowList { } // QueryAllowlistItems queries the allowlist_items edge of a AllowList. -func (c *AllowListClient) QueryAllowlistItems(al *AllowList) *AllowListItemQuery { +func (c *AllowListClient) QueryAllowlistItems(_m *AllowList) *AllowListItemQuery { query := (&AllowListItemClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := al.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(allowlist.Table, allowlist.FieldID, id), sqlgraph.To(allowlistitem.Table, allowlistitem.FieldID), sqlgraph.Edge(sqlgraph.M2M, false, allowlist.AllowlistItemsTable, allowlist.AllowlistItemsPrimaryKey...), ) - fromV = sqlgraph.Neighbors(al.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query @@ -688,8 +688,8 @@ func (c *AllowListItemClient) Update() *AllowListItemUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *AllowListItemClient) UpdateOne(ali *AllowListItem) *AllowListItemUpdateOne { - mutation := newAllowListItemMutation(c.config, OpUpdateOne, withAllowListItem(ali)) +func (c *AllowListItemClient) UpdateOne(_m *AllowListItem) *AllowListItemUpdateOne { + mutation := newAllowListItemMutation(c.config, OpUpdateOne, withAllowListItem(_m)) return &AllowListItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -706,8 +706,8 @@ func (c *AllowListItemClient) Delete() *AllowListItemDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *AllowListItemClient) DeleteOne(ali *AllowListItem) *AllowListItemDeleteOne { - return c.DeleteOneID(ali.ID) +func (c *AllowListItemClient) DeleteOne(_m *AllowListItem) *AllowListItemDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -742,16 +742,16 @@ func (c *AllowListItemClient) GetX(ctx context.Context, id int) *AllowListItem { } // QueryAllowlist queries the allowlist edge of a AllowListItem. -func (c *AllowListItemClient) QueryAllowlist(ali *AllowListItem) *AllowListQuery { +func (c *AllowListItemClient) QueryAllowlist(_m *AllowListItem) *AllowListQuery { query := (&AllowListClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := ali.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(allowlistitem.Table, allowlistitem.FieldID, id), sqlgraph.To(allowlist.Table, allowlist.FieldID), sqlgraph.Edge(sqlgraph.M2M, true, allowlistitem.AllowlistTable, allowlistitem.AllowlistPrimaryKey...), ) - fromV = sqlgraph.Neighbors(ali.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query @@ -837,8 +837,8 @@ func (c *BouncerClient) Update() *BouncerUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *BouncerClient) UpdateOne(b *Bouncer) *BouncerUpdateOne { - mutation := newBouncerMutation(c.config, OpUpdateOne, withBouncer(b)) +func (c *BouncerClient) UpdateOne(_m *Bouncer) *BouncerUpdateOne { + mutation := newBouncerMutation(c.config, OpUpdateOne, withBouncer(_m)) return &BouncerUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -855,8 +855,8 @@ func (c *BouncerClient) Delete() *BouncerDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *BouncerClient) DeleteOne(b *Bouncer) *BouncerDeleteOne { - return c.DeleteOneID(b.ID) +func (c *BouncerClient) DeleteOne(_m *Bouncer) *BouncerDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -970,8 +970,8 @@ func (c *ConfigItemClient) Update() *ConfigItemUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *ConfigItemClient) UpdateOne(ci *ConfigItem) *ConfigItemUpdateOne { - mutation := newConfigItemMutation(c.config, OpUpdateOne, withConfigItem(ci)) +func (c *ConfigItemClient) UpdateOne(_m *ConfigItem) *ConfigItemUpdateOne { + mutation := newConfigItemMutation(c.config, OpUpdateOne, withConfigItem(_m)) return &ConfigItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -988,8 +988,8 @@ func (c *ConfigItemClient) Delete() *ConfigItemDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *ConfigItemClient) DeleteOne(ci *ConfigItem) *ConfigItemDeleteOne { - return c.DeleteOneID(ci.ID) +func (c *ConfigItemClient) DeleteOne(_m *ConfigItem) *ConfigItemDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -1103,8 +1103,8 @@ func (c *DecisionClient) Update() *DecisionUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *DecisionClient) UpdateOne(d *Decision) *DecisionUpdateOne { - mutation := newDecisionMutation(c.config, OpUpdateOne, withDecision(d)) +func (c *DecisionClient) UpdateOne(_m *Decision) *DecisionUpdateOne { + mutation := newDecisionMutation(c.config, OpUpdateOne, withDecision(_m)) return &DecisionUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -1121,8 +1121,8 @@ func (c *DecisionClient) Delete() *DecisionDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *DecisionClient) DeleteOne(d *Decision) *DecisionDeleteOne { - return c.DeleteOneID(d.ID) +func (c *DecisionClient) DeleteOne(_m *Decision) *DecisionDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -1157,16 +1157,16 @@ func (c *DecisionClient) GetX(ctx context.Context, id int) *Decision { } // QueryOwner queries the owner edge of a Decision. -func (c *DecisionClient) QueryOwner(d *Decision) *AlertQuery { +func (c *DecisionClient) QueryOwner(_m *Decision) *AlertQuery { query := (&AlertClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := d.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(decision.Table, decision.FieldID, id), sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, decision.OwnerTable, decision.OwnerColumn), ) - fromV = sqlgraph.Neighbors(d.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query @@ -1252,8 +1252,8 @@ func (c *EventClient) Update() *EventUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *EventClient) UpdateOne(e *Event) *EventUpdateOne { - mutation := newEventMutation(c.config, OpUpdateOne, withEvent(e)) +func (c *EventClient) UpdateOne(_m *Event) *EventUpdateOne { + mutation := newEventMutation(c.config, OpUpdateOne, withEvent(_m)) return &EventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -1270,8 +1270,8 @@ func (c *EventClient) Delete() *EventDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne { - return c.DeleteOneID(e.ID) +func (c *EventClient) DeleteOne(_m *Event) *EventDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -1306,16 +1306,16 @@ func (c *EventClient) GetX(ctx context.Context, id int) *Event { } // QueryOwner queries the owner edge of a Event. -func (c *EventClient) QueryOwner(e *Event) *AlertQuery { +func (c *EventClient) QueryOwner(_m *Event) *AlertQuery { query := (&AlertClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := e.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(event.Table, event.FieldID, id), sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, event.OwnerTable, event.OwnerColumn), ) - fromV = sqlgraph.Neighbors(e.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query @@ -1401,8 +1401,8 @@ func (c *LockClient) Update() *LockUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *LockClient) UpdateOne(l *Lock) *LockUpdateOne { - mutation := newLockMutation(c.config, OpUpdateOne, withLock(l)) +func (c *LockClient) UpdateOne(_m *Lock) *LockUpdateOne { + mutation := newLockMutation(c.config, OpUpdateOne, withLock(_m)) return &LockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -1419,8 +1419,8 @@ func (c *LockClient) Delete() *LockDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *LockClient) DeleteOne(l *Lock) *LockDeleteOne { - return c.DeleteOneID(l.ID) +func (c *LockClient) DeleteOne(_m *Lock) *LockDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -1534,8 +1534,8 @@ func (c *MachineClient) Update() *MachineUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *MachineClient) UpdateOne(m *Machine) *MachineUpdateOne { - mutation := newMachineMutation(c.config, OpUpdateOne, withMachine(m)) +func (c *MachineClient) UpdateOne(_m *Machine) *MachineUpdateOne { + mutation := newMachineMutation(c.config, OpUpdateOne, withMachine(_m)) return &MachineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -1552,8 +1552,8 @@ func (c *MachineClient) Delete() *MachineDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *MachineClient) DeleteOne(m *Machine) *MachineDeleteOne { - return c.DeleteOneID(m.ID) +func (c *MachineClient) DeleteOne(_m *Machine) *MachineDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -1588,16 +1588,16 @@ func (c *MachineClient) GetX(ctx context.Context, id int) *Machine { } // QueryAlerts queries the alerts edge of a Machine. -func (c *MachineClient) QueryAlerts(m *Machine) *AlertQuery { +func (c *MachineClient) QueryAlerts(_m *Machine) *AlertQuery { query := (&AlertClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := m.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(machine.Table, machine.FieldID, id), sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, machine.AlertsTable, machine.AlertsColumn), ) - fromV = sqlgraph.Neighbors(m.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query @@ -1683,8 +1683,8 @@ func (c *MetaClient) Update() *MetaUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *MetaClient) UpdateOne(m *Meta) *MetaUpdateOne { - mutation := newMetaMutation(c.config, OpUpdateOne, withMeta(m)) +func (c *MetaClient) UpdateOne(_m *Meta) *MetaUpdateOne { + mutation := newMetaMutation(c.config, OpUpdateOne, withMeta(_m)) return &MetaUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -1701,8 +1701,8 @@ func (c *MetaClient) Delete() *MetaDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *MetaClient) DeleteOne(m *Meta) *MetaDeleteOne { - return c.DeleteOneID(m.ID) +func (c *MetaClient) DeleteOne(_m *Meta) *MetaDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. @@ -1737,16 +1737,16 @@ func (c *MetaClient) GetX(ctx context.Context, id int) *Meta { } // QueryOwner queries the owner edge of a Meta. -func (c *MetaClient) QueryOwner(m *Meta) *AlertQuery { +func (c *MetaClient) QueryOwner(_m *Meta) *AlertQuery { query := (&AlertClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := m.ID + id := _m.ID step := sqlgraph.NewStep( sqlgraph.From(meta.Table, meta.FieldID, id), sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, meta.OwnerTable, meta.OwnerColumn), ) - fromV = sqlgraph.Neighbors(m.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step) return fromV, nil } return query @@ -1832,8 +1832,8 @@ func (c *MetricClient) Update() *MetricUpdate { } // UpdateOne returns an update builder for the given entity. -func (c *MetricClient) UpdateOne(m *Metric) *MetricUpdateOne { - mutation := newMetricMutation(c.config, OpUpdateOne, withMetric(m)) +func (c *MetricClient) UpdateOne(_m *Metric) *MetricUpdateOne { + mutation := newMetricMutation(c.config, OpUpdateOne, withMetric(_m)) return &MetricUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } @@ -1850,8 +1850,8 @@ func (c *MetricClient) Delete() *MetricDelete { } // DeleteOne returns a builder for deleting the given entity. -func (c *MetricClient) DeleteOne(m *Metric) *MetricDeleteOne { - return c.DeleteOneID(m.ID) +func (c *MetricClient) DeleteOne(_m *Metric) *MetricDeleteOne { + return c.DeleteOneID(_m.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. diff --git a/pkg/database/ent/configitem.go b/pkg/database/ent/configitem.go index bdf23ef49..73ff09c94 100644 --- a/pkg/database/ent/configitem.go +++ b/pkg/database/ent/configitem.go @@ -48,7 +48,7 @@ func (*ConfigItem) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the ConfigItem fields. -func (ci *ConfigItem) assignValues(columns []string, values []any) error { +func (_m *ConfigItem) 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) } @@ -59,33 +59,33 @@ func (ci *ConfigItem) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - ci.ID = int(value.Int64) + _m.ID = int(value.Int64) case configitem.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - ci.CreatedAt = value.Time + _m.CreatedAt = value.Time } case configitem.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - ci.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case configitem.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { - ci.Name = value.String + _m.Name = value.String } case configitem.FieldValue: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field value", values[i]) } else if value.Valid { - ci.Value = value.String + _m.Value = value.String } default: - ci.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -93,44 +93,44 @@ func (ci *ConfigItem) assignValues(columns []string, values []any) error { // GetValue returns the ent.Value that was dynamically selected and assigned to the ConfigItem. // This includes values selected through modifiers, order, etc. -func (ci *ConfigItem) GetValue(name string) (ent.Value, error) { - return ci.selectValues.Get(name) +func (_m *ConfigItem) GetValue(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // Update returns a builder for updating this ConfigItem. // Note that you need to call ConfigItem.Unwrap() before calling this method if this ConfigItem // was returned from a transaction, and the transaction was committed or rolled back. -func (ci *ConfigItem) Update() *ConfigItemUpdateOne { - return NewConfigItemClient(ci.config).UpdateOne(ci) +func (_m *ConfigItem) Update() *ConfigItemUpdateOne { + return NewConfigItemClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the ConfigItem 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 (ci *ConfigItem) Unwrap() *ConfigItem { - _tx, ok := ci.config.driver.(*txDriver) +func (_m *ConfigItem) Unwrap() *ConfigItem { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: ConfigItem is not a transactional entity") } - ci.config.driver = _tx.drv - return ci + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (ci *ConfigItem) String() string { +func (_m *ConfigItem) String() string { var builder strings.Builder builder.WriteString("ConfigItem(") - builder.WriteString(fmt.Sprintf("id=%v, ", ci.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(ci.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(ci.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("name=") - builder.WriteString(ci.Name) + builder.WriteString(_m.Name) builder.WriteString(", ") builder.WriteString("value=") - builder.WriteString(ci.Value) + builder.WriteString(_m.Value) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/configitem_create.go b/pkg/database/ent/configitem_create.go index e4149f654..de144bad9 100644 --- a/pkg/database/ent/configitem_create.go +++ b/pkg/database/ent/configitem_create.go @@ -23,59 +23,59 @@ type ConfigItemCreate struct { } // SetCreatedAt sets the "created_at" field. -func (cic *ConfigItemCreate) SetCreatedAt(t time.Time) *ConfigItemCreate { - cic.mutation.SetCreatedAt(t) - return cic +func (_c *ConfigItemCreate) SetCreatedAt(v time.Time) *ConfigItemCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (cic *ConfigItemCreate) SetNillableCreatedAt(t *time.Time) *ConfigItemCreate { - if t != nil { - cic.SetCreatedAt(*t) +func (_c *ConfigItemCreate) SetNillableCreatedAt(v *time.Time) *ConfigItemCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return cic + return _c } // SetUpdatedAt sets the "updated_at" field. -func (cic *ConfigItemCreate) SetUpdatedAt(t time.Time) *ConfigItemCreate { - cic.mutation.SetUpdatedAt(t) - return cic +func (_c *ConfigItemCreate) SetUpdatedAt(v time.Time) *ConfigItemCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (cic *ConfigItemCreate) SetNillableUpdatedAt(t *time.Time) *ConfigItemCreate { - if t != nil { - cic.SetUpdatedAt(*t) +func (_c *ConfigItemCreate) SetNillableUpdatedAt(v *time.Time) *ConfigItemCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return cic + return _c } // SetName sets the "name" field. -func (cic *ConfigItemCreate) SetName(s string) *ConfigItemCreate { - cic.mutation.SetName(s) - return cic +func (_c *ConfigItemCreate) SetName(v string) *ConfigItemCreate { + _c.mutation.SetName(v) + return _c } // SetValue sets the "value" field. -func (cic *ConfigItemCreate) SetValue(s string) *ConfigItemCreate { - cic.mutation.SetValue(s) - return cic +func (_c *ConfigItemCreate) SetValue(v string) *ConfigItemCreate { + _c.mutation.SetValue(v) + return _c } // Mutation returns the ConfigItemMutation object of the builder. -func (cic *ConfigItemCreate) Mutation() *ConfigItemMutation { - return cic.mutation +func (_c *ConfigItemCreate) Mutation() *ConfigItemMutation { + return _c.mutation } // Save creates the ConfigItem in the database. -func (cic *ConfigItemCreate) Save(ctx context.Context) (*ConfigItem, error) { - cic.defaults() - return withHooks(ctx, cic.sqlSave, cic.mutation, cic.hooks) +func (_c *ConfigItemCreate) Save(ctx context.Context) (*ConfigItem, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (cic *ConfigItemCreate) SaveX(ctx context.Context) *ConfigItem { - v, err := cic.Save(ctx) +func (_c *ConfigItemCreate) SaveX(ctx context.Context) *ConfigItem { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -83,53 +83,53 @@ func (cic *ConfigItemCreate) SaveX(ctx context.Context) *ConfigItem { } // Exec executes the query. -func (cic *ConfigItemCreate) Exec(ctx context.Context) error { - _, err := cic.Save(ctx) +func (_c *ConfigItemCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (cic *ConfigItemCreate) ExecX(ctx context.Context) { - if err := cic.Exec(ctx); err != nil { +func (_c *ConfigItemCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (cic *ConfigItemCreate) defaults() { - if _, ok := cic.mutation.CreatedAt(); !ok { +func (_c *ConfigItemCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := configitem.DefaultCreatedAt() - cic.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := cic.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := configitem.DefaultUpdatedAt() - cic.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (cic *ConfigItemCreate) check() error { - if _, ok := cic.mutation.CreatedAt(); !ok { +func (_c *ConfigItemCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ConfigItem.created_at"`)} } - if _, ok := cic.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ConfigItem.updated_at"`)} } - if _, ok := cic.mutation.Name(); !ok { + if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "ConfigItem.name"`)} } - if _, ok := cic.mutation.Value(); !ok { + if _, ok := _c.mutation.Value(); !ok { return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "ConfigItem.value"`)} } return nil } -func (cic *ConfigItemCreate) sqlSave(ctx context.Context) (*ConfigItem, error) { - if err := cic.check(); err != nil { +func (_c *ConfigItemCreate) sqlSave(ctx context.Context) (*ConfigItem, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := cic.createSpec() - if err := sqlgraph.CreateNode(ctx, cic.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -137,30 +137,30 @@ func (cic *ConfigItemCreate) sqlSave(ctx context.Context) (*ConfigItem, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - cic.mutation.id = &_node.ID - cic.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (cic *ConfigItemCreate) createSpec() (*ConfigItem, *sqlgraph.CreateSpec) { +func (_c *ConfigItemCreate) createSpec() (*ConfigItem, *sqlgraph.CreateSpec) { var ( - _node = &ConfigItem{config: cic.config} + _node = &ConfigItem{config: _c.config} _spec = sqlgraph.NewCreateSpec(configitem.Table, sqlgraph.NewFieldSpec(configitem.FieldID, field.TypeInt)) ) - _spec.OnConflict = cic.conflict - if value, ok := cic.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(configitem.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := cic.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(configitem.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := cic.mutation.Name(); ok { + if value, ok := _c.mutation.Name(); ok { _spec.SetField(configitem.FieldName, field.TypeString, value) _node.Name = value } - if value, ok := cic.mutation.Value(); ok { + if value, ok := _c.mutation.Value(); ok { _spec.SetField(configitem.FieldValue, field.TypeString, value) _node.Value = value } @@ -183,10 +183,10 @@ func (cic *ConfigItemCreate) createSpec() (*ConfigItem, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (cic *ConfigItemCreate) OnConflict(opts ...sql.ConflictOption) *ConfigItemUpsertOne { - cic.conflict = opts +func (_c *ConfigItemCreate) OnConflict(opts ...sql.ConflictOption) *ConfigItemUpsertOne { + _c.conflict = opts return &ConfigItemUpsertOne{ - create: cic, + create: _c, } } @@ -196,10 +196,10 @@ func (cic *ConfigItemCreate) OnConflict(opts ...sql.ConflictOption) *ConfigItemU // client.ConfigItem.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (cic *ConfigItemCreate) OnConflictColumns(columns ...string) *ConfigItemUpsertOne { - cic.conflict = append(cic.conflict, sql.ConflictColumns(columns...)) +func (_c *ConfigItemCreate) OnConflictColumns(columns ...string) *ConfigItemUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &ConfigItemUpsertOne{ - create: cic, + create: _c, } } @@ -358,16 +358,16 @@ type ConfigItemCreateBulk struct { } // Save creates the ConfigItem entities in the database. -func (cicb *ConfigItemCreateBulk) Save(ctx context.Context) ([]*ConfigItem, error) { - if cicb.err != nil { - return nil, cicb.err +func (_c *ConfigItemCreateBulk) Save(ctx context.Context) ([]*ConfigItem, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(cicb.builders)) - nodes := make([]*ConfigItem, len(cicb.builders)) - mutators := make([]Mutator, len(cicb.builders)) - for i := range cicb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*ConfigItem, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := cicb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*ConfigItemMutation) @@ -381,12 +381,12 @@ func (cicb *ConfigItemCreateBulk) Save(ctx context.Context) ([]*ConfigItem, erro var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, cicb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = cicb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, cicb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -410,7 +410,7 @@ func (cicb *ConfigItemCreateBulk) Save(ctx context.Context) ([]*ConfigItem, erro }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, cicb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -418,8 +418,8 @@ func (cicb *ConfigItemCreateBulk) Save(ctx context.Context) ([]*ConfigItem, erro } // SaveX is like Save, but panics if an error occurs. -func (cicb *ConfigItemCreateBulk) SaveX(ctx context.Context) []*ConfigItem { - v, err := cicb.Save(ctx) +func (_c *ConfigItemCreateBulk) SaveX(ctx context.Context) []*ConfigItem { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -427,14 +427,14 @@ func (cicb *ConfigItemCreateBulk) SaveX(ctx context.Context) []*ConfigItem { } // Exec executes the query. -func (cicb *ConfigItemCreateBulk) Exec(ctx context.Context) error { - _, err := cicb.Save(ctx) +func (_c *ConfigItemCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (cicb *ConfigItemCreateBulk) ExecX(ctx context.Context) { - if err := cicb.Exec(ctx); err != nil { +func (_c *ConfigItemCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -454,10 +454,10 @@ func (cicb *ConfigItemCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (cicb *ConfigItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *ConfigItemUpsertBulk { - cicb.conflict = opts +func (_c *ConfigItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *ConfigItemUpsertBulk { + _c.conflict = opts return &ConfigItemUpsertBulk{ - create: cicb, + create: _c, } } @@ -467,10 +467,10 @@ func (cicb *ConfigItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *Config // client.ConfigItem.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (cicb *ConfigItemCreateBulk) OnConflictColumns(columns ...string) *ConfigItemUpsertBulk { - cicb.conflict = append(cicb.conflict, sql.ConflictColumns(columns...)) +func (_c *ConfigItemCreateBulk) OnConflictColumns(columns ...string) *ConfigItemUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &ConfigItemUpsertBulk{ - create: cicb, + create: _c, } } diff --git a/pkg/database/ent/configitem_delete.go b/pkg/database/ent/configitem_delete.go index a5dc811f6..6c05e1b8e 100644 --- a/pkg/database/ent/configitem_delete.go +++ b/pkg/database/ent/configitem_delete.go @@ -20,56 +20,56 @@ type ConfigItemDelete struct { } // Where appends a list predicates to the ConfigItemDelete builder. -func (cid *ConfigItemDelete) Where(ps ...predicate.ConfigItem) *ConfigItemDelete { - cid.mutation.Where(ps...) - return cid +func (_d *ConfigItemDelete) Where(ps ...predicate.ConfigItem) *ConfigItemDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (cid *ConfigItemDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, cid.sqlExec, cid.mutation, cid.hooks) +func (_d *ConfigItemDelete) 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 (cid *ConfigItemDelete) ExecX(ctx context.Context) int { - n, err := cid.Exec(ctx) +func (_d *ConfigItemDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (cid *ConfigItemDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *ConfigItemDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(configitem.Table, sqlgraph.NewFieldSpec(configitem.FieldID, field.TypeInt)) - if ps := cid.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, cid.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - cid.mutation.done = true + _d.mutation.done = true return affected, err } // ConfigItemDeleteOne is the builder for deleting a single ConfigItem entity. type ConfigItemDeleteOne struct { - cid *ConfigItemDelete + _d *ConfigItemDelete } // Where appends a list predicates to the ConfigItemDelete builder. -func (cido *ConfigItemDeleteOne) Where(ps ...predicate.ConfigItem) *ConfigItemDeleteOne { - cido.cid.mutation.Where(ps...) - return cido +func (_d *ConfigItemDeleteOne) Where(ps ...predicate.ConfigItem) *ConfigItemDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (cido *ConfigItemDeleteOne) Exec(ctx context.Context) error { - n, err := cido.cid.Exec(ctx) +func (_d *ConfigItemDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (cido *ConfigItemDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (cido *ConfigItemDeleteOne) ExecX(ctx context.Context) { - if err := cido.Exec(ctx); err != nil { +func (_d *ConfigItemDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/configitem_query.go b/pkg/database/ent/configitem_query.go index b1d6403de..697d38392 100644 --- a/pkg/database/ent/configitem_query.go +++ b/pkg/database/ent/configitem_query.go @@ -28,40 +28,40 @@ type ConfigItemQuery struct { } // Where adds a new predicate for the ConfigItemQuery builder. -func (ciq *ConfigItemQuery) Where(ps ...predicate.ConfigItem) *ConfigItemQuery { - ciq.predicates = append(ciq.predicates, ps...) - return ciq +func (_q *ConfigItemQuery) Where(ps ...predicate.ConfigItem) *ConfigItemQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (ciq *ConfigItemQuery) Limit(limit int) *ConfigItemQuery { - ciq.ctx.Limit = &limit - return ciq +func (_q *ConfigItemQuery) Limit(limit int) *ConfigItemQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (ciq *ConfigItemQuery) Offset(offset int) *ConfigItemQuery { - ciq.ctx.Offset = &offset - return ciq +func (_q *ConfigItemQuery) Offset(offset int) *ConfigItemQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (ciq *ConfigItemQuery) Unique(unique bool) *ConfigItemQuery { - ciq.ctx.Unique = &unique - return ciq +func (_q *ConfigItemQuery) Unique(unique bool) *ConfigItemQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (ciq *ConfigItemQuery) Order(o ...configitem.OrderOption) *ConfigItemQuery { - ciq.order = append(ciq.order, o...) - return ciq +func (_q *ConfigItemQuery) Order(o ...configitem.OrderOption) *ConfigItemQuery { + _q.order = append(_q.order, o...) + return _q } // First returns the first ConfigItem entity from the query. // Returns a *NotFoundError when no ConfigItem was found. -func (ciq *ConfigItemQuery) First(ctx context.Context) (*ConfigItem, error) { - nodes, err := ciq.Limit(1).All(setContextOp(ctx, ciq.ctx, ent.OpQueryFirst)) +func (_q *ConfigItemQuery) First(ctx context.Context) (*ConfigItem, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -72,8 +72,8 @@ func (ciq *ConfigItemQuery) First(ctx context.Context) (*ConfigItem, error) { } // FirstX is like First, but panics if an error occurs. -func (ciq *ConfigItemQuery) FirstX(ctx context.Context) *ConfigItem { - node, err := ciq.First(ctx) +func (_q *ConfigItemQuery) FirstX(ctx context.Context) *ConfigItem { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -82,9 +82,9 @@ func (ciq *ConfigItemQuery) FirstX(ctx context.Context) *ConfigItem { // FirstID returns the first ConfigItem ID from the query. // Returns a *NotFoundError when no ConfigItem ID was found. -func (ciq *ConfigItemQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *ConfigItemQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ciq.Limit(1).IDs(setContextOp(ctx, ciq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -95,8 +95,8 @@ func (ciq *ConfigItemQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (ciq *ConfigItemQuery) FirstIDX(ctx context.Context) int { - id, err := ciq.FirstID(ctx) +func (_q *ConfigItemQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -106,8 +106,8 @@ func (ciq *ConfigItemQuery) FirstIDX(ctx context.Context) int { // Only returns a single ConfigItem entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one ConfigItem entity is found. // Returns a *NotFoundError when no ConfigItem entities are found. -func (ciq *ConfigItemQuery) Only(ctx context.Context) (*ConfigItem, error) { - nodes, err := ciq.Limit(2).All(setContextOp(ctx, ciq.ctx, ent.OpQueryOnly)) +func (_q *ConfigItemQuery) Only(ctx context.Context) (*ConfigItem, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -122,8 +122,8 @@ func (ciq *ConfigItemQuery) Only(ctx context.Context) (*ConfigItem, error) { } // OnlyX is like Only, but panics if an error occurs. -func (ciq *ConfigItemQuery) OnlyX(ctx context.Context) *ConfigItem { - node, err := ciq.Only(ctx) +func (_q *ConfigItemQuery) OnlyX(ctx context.Context) *ConfigItem { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -133,9 +133,9 @@ func (ciq *ConfigItemQuery) OnlyX(ctx context.Context) *ConfigItem { // OnlyID is like Only, but returns the only ConfigItem ID in the query. // Returns a *NotSingularError when more than one ConfigItem ID is found. // Returns a *NotFoundError when no entities are found. -func (ciq *ConfigItemQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *ConfigItemQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ciq.Limit(2).IDs(setContextOp(ctx, ciq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -150,8 +150,8 @@ func (ciq *ConfigItemQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (ciq *ConfigItemQuery) OnlyIDX(ctx context.Context) int { - id, err := ciq.OnlyID(ctx) +func (_q *ConfigItemQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -159,18 +159,18 @@ func (ciq *ConfigItemQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of ConfigItems. -func (ciq *ConfigItemQuery) All(ctx context.Context) ([]*ConfigItem, error) { - ctx = setContextOp(ctx, ciq.ctx, ent.OpQueryAll) - if err := ciq.prepareQuery(ctx); err != nil { +func (_q *ConfigItemQuery) All(ctx context.Context) ([]*ConfigItem, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*ConfigItem, *ConfigItemQuery]() - return withInterceptors[[]*ConfigItem](ctx, ciq, qr, ciq.inters) + return withInterceptors[[]*ConfigItem](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (ciq *ConfigItemQuery) AllX(ctx context.Context) []*ConfigItem { - nodes, err := ciq.All(ctx) +func (_q *ConfigItemQuery) AllX(ctx context.Context) []*ConfigItem { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -178,20 +178,20 @@ func (ciq *ConfigItemQuery) AllX(ctx context.Context) []*ConfigItem { } // IDs executes the query and returns a list of ConfigItem IDs. -func (ciq *ConfigItemQuery) IDs(ctx context.Context) (ids []int, err error) { - if ciq.ctx.Unique == nil && ciq.path != nil { - ciq.Unique(true) +func (_q *ConfigItemQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, ciq.ctx, ent.OpQueryIDs) - if err = ciq.Select(configitem.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(configitem.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (ciq *ConfigItemQuery) IDsX(ctx context.Context) []int { - ids, err := ciq.IDs(ctx) +func (_q *ConfigItemQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -199,17 +199,17 @@ func (ciq *ConfigItemQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (ciq *ConfigItemQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, ciq.ctx, ent.OpQueryCount) - if err := ciq.prepareQuery(ctx); err != nil { +func (_q *ConfigItemQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, ciq, querierCount[*ConfigItemQuery](), ciq.inters) + return withInterceptors[int](ctx, _q, querierCount[*ConfigItemQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (ciq *ConfigItemQuery) CountX(ctx context.Context) int { - count, err := ciq.Count(ctx) +func (_q *ConfigItemQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -217,9 +217,9 @@ func (ciq *ConfigItemQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (ciq *ConfigItemQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, ciq.ctx, ent.OpQueryExist) - switch _, err := ciq.FirstID(ctx); { +func (_q *ConfigItemQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -230,8 +230,8 @@ func (ciq *ConfigItemQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (ciq *ConfigItemQuery) ExistX(ctx context.Context) bool { - exist, err := ciq.Exist(ctx) +func (_q *ConfigItemQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -240,19 +240,19 @@ func (ciq *ConfigItemQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the ConfigItemQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (ciq *ConfigItemQuery) Clone() *ConfigItemQuery { - if ciq == nil { +func (_q *ConfigItemQuery) Clone() *ConfigItemQuery { + if _q == nil { return nil } return &ConfigItemQuery{ - config: ciq.config, - ctx: ciq.ctx.Clone(), - order: append([]configitem.OrderOption{}, ciq.order...), - inters: append([]Interceptor{}, ciq.inters...), - predicates: append([]predicate.ConfigItem{}, ciq.predicates...), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]configitem.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.ConfigItem{}, _q.predicates...), // clone intermediate query. - sql: ciq.sql.Clone(), - path: ciq.path, + sql: _q.sql.Clone(), + path: _q.path, } } @@ -270,10 +270,10 @@ func (ciq *ConfigItemQuery) Clone() *ConfigItemQuery { // GroupBy(configitem.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (ciq *ConfigItemQuery) GroupBy(field string, fields ...string) *ConfigItemGroupBy { - ciq.ctx.Fields = append([]string{field}, fields...) - grbuild := &ConfigItemGroupBy{build: ciq} - grbuild.flds = &ciq.ctx.Fields +func (_q *ConfigItemQuery) GroupBy(field string, fields ...string) *ConfigItemGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &ConfigItemGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = configitem.Label grbuild.scan = grbuild.Scan return grbuild @@ -291,62 +291,62 @@ func (ciq *ConfigItemQuery) GroupBy(field string, fields ...string) *ConfigItemG // client.ConfigItem.Query(). // Select(configitem.FieldCreatedAt). // Scan(ctx, &v) -func (ciq *ConfigItemQuery) Select(fields ...string) *ConfigItemSelect { - ciq.ctx.Fields = append(ciq.ctx.Fields, fields...) - sbuild := &ConfigItemSelect{ConfigItemQuery: ciq} +func (_q *ConfigItemQuery) Select(fields ...string) *ConfigItemSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &ConfigItemSelect{ConfigItemQuery: _q} sbuild.label = configitem.Label - sbuild.flds, sbuild.scan = &ciq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a ConfigItemSelect configured with the given aggregations. -func (ciq *ConfigItemQuery) Aggregate(fns ...AggregateFunc) *ConfigItemSelect { - return ciq.Select().Aggregate(fns...) +func (_q *ConfigItemQuery) Aggregate(fns ...AggregateFunc) *ConfigItemSelect { + return _q.Select().Aggregate(fns...) } -func (ciq *ConfigItemQuery) prepareQuery(ctx context.Context) error { - for _, inter := range ciq.inters { +func (_q *ConfigItemQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, ciq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range ciq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !configitem.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if ciq.path != nil { - prev, err := ciq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - ciq.sql = prev + _q.sql = prev } return nil } -func (ciq *ConfigItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ConfigItem, error) { +func (_q *ConfigItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ConfigItem, error) { var ( nodes = []*ConfigItem{} - _spec = ciq.querySpec() + _spec = _q.querySpec() ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*ConfigItem).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &ConfigItem{config: ciq.config} + node := &ConfigItem{config: _q.config} nodes = append(nodes, node) return node.assignValues(columns, values) } for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, ciq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { @@ -355,24 +355,24 @@ func (ciq *ConfigItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]* return nodes, nil } -func (ciq *ConfigItemQuery) sqlCount(ctx context.Context) (int, error) { - _spec := ciq.querySpec() - _spec.Node.Columns = ciq.ctx.Fields - if len(ciq.ctx.Fields) > 0 { - _spec.Unique = ciq.ctx.Unique != nil && *ciq.ctx.Unique +func (_q *ConfigItemQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, ciq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (ciq *ConfigItemQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *ConfigItemQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(configitem.Table, configitem.Columns, sqlgraph.NewFieldSpec(configitem.FieldID, field.TypeInt)) - _spec.From = ciq.sql - if unique := ciq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if ciq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := ciq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, configitem.FieldID) for i := range fields { @@ -381,20 +381,20 @@ func (ciq *ConfigItemQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := ciq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := ciq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := ciq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := ciq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -404,33 +404,33 @@ func (ciq *ConfigItemQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (ciq *ConfigItemQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(ciq.driver.Dialect()) +func (_q *ConfigItemQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(configitem.Table) - columns := ciq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = configitem.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if ciq.sql != nil { - selector = ciq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if ciq.ctx.Unique != nil && *ciq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range ciq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range ciq.order { + for _, p := range _q.order { p(selector) } - if offset := ciq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := ciq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -443,41 +443,41 @@ type ConfigItemGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cigb *ConfigItemGroupBy) Aggregate(fns ...AggregateFunc) *ConfigItemGroupBy { - cigb.fns = append(cigb.fns, fns...) - return cigb +func (_g *ConfigItemGroupBy) Aggregate(fns ...AggregateFunc) *ConfigItemGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cigb *ConfigItemGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cigb.build.ctx, ent.OpQueryGroupBy) - if err := cigb.build.prepareQuery(ctx); err != nil { +func (_g *ConfigItemGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ConfigItemQuery, *ConfigItemGroupBy](ctx, cigb.build, cigb, cigb.build.inters, v) + return scanWithInterceptors[*ConfigItemQuery, *ConfigItemGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cigb *ConfigItemGroupBy) sqlScan(ctx context.Context, root *ConfigItemQuery, v any) error { +func (_g *ConfigItemGroupBy) sqlScan(ctx context.Context, root *ConfigItemQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cigb.fns)) - for _, fn := range cigb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cigb.flds)+len(cigb.fns)) - for _, f := range *cigb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cigb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cigb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type ConfigItemSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cis *ConfigItemSelect) Aggregate(fns ...AggregateFunc) *ConfigItemSelect { - cis.fns = append(cis.fns, fns...) - return cis +func (_s *ConfigItemSelect) Aggregate(fns ...AggregateFunc) *ConfigItemSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cis *ConfigItemSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cis.ctx, ent.OpQuerySelect) - if err := cis.prepareQuery(ctx); err != nil { +func (_s *ConfigItemSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ConfigItemQuery, *ConfigItemSelect](ctx, cis.ConfigItemQuery, cis, cis.inters, v) + return scanWithInterceptors[*ConfigItemQuery, *ConfigItemSelect](ctx, _s.ConfigItemQuery, _s, _s.inters, v) } -func (cis *ConfigItemSelect) sqlScan(ctx context.Context, root *ConfigItemQuery, v any) error { +func (_s *ConfigItemSelect) sqlScan(ctx context.Context, root *ConfigItemQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cis.fns)) - for _, fn := range cis.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cis.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (cis *ConfigItemSelect) sqlScan(ctx context.Context, root *ConfigItemQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := cis.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/configitem_update.go b/pkg/database/ent/configitem_update.go index 82309459e..669a0f6a0 100644 --- a/pkg/database/ent/configitem_update.go +++ b/pkg/database/ent/configitem_update.go @@ -23,45 +23,45 @@ type ConfigItemUpdate struct { } // Where appends a list predicates to the ConfigItemUpdate builder. -func (ciu *ConfigItemUpdate) Where(ps ...predicate.ConfigItem) *ConfigItemUpdate { - ciu.mutation.Where(ps...) - return ciu +func (_u *ConfigItemUpdate) Where(ps ...predicate.ConfigItem) *ConfigItemUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (ciu *ConfigItemUpdate) SetUpdatedAt(t time.Time) *ConfigItemUpdate { - ciu.mutation.SetUpdatedAt(t) - return ciu +func (_u *ConfigItemUpdate) SetUpdatedAt(v time.Time) *ConfigItemUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetValue sets the "value" field. -func (ciu *ConfigItemUpdate) SetValue(s string) *ConfigItemUpdate { - ciu.mutation.SetValue(s) - return ciu +func (_u *ConfigItemUpdate) SetValue(v string) *ConfigItemUpdate { + _u.mutation.SetValue(v) + return _u } // SetNillableValue sets the "value" field if the given value is not nil. -func (ciu *ConfigItemUpdate) SetNillableValue(s *string) *ConfigItemUpdate { - if s != nil { - ciu.SetValue(*s) +func (_u *ConfigItemUpdate) SetNillableValue(v *string) *ConfigItemUpdate { + if v != nil { + _u.SetValue(*v) } - return ciu + return _u } // Mutation returns the ConfigItemMutation object of the builder. -func (ciu *ConfigItemUpdate) Mutation() *ConfigItemMutation { - return ciu.mutation +func (_u *ConfigItemUpdate) Mutation() *ConfigItemMutation { + return _u.mutation } // Save executes the query and returns the number of nodes affected by the update operation. -func (ciu *ConfigItemUpdate) Save(ctx context.Context) (int, error) { - ciu.defaults() - return withHooks(ctx, ciu.sqlSave, ciu.mutation, ciu.hooks) +func (_u *ConfigItemUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (ciu *ConfigItemUpdate) SaveX(ctx context.Context) int { - affected, err := ciu.Save(ctx) +func (_u *ConfigItemUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -69,42 +69,42 @@ func (ciu *ConfigItemUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (ciu *ConfigItemUpdate) Exec(ctx context.Context) error { - _, err := ciu.Save(ctx) +func (_u *ConfigItemUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (ciu *ConfigItemUpdate) ExecX(ctx context.Context) { - if err := ciu.Exec(ctx); err != nil { +func (_u *ConfigItemUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (ciu *ConfigItemUpdate) defaults() { - if _, ok := ciu.mutation.UpdatedAt(); !ok { +func (_u *ConfigItemUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := configitem.UpdateDefaultUpdatedAt() - ciu.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (ciu *ConfigItemUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *ConfigItemUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(configitem.Table, configitem.Columns, sqlgraph.NewFieldSpec(configitem.FieldID, field.TypeInt)) - if ps := ciu.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 := ciu.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(configitem.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := ciu.mutation.Value(); ok { + if value, ok := _u.mutation.Value(); ok { _spec.SetField(configitem.FieldValue, field.TypeString, value) } - if n, err = sqlgraph.UpdateNodes(ctx, ciu.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{configitem.Label} } else if sqlgraph.IsConstraintError(err) { @@ -112,8 +112,8 @@ func (ciu *ConfigItemUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - ciu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // ConfigItemUpdateOne is the builder for updating a single ConfigItem entity. @@ -125,52 +125,52 @@ type ConfigItemUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (ciuo *ConfigItemUpdateOne) SetUpdatedAt(t time.Time) *ConfigItemUpdateOne { - ciuo.mutation.SetUpdatedAt(t) - return ciuo +func (_u *ConfigItemUpdateOne) SetUpdatedAt(v time.Time) *ConfigItemUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetValue sets the "value" field. -func (ciuo *ConfigItemUpdateOne) SetValue(s string) *ConfigItemUpdateOne { - ciuo.mutation.SetValue(s) - return ciuo +func (_u *ConfigItemUpdateOne) SetValue(v string) *ConfigItemUpdateOne { + _u.mutation.SetValue(v) + return _u } // SetNillableValue sets the "value" field if the given value is not nil. -func (ciuo *ConfigItemUpdateOne) SetNillableValue(s *string) *ConfigItemUpdateOne { - if s != nil { - ciuo.SetValue(*s) +func (_u *ConfigItemUpdateOne) SetNillableValue(v *string) *ConfigItemUpdateOne { + if v != nil { + _u.SetValue(*v) } - return ciuo + return _u } // Mutation returns the ConfigItemMutation object of the builder. -func (ciuo *ConfigItemUpdateOne) Mutation() *ConfigItemMutation { - return ciuo.mutation +func (_u *ConfigItemUpdateOne) Mutation() *ConfigItemMutation { + return _u.mutation } // Where appends a list predicates to the ConfigItemUpdate builder. -func (ciuo *ConfigItemUpdateOne) Where(ps ...predicate.ConfigItem) *ConfigItemUpdateOne { - ciuo.mutation.Where(ps...) - return ciuo +func (_u *ConfigItemUpdateOne) Where(ps ...predicate.ConfigItem) *ConfigItemUpdateOne { + _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 (ciuo *ConfigItemUpdateOne) Select(field string, fields ...string) *ConfigItemUpdateOne { - ciuo.fields = append([]string{field}, fields...) - return ciuo +func (_u *ConfigItemUpdateOne) Select(field string, fields ...string) *ConfigItemUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated ConfigItem entity. -func (ciuo *ConfigItemUpdateOne) Save(ctx context.Context) (*ConfigItem, error) { - ciuo.defaults() - return withHooks(ctx, ciuo.sqlSave, ciuo.mutation, ciuo.hooks) +func (_u *ConfigItemUpdateOne) Save(ctx context.Context) (*ConfigItem, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (ciuo *ConfigItemUpdateOne) SaveX(ctx context.Context) *ConfigItem { - node, err := ciuo.Save(ctx) +func (_u *ConfigItemUpdateOne) SaveX(ctx context.Context) *ConfigItem { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -178,34 +178,34 @@ func (ciuo *ConfigItemUpdateOne) SaveX(ctx context.Context) *ConfigItem { } // Exec executes the query on the entity. -func (ciuo *ConfigItemUpdateOne) Exec(ctx context.Context) error { - _, err := ciuo.Save(ctx) +func (_u *ConfigItemUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (ciuo *ConfigItemUpdateOne) ExecX(ctx context.Context) { - if err := ciuo.Exec(ctx); err != nil { +func (_u *ConfigItemUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (ciuo *ConfigItemUpdateOne) defaults() { - if _, ok := ciuo.mutation.UpdatedAt(); !ok { +func (_u *ConfigItemUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := configitem.UpdateDefaultUpdatedAt() - ciuo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (ciuo *ConfigItemUpdateOne) sqlSave(ctx context.Context) (_node *ConfigItem, err error) { +func (_u *ConfigItemUpdateOne) sqlSave(ctx context.Context) (_node *ConfigItem, err error) { _spec := sqlgraph.NewUpdateSpec(configitem.Table, configitem.Columns, sqlgraph.NewFieldSpec(configitem.FieldID, field.TypeInt)) - id, ok := ciuo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ConfigItem.id" for update`)} } _spec.Node.ID.Value = id - if fields := ciuo.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, configitem.FieldID) for _, f := range fields { @@ -217,23 +217,23 @@ func (ciuo *ConfigItemUpdateOne) sqlSave(ctx context.Context) (_node *ConfigItem } } } - if ps := ciuo.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 := ciuo.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(configitem.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := ciuo.mutation.Value(); ok { + if value, ok := _u.mutation.Value(); ok { _spec.SetField(configitem.FieldValue, field.TypeString, value) } - _node = &ConfigItem{config: ciuo.config} + _node = &ConfigItem{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, ciuo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{configitem.Label} } else if sqlgraph.IsConstraintError(err) { @@ -241,6 +241,6 @@ func (ciuo *ConfigItemUpdateOne) sqlSave(ctx context.Context) (_node *ConfigItem } return nil, err } - ciuo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/decision.go b/pkg/database/ent/decision.go index 4a6dc7285..b11d61854 100644 --- a/pkg/database/ent/decision.go +++ b/pkg/database/ent/decision.go @@ -98,7 +98,7 @@ func (*Decision) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Decision fields. -func (d *Decision) assignValues(columns []string, values []any) error { +func (_m *Decision) 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) } @@ -109,106 +109,106 @@ func (d *Decision) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - d.ID = int(value.Int64) + _m.ID = int(value.Int64) case decision.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - d.CreatedAt = value.Time + _m.CreatedAt = value.Time } case decision.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - d.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case decision.FieldUntil: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field until", values[i]) } else if value.Valid { - d.Until = new(time.Time) - *d.Until = value.Time + _m.Until = new(time.Time) + *_m.Until = value.Time } case decision.FieldScenario: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field scenario", values[i]) } else if value.Valid { - d.Scenario = value.String + _m.Scenario = value.String } case decision.FieldType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field type", values[i]) } else if value.Valid { - d.Type = value.String + _m.Type = value.String } case decision.FieldStartIP: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field start_ip", values[i]) } else if value.Valid { - d.StartIP = value.Int64 + _m.StartIP = value.Int64 } case decision.FieldEndIP: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field end_ip", values[i]) } else if value.Valid { - d.EndIP = value.Int64 + _m.EndIP = value.Int64 } case decision.FieldStartSuffix: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field start_suffix", values[i]) } else if value.Valid { - d.StartSuffix = value.Int64 + _m.StartSuffix = value.Int64 } case decision.FieldEndSuffix: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field end_suffix", values[i]) } else if value.Valid { - d.EndSuffix = value.Int64 + _m.EndSuffix = value.Int64 } case decision.FieldIPSize: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field ip_size", values[i]) } else if value.Valid { - d.IPSize = value.Int64 + _m.IPSize = value.Int64 } case decision.FieldScope: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field scope", values[i]) } else if value.Valid { - d.Scope = value.String + _m.Scope = value.String } case decision.FieldValue: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field value", values[i]) } else if value.Valid { - d.Value = value.String + _m.Value = value.String } case decision.FieldOrigin: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field origin", values[i]) } else if value.Valid { - d.Origin = value.String + _m.Origin = value.String } case decision.FieldSimulated: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field simulated", values[i]) } else if value.Valid { - d.Simulated = value.Bool + _m.Simulated = value.Bool } case decision.FieldUUID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field uuid", values[i]) } else if value.Valid { - d.UUID = value.String + _m.UUID = value.String } case decision.FieldAlertDecisions: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field alert_decisions", values[i]) } else if value.Valid { - d.AlertDecisions = int(value.Int64) + _m.AlertDecisions = int(value.Int64) } default: - d.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -216,87 +216,87 @@ func (d *Decision) assignValues(columns []string, values []any) error { // GetValue returns the ent.Value that was dynamically selected and assigned to the Decision. // This includes values selected through modifiers, order, etc. -func (d *Decision) GetValue(name string) (ent.Value, error) { - return d.selectValues.Get(name) +func (_m *Decision) GetValue(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // QueryOwner queries the "owner" edge of the Decision entity. -func (d *Decision) QueryOwner() *AlertQuery { - return NewDecisionClient(d.config).QueryOwner(d) +func (_m *Decision) QueryOwner() *AlertQuery { + return NewDecisionClient(_m.config).QueryOwner(_m) } // Update returns a builder for updating this Decision. // Note that you need to call Decision.Unwrap() before calling this method if this Decision // was returned from a transaction, and the transaction was committed or rolled back. -func (d *Decision) Update() *DecisionUpdateOne { - return NewDecisionClient(d.config).UpdateOne(d) +func (_m *Decision) Update() *DecisionUpdateOne { + return NewDecisionClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Decision 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 (d *Decision) Unwrap() *Decision { - _tx, ok := d.config.driver.(*txDriver) +func (_m *Decision) Unwrap() *Decision { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Decision is not a transactional entity") } - d.config.driver = _tx.drv - return d + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (d *Decision) String() string { +func (_m *Decision) String() string { var builder strings.Builder builder.WriteString("Decision(") - builder.WriteString(fmt.Sprintf("id=%v, ", d.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(d.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(d.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") - if v := d.Until; v != nil { + if v := _m.Until; v != nil { builder.WriteString("until=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("scenario=") - builder.WriteString(d.Scenario) + builder.WriteString(_m.Scenario) builder.WriteString(", ") builder.WriteString("type=") - builder.WriteString(d.Type) + builder.WriteString(_m.Type) builder.WriteString(", ") builder.WriteString("start_ip=") - builder.WriteString(fmt.Sprintf("%v", d.StartIP)) + builder.WriteString(fmt.Sprintf("%v", _m.StartIP)) builder.WriteString(", ") builder.WriteString("end_ip=") - builder.WriteString(fmt.Sprintf("%v", d.EndIP)) + builder.WriteString(fmt.Sprintf("%v", _m.EndIP)) builder.WriteString(", ") builder.WriteString("start_suffix=") - builder.WriteString(fmt.Sprintf("%v", d.StartSuffix)) + builder.WriteString(fmt.Sprintf("%v", _m.StartSuffix)) builder.WriteString(", ") builder.WriteString("end_suffix=") - builder.WriteString(fmt.Sprintf("%v", d.EndSuffix)) + builder.WriteString(fmt.Sprintf("%v", _m.EndSuffix)) builder.WriteString(", ") builder.WriteString("ip_size=") - builder.WriteString(fmt.Sprintf("%v", d.IPSize)) + builder.WriteString(fmt.Sprintf("%v", _m.IPSize)) builder.WriteString(", ") builder.WriteString("scope=") - builder.WriteString(d.Scope) + builder.WriteString(_m.Scope) builder.WriteString(", ") builder.WriteString("value=") - builder.WriteString(d.Value) + builder.WriteString(_m.Value) builder.WriteString(", ") builder.WriteString("origin=") - builder.WriteString(d.Origin) + builder.WriteString(_m.Origin) builder.WriteString(", ") builder.WriteString("simulated=") - builder.WriteString(fmt.Sprintf("%v", d.Simulated)) + builder.WriteString(fmt.Sprintf("%v", _m.Simulated)) builder.WriteString(", ") builder.WriteString("uuid=") - builder.WriteString(d.UUID) + builder.WriteString(_m.UUID) builder.WriteString(", ") builder.WriteString("alert_decisions=") - builder.WriteString(fmt.Sprintf("%v", d.AlertDecisions)) + builder.WriteString(fmt.Sprintf("%v", _m.AlertDecisions)) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/decision_create.go b/pkg/database/ent/decision_create.go index 52eb7babb..1c58b35e7 100644 --- a/pkg/database/ent/decision_create.go +++ b/pkg/database/ent/decision_create.go @@ -24,222 +24,222 @@ type DecisionCreate struct { } // SetCreatedAt sets the "created_at" field. -func (dc *DecisionCreate) SetCreatedAt(t time.Time) *DecisionCreate { - dc.mutation.SetCreatedAt(t) - return dc +func (_c *DecisionCreate) SetCreatedAt(v time.Time) *DecisionCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableCreatedAt(t *time.Time) *DecisionCreate { - if t != nil { - dc.SetCreatedAt(*t) +func (_c *DecisionCreate) SetNillableCreatedAt(v *time.Time) *DecisionCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return dc + return _c } // SetUpdatedAt sets the "updated_at" field. -func (dc *DecisionCreate) SetUpdatedAt(t time.Time) *DecisionCreate { - dc.mutation.SetUpdatedAt(t) - return dc +func (_c *DecisionCreate) SetUpdatedAt(v time.Time) *DecisionCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableUpdatedAt(t *time.Time) *DecisionCreate { - if t != nil { - dc.SetUpdatedAt(*t) +func (_c *DecisionCreate) SetNillableUpdatedAt(v *time.Time) *DecisionCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return dc + return _c } // SetUntil sets the "until" field. -func (dc *DecisionCreate) SetUntil(t time.Time) *DecisionCreate { - dc.mutation.SetUntil(t) - return dc +func (_c *DecisionCreate) SetUntil(v time.Time) *DecisionCreate { + _c.mutation.SetUntil(v) + return _c } // SetNillableUntil sets the "until" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableUntil(t *time.Time) *DecisionCreate { - if t != nil { - dc.SetUntil(*t) +func (_c *DecisionCreate) SetNillableUntil(v *time.Time) *DecisionCreate { + if v != nil { + _c.SetUntil(*v) } - return dc + return _c } // SetScenario sets the "scenario" field. -func (dc *DecisionCreate) SetScenario(s string) *DecisionCreate { - dc.mutation.SetScenario(s) - return dc +func (_c *DecisionCreate) SetScenario(v string) *DecisionCreate { + _c.mutation.SetScenario(v) + return _c } // SetType sets the "type" field. -func (dc *DecisionCreate) SetType(s string) *DecisionCreate { - dc.mutation.SetType(s) - return dc +func (_c *DecisionCreate) SetType(v string) *DecisionCreate { + _c.mutation.SetType(v) + return _c } // SetStartIP sets the "start_ip" field. -func (dc *DecisionCreate) SetStartIP(i int64) *DecisionCreate { - dc.mutation.SetStartIP(i) - return dc +func (_c *DecisionCreate) SetStartIP(v int64) *DecisionCreate { + _c.mutation.SetStartIP(v) + return _c } // SetNillableStartIP sets the "start_ip" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableStartIP(i *int64) *DecisionCreate { - if i != nil { - dc.SetStartIP(*i) +func (_c *DecisionCreate) SetNillableStartIP(v *int64) *DecisionCreate { + if v != nil { + _c.SetStartIP(*v) } - return dc + return _c } // SetEndIP sets the "end_ip" field. -func (dc *DecisionCreate) SetEndIP(i int64) *DecisionCreate { - dc.mutation.SetEndIP(i) - return dc +func (_c *DecisionCreate) SetEndIP(v int64) *DecisionCreate { + _c.mutation.SetEndIP(v) + return _c } // SetNillableEndIP sets the "end_ip" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableEndIP(i *int64) *DecisionCreate { - if i != nil { - dc.SetEndIP(*i) +func (_c *DecisionCreate) SetNillableEndIP(v *int64) *DecisionCreate { + if v != nil { + _c.SetEndIP(*v) } - return dc + return _c } // SetStartSuffix sets the "start_suffix" field. -func (dc *DecisionCreate) SetStartSuffix(i int64) *DecisionCreate { - dc.mutation.SetStartSuffix(i) - return dc +func (_c *DecisionCreate) SetStartSuffix(v int64) *DecisionCreate { + _c.mutation.SetStartSuffix(v) + return _c } // SetNillableStartSuffix sets the "start_suffix" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableStartSuffix(i *int64) *DecisionCreate { - if i != nil { - dc.SetStartSuffix(*i) +func (_c *DecisionCreate) SetNillableStartSuffix(v *int64) *DecisionCreate { + if v != nil { + _c.SetStartSuffix(*v) } - return dc + return _c } // SetEndSuffix sets the "end_suffix" field. -func (dc *DecisionCreate) SetEndSuffix(i int64) *DecisionCreate { - dc.mutation.SetEndSuffix(i) - return dc +func (_c *DecisionCreate) SetEndSuffix(v int64) *DecisionCreate { + _c.mutation.SetEndSuffix(v) + return _c } // SetNillableEndSuffix sets the "end_suffix" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableEndSuffix(i *int64) *DecisionCreate { - if i != nil { - dc.SetEndSuffix(*i) +func (_c *DecisionCreate) SetNillableEndSuffix(v *int64) *DecisionCreate { + if v != nil { + _c.SetEndSuffix(*v) } - return dc + return _c } // SetIPSize sets the "ip_size" field. -func (dc *DecisionCreate) SetIPSize(i int64) *DecisionCreate { - dc.mutation.SetIPSize(i) - return dc +func (_c *DecisionCreate) SetIPSize(v int64) *DecisionCreate { + _c.mutation.SetIPSize(v) + return _c } // SetNillableIPSize sets the "ip_size" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableIPSize(i *int64) *DecisionCreate { - if i != nil { - dc.SetIPSize(*i) +func (_c *DecisionCreate) SetNillableIPSize(v *int64) *DecisionCreate { + if v != nil { + _c.SetIPSize(*v) } - return dc + return _c } // SetScope sets the "scope" field. -func (dc *DecisionCreate) SetScope(s string) *DecisionCreate { - dc.mutation.SetScope(s) - return dc +func (_c *DecisionCreate) SetScope(v string) *DecisionCreate { + _c.mutation.SetScope(v) + return _c } // SetValue sets the "value" field. -func (dc *DecisionCreate) SetValue(s string) *DecisionCreate { - dc.mutation.SetValue(s) - return dc +func (_c *DecisionCreate) SetValue(v string) *DecisionCreate { + _c.mutation.SetValue(v) + return _c } // SetOrigin sets the "origin" field. -func (dc *DecisionCreate) SetOrigin(s string) *DecisionCreate { - dc.mutation.SetOrigin(s) - return dc +func (_c *DecisionCreate) SetOrigin(v string) *DecisionCreate { + _c.mutation.SetOrigin(v) + return _c } // SetSimulated sets the "simulated" field. -func (dc *DecisionCreate) SetSimulated(b bool) *DecisionCreate { - dc.mutation.SetSimulated(b) - return dc +func (_c *DecisionCreate) SetSimulated(v bool) *DecisionCreate { + _c.mutation.SetSimulated(v) + return _c } // SetNillableSimulated sets the "simulated" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableSimulated(b *bool) *DecisionCreate { - if b != nil { - dc.SetSimulated(*b) +func (_c *DecisionCreate) SetNillableSimulated(v *bool) *DecisionCreate { + if v != nil { + _c.SetSimulated(*v) } - return dc + return _c } // SetUUID sets the "uuid" field. -func (dc *DecisionCreate) SetUUID(s string) *DecisionCreate { - dc.mutation.SetUUID(s) - return dc +func (_c *DecisionCreate) SetUUID(v string) *DecisionCreate { + _c.mutation.SetUUID(v) + return _c } // SetNillableUUID sets the "uuid" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableUUID(s *string) *DecisionCreate { - if s != nil { - dc.SetUUID(*s) +func (_c *DecisionCreate) SetNillableUUID(v *string) *DecisionCreate { + if v != nil { + _c.SetUUID(*v) } - return dc + return _c } // SetAlertDecisions sets the "alert_decisions" field. -func (dc *DecisionCreate) SetAlertDecisions(i int) *DecisionCreate { - dc.mutation.SetAlertDecisions(i) - return dc +func (_c *DecisionCreate) SetAlertDecisions(v int) *DecisionCreate { + _c.mutation.SetAlertDecisions(v) + return _c } // SetNillableAlertDecisions sets the "alert_decisions" field if the given value is not nil. -func (dc *DecisionCreate) SetNillableAlertDecisions(i *int) *DecisionCreate { - if i != nil { - dc.SetAlertDecisions(*i) +func (_c *DecisionCreate) SetNillableAlertDecisions(v *int) *DecisionCreate { + if v != nil { + _c.SetAlertDecisions(*v) } - return dc + return _c } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (dc *DecisionCreate) SetOwnerID(id int) *DecisionCreate { - dc.mutation.SetOwnerID(id) - return dc +func (_c *DecisionCreate) SetOwnerID(id int) *DecisionCreate { + _c.mutation.SetOwnerID(id) + return _c } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (dc *DecisionCreate) SetNillableOwnerID(id *int) *DecisionCreate { +func (_c *DecisionCreate) SetNillableOwnerID(id *int) *DecisionCreate { if id != nil { - dc = dc.SetOwnerID(*id) + _c = _c.SetOwnerID(*id) } - return dc + return _c } // SetOwner sets the "owner" edge to the Alert entity. -func (dc *DecisionCreate) SetOwner(a *Alert) *DecisionCreate { - return dc.SetOwnerID(a.ID) +func (_c *DecisionCreate) SetOwner(v *Alert) *DecisionCreate { + return _c.SetOwnerID(v.ID) } // Mutation returns the DecisionMutation object of the builder. -func (dc *DecisionCreate) Mutation() *DecisionMutation { - return dc.mutation +func (_c *DecisionCreate) Mutation() *DecisionMutation { + return _c.mutation } // Save creates the Decision in the database. -func (dc *DecisionCreate) Save(ctx context.Context) (*Decision, error) { - dc.defaults() - return withHooks(ctx, dc.sqlSave, dc.mutation, dc.hooks) +func (_c *DecisionCreate) Save(ctx context.Context) (*Decision, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (dc *DecisionCreate) SaveX(ctx context.Context) *Decision { - v, err := dc.Save(ctx) +func (_c *DecisionCreate) SaveX(ctx context.Context) *Decision { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -247,69 +247,69 @@ func (dc *DecisionCreate) SaveX(ctx context.Context) *Decision { } // Exec executes the query. -func (dc *DecisionCreate) Exec(ctx context.Context) error { - _, err := dc.Save(ctx) +func (_c *DecisionCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (dc *DecisionCreate) ExecX(ctx context.Context) { - if err := dc.Exec(ctx); err != nil { +func (_c *DecisionCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (dc *DecisionCreate) defaults() { - if _, ok := dc.mutation.CreatedAt(); !ok { +func (_c *DecisionCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := decision.DefaultCreatedAt() - dc.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := dc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := decision.DefaultUpdatedAt() - dc.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } - if _, ok := dc.mutation.Simulated(); !ok { + if _, ok := _c.mutation.Simulated(); !ok { v := decision.DefaultSimulated - dc.mutation.SetSimulated(v) + _c.mutation.SetSimulated(v) } } // check runs all checks and user-defined validators on the builder. -func (dc *DecisionCreate) check() error { - if _, ok := dc.mutation.CreatedAt(); !ok { +func (_c *DecisionCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Decision.created_at"`)} } - if _, ok := dc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Decision.updated_at"`)} } - if _, ok := dc.mutation.Scenario(); !ok { + if _, ok := _c.mutation.Scenario(); !ok { return &ValidationError{Name: "scenario", err: errors.New(`ent: missing required field "Decision.scenario"`)} } - if _, ok := dc.mutation.GetType(); !ok { + if _, ok := _c.mutation.GetType(); !ok { return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Decision.type"`)} } - if _, ok := dc.mutation.Scope(); !ok { + if _, ok := _c.mutation.Scope(); !ok { return &ValidationError{Name: "scope", err: errors.New(`ent: missing required field "Decision.scope"`)} } - if _, ok := dc.mutation.Value(); !ok { + if _, ok := _c.mutation.Value(); !ok { return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "Decision.value"`)} } - if _, ok := dc.mutation.Origin(); !ok { + if _, ok := _c.mutation.Origin(); !ok { return &ValidationError{Name: "origin", err: errors.New(`ent: missing required field "Decision.origin"`)} } - if _, ok := dc.mutation.Simulated(); !ok { + if _, ok := _c.mutation.Simulated(); !ok { return &ValidationError{Name: "simulated", err: errors.New(`ent: missing required field "Decision.simulated"`)} } return nil } -func (dc *DecisionCreate) sqlSave(ctx context.Context) (*Decision, error) { - if err := dc.check(); err != nil { +func (_c *DecisionCreate) sqlSave(ctx context.Context) (*Decision, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := dc.createSpec() - if err := sqlgraph.CreateNode(ctx, dc.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -317,78 +317,78 @@ func (dc *DecisionCreate) sqlSave(ctx context.Context) (*Decision, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - dc.mutation.id = &_node.ID - dc.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (dc *DecisionCreate) createSpec() (*Decision, *sqlgraph.CreateSpec) { +func (_c *DecisionCreate) createSpec() (*Decision, *sqlgraph.CreateSpec) { var ( - _node = &Decision{config: dc.config} + _node = &Decision{config: _c.config} _spec = sqlgraph.NewCreateSpec(decision.Table, sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt)) ) - _spec.OnConflict = dc.conflict - if value, ok := dc.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(decision.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := dc.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(decision.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := dc.mutation.Until(); ok { + if value, ok := _c.mutation.Until(); ok { _spec.SetField(decision.FieldUntil, field.TypeTime, value) _node.Until = &value } - if value, ok := dc.mutation.Scenario(); ok { + if value, ok := _c.mutation.Scenario(); ok { _spec.SetField(decision.FieldScenario, field.TypeString, value) _node.Scenario = value } - if value, ok := dc.mutation.GetType(); ok { + if value, ok := _c.mutation.GetType(); ok { _spec.SetField(decision.FieldType, field.TypeString, value) _node.Type = value } - if value, ok := dc.mutation.StartIP(); ok { + if value, ok := _c.mutation.StartIP(); ok { _spec.SetField(decision.FieldStartIP, field.TypeInt64, value) _node.StartIP = value } - if value, ok := dc.mutation.EndIP(); ok { + if value, ok := _c.mutation.EndIP(); ok { _spec.SetField(decision.FieldEndIP, field.TypeInt64, value) _node.EndIP = value } - if value, ok := dc.mutation.StartSuffix(); ok { + if value, ok := _c.mutation.StartSuffix(); ok { _spec.SetField(decision.FieldStartSuffix, field.TypeInt64, value) _node.StartSuffix = value } - if value, ok := dc.mutation.EndSuffix(); ok { + if value, ok := _c.mutation.EndSuffix(); ok { _spec.SetField(decision.FieldEndSuffix, field.TypeInt64, value) _node.EndSuffix = value } - if value, ok := dc.mutation.IPSize(); ok { + if value, ok := _c.mutation.IPSize(); ok { _spec.SetField(decision.FieldIPSize, field.TypeInt64, value) _node.IPSize = value } - if value, ok := dc.mutation.Scope(); ok { + if value, ok := _c.mutation.Scope(); ok { _spec.SetField(decision.FieldScope, field.TypeString, value) _node.Scope = value } - if value, ok := dc.mutation.Value(); ok { + if value, ok := _c.mutation.Value(); ok { _spec.SetField(decision.FieldValue, field.TypeString, value) _node.Value = value } - if value, ok := dc.mutation.Origin(); ok { + if value, ok := _c.mutation.Origin(); ok { _spec.SetField(decision.FieldOrigin, field.TypeString, value) _node.Origin = value } - if value, ok := dc.mutation.Simulated(); ok { + if value, ok := _c.mutation.Simulated(); ok { _spec.SetField(decision.FieldSimulated, field.TypeBool, value) _node.Simulated = value } - if value, ok := dc.mutation.UUID(); ok { + if value, ok := _c.mutation.UUID(); ok { _spec.SetField(decision.FieldUUID, field.TypeString, value) _node.UUID = value } - if nodes := dc.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -424,10 +424,10 @@ func (dc *DecisionCreate) createSpec() (*Decision, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (dc *DecisionCreate) OnConflict(opts ...sql.ConflictOption) *DecisionUpsertOne { - dc.conflict = opts +func (_c *DecisionCreate) OnConflict(opts ...sql.ConflictOption) *DecisionUpsertOne { + _c.conflict = opts return &DecisionUpsertOne{ - create: dc, + create: _c, } } @@ -437,10 +437,10 @@ func (dc *DecisionCreate) OnConflict(opts ...sql.ConflictOption) *DecisionUpsert // client.Decision.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (dc *DecisionCreate) OnConflictColumns(columns ...string) *DecisionUpsertOne { - dc.conflict = append(dc.conflict, sql.ConflictColumns(columns...)) +func (_c *DecisionCreate) OnConflictColumns(columns ...string) *DecisionUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &DecisionUpsertOne{ - create: dc, + create: _c, } } @@ -684,16 +684,16 @@ type DecisionCreateBulk struct { } // Save creates the Decision entities in the database. -func (dcb *DecisionCreateBulk) Save(ctx context.Context) ([]*Decision, error) { - if dcb.err != nil { - return nil, dcb.err +func (_c *DecisionCreateBulk) Save(ctx context.Context) ([]*Decision, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(dcb.builders)) - nodes := make([]*Decision, len(dcb.builders)) - mutators := make([]Mutator, len(dcb.builders)) - for i := range dcb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Decision, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := dcb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*DecisionMutation) @@ -707,12 +707,12 @@ func (dcb *DecisionCreateBulk) Save(ctx context.Context) ([]*Decision, error) { var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, dcb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = dcb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, dcb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -736,7 +736,7 @@ func (dcb *DecisionCreateBulk) Save(ctx context.Context) ([]*Decision, error) { }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, dcb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -744,8 +744,8 @@ func (dcb *DecisionCreateBulk) Save(ctx context.Context) ([]*Decision, error) { } // SaveX is like Save, but panics if an error occurs. -func (dcb *DecisionCreateBulk) SaveX(ctx context.Context) []*Decision { - v, err := dcb.Save(ctx) +func (_c *DecisionCreateBulk) SaveX(ctx context.Context) []*Decision { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -753,14 +753,14 @@ func (dcb *DecisionCreateBulk) SaveX(ctx context.Context) []*Decision { } // Exec executes the query. -func (dcb *DecisionCreateBulk) Exec(ctx context.Context) error { - _, err := dcb.Save(ctx) +func (_c *DecisionCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (dcb *DecisionCreateBulk) ExecX(ctx context.Context) { - if err := dcb.Exec(ctx); err != nil { +func (_c *DecisionCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -780,10 +780,10 @@ func (dcb *DecisionCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (dcb *DecisionCreateBulk) OnConflict(opts ...sql.ConflictOption) *DecisionUpsertBulk { - dcb.conflict = opts +func (_c *DecisionCreateBulk) OnConflict(opts ...sql.ConflictOption) *DecisionUpsertBulk { + _c.conflict = opts return &DecisionUpsertBulk{ - create: dcb, + create: _c, } } @@ -793,10 +793,10 @@ func (dcb *DecisionCreateBulk) OnConflict(opts ...sql.ConflictOption) *DecisionU // client.Decision.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (dcb *DecisionCreateBulk) OnConflictColumns(columns ...string) *DecisionUpsertBulk { - dcb.conflict = append(dcb.conflict, sql.ConflictColumns(columns...)) +func (_c *DecisionCreateBulk) OnConflictColumns(columns ...string) *DecisionUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &DecisionUpsertBulk{ - create: dcb, + create: _c, } } diff --git a/pkg/database/ent/decision_delete.go b/pkg/database/ent/decision_delete.go index 35bb87672..183c3b132 100644 --- a/pkg/database/ent/decision_delete.go +++ b/pkg/database/ent/decision_delete.go @@ -20,56 +20,56 @@ type DecisionDelete struct { } // Where appends a list predicates to the DecisionDelete builder. -func (dd *DecisionDelete) Where(ps ...predicate.Decision) *DecisionDelete { - dd.mutation.Where(ps...) - return dd +func (_d *DecisionDelete) Where(ps ...predicate.Decision) *DecisionDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (dd *DecisionDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, dd.sqlExec, dd.mutation, dd.hooks) +func (_d *DecisionDelete) 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 (dd *DecisionDelete) ExecX(ctx context.Context) int { - n, err := dd.Exec(ctx) +func (_d *DecisionDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (dd *DecisionDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *DecisionDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(decision.Table, sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt)) - if ps := dd.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, dd.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - dd.mutation.done = true + _d.mutation.done = true return affected, err } // DecisionDeleteOne is the builder for deleting a single Decision entity. type DecisionDeleteOne struct { - dd *DecisionDelete + _d *DecisionDelete } // Where appends a list predicates to the DecisionDelete builder. -func (ddo *DecisionDeleteOne) Where(ps ...predicate.Decision) *DecisionDeleteOne { - ddo.dd.mutation.Where(ps...) - return ddo +func (_d *DecisionDeleteOne) Where(ps ...predicate.Decision) *DecisionDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (ddo *DecisionDeleteOne) Exec(ctx context.Context) error { - n, err := ddo.dd.Exec(ctx) +func (_d *DecisionDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (ddo *DecisionDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (ddo *DecisionDeleteOne) ExecX(ctx context.Context) { - if err := ddo.Exec(ctx); err != nil { +func (_d *DecisionDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/decision_query.go b/pkg/database/ent/decision_query.go index e5f0b16e8..e83ad4ca0 100644 --- a/pkg/database/ent/decision_query.go +++ b/pkg/database/ent/decision_query.go @@ -30,44 +30,44 @@ type DecisionQuery struct { } // Where adds a new predicate for the DecisionQuery builder. -func (dq *DecisionQuery) Where(ps ...predicate.Decision) *DecisionQuery { - dq.predicates = append(dq.predicates, ps...) - return dq +func (_q *DecisionQuery) Where(ps ...predicate.Decision) *DecisionQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (dq *DecisionQuery) Limit(limit int) *DecisionQuery { - dq.ctx.Limit = &limit - return dq +func (_q *DecisionQuery) Limit(limit int) *DecisionQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (dq *DecisionQuery) Offset(offset int) *DecisionQuery { - dq.ctx.Offset = &offset - return dq +func (_q *DecisionQuery) Offset(offset int) *DecisionQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (dq *DecisionQuery) Unique(unique bool) *DecisionQuery { - dq.ctx.Unique = &unique - return dq +func (_q *DecisionQuery) Unique(unique bool) *DecisionQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (dq *DecisionQuery) Order(o ...decision.OrderOption) *DecisionQuery { - dq.order = append(dq.order, o...) - return dq +func (_q *DecisionQuery) Order(o ...decision.OrderOption) *DecisionQuery { + _q.order = append(_q.order, o...) + return _q } // QueryOwner chains the current query on the "owner" edge. -func (dq *DecisionQuery) QueryOwner() *AlertQuery { - query := (&AlertClient{config: dq.config}).Query() +func (_q *DecisionQuery) QueryOwner() *AlertQuery { + query := (&AlertClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := dq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := dq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -76,7 +76,7 @@ func (dq *DecisionQuery) QueryOwner() *AlertQuery { sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, decision.OwnerTable, decision.OwnerColumn), ) - fromU = sqlgraph.SetNeighbors(dq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query @@ -84,8 +84,8 @@ func (dq *DecisionQuery) QueryOwner() *AlertQuery { // First returns the first Decision entity from the query. // Returns a *NotFoundError when no Decision was found. -func (dq *DecisionQuery) First(ctx context.Context) (*Decision, error) { - nodes, err := dq.Limit(1).All(setContextOp(ctx, dq.ctx, ent.OpQueryFirst)) +func (_q *DecisionQuery) First(ctx context.Context) (*Decision, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -96,8 +96,8 @@ func (dq *DecisionQuery) First(ctx context.Context) (*Decision, error) { } // FirstX is like First, but panics if an error occurs. -func (dq *DecisionQuery) FirstX(ctx context.Context) *Decision { - node, err := dq.First(ctx) +func (_q *DecisionQuery) FirstX(ctx context.Context) *Decision { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -106,9 +106,9 @@ func (dq *DecisionQuery) FirstX(ctx context.Context) *Decision { // FirstID returns the first Decision ID from the query. // Returns a *NotFoundError when no Decision ID was found. -func (dq *DecisionQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *DecisionQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = dq.Limit(1).IDs(setContextOp(ctx, dq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -119,8 +119,8 @@ func (dq *DecisionQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (dq *DecisionQuery) FirstIDX(ctx context.Context) int { - id, err := dq.FirstID(ctx) +func (_q *DecisionQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -130,8 +130,8 @@ func (dq *DecisionQuery) FirstIDX(ctx context.Context) int { // Only returns a single Decision entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Decision entity is found. // Returns a *NotFoundError when no Decision entities are found. -func (dq *DecisionQuery) Only(ctx context.Context) (*Decision, error) { - nodes, err := dq.Limit(2).All(setContextOp(ctx, dq.ctx, ent.OpQueryOnly)) +func (_q *DecisionQuery) Only(ctx context.Context) (*Decision, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -146,8 +146,8 @@ func (dq *DecisionQuery) Only(ctx context.Context) (*Decision, error) { } // OnlyX is like Only, but panics if an error occurs. -func (dq *DecisionQuery) OnlyX(ctx context.Context) *Decision { - node, err := dq.Only(ctx) +func (_q *DecisionQuery) OnlyX(ctx context.Context) *Decision { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -157,9 +157,9 @@ func (dq *DecisionQuery) OnlyX(ctx context.Context) *Decision { // OnlyID is like Only, but returns the only Decision ID in the query. // Returns a *NotSingularError when more than one Decision ID is found. // Returns a *NotFoundError when no entities are found. -func (dq *DecisionQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *DecisionQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = dq.Limit(2).IDs(setContextOp(ctx, dq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -174,8 +174,8 @@ func (dq *DecisionQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (dq *DecisionQuery) OnlyIDX(ctx context.Context) int { - id, err := dq.OnlyID(ctx) +func (_q *DecisionQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -183,18 +183,18 @@ func (dq *DecisionQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of Decisions. -func (dq *DecisionQuery) All(ctx context.Context) ([]*Decision, error) { - ctx = setContextOp(ctx, dq.ctx, ent.OpQueryAll) - if err := dq.prepareQuery(ctx); err != nil { +func (_q *DecisionQuery) All(ctx context.Context) ([]*Decision, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Decision, *DecisionQuery]() - return withInterceptors[[]*Decision](ctx, dq, qr, dq.inters) + return withInterceptors[[]*Decision](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (dq *DecisionQuery) AllX(ctx context.Context) []*Decision { - nodes, err := dq.All(ctx) +func (_q *DecisionQuery) AllX(ctx context.Context) []*Decision { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -202,20 +202,20 @@ func (dq *DecisionQuery) AllX(ctx context.Context) []*Decision { } // IDs executes the query and returns a list of Decision IDs. -func (dq *DecisionQuery) IDs(ctx context.Context) (ids []int, err error) { - if dq.ctx.Unique == nil && dq.path != nil { - dq.Unique(true) +func (_q *DecisionQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, dq.ctx, ent.OpQueryIDs) - if err = dq.Select(decision.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(decision.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (dq *DecisionQuery) IDsX(ctx context.Context) []int { - ids, err := dq.IDs(ctx) +func (_q *DecisionQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -223,17 +223,17 @@ func (dq *DecisionQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (dq *DecisionQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, dq.ctx, ent.OpQueryCount) - if err := dq.prepareQuery(ctx); err != nil { +func (_q *DecisionQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, dq, querierCount[*DecisionQuery](), dq.inters) + return withInterceptors[int](ctx, _q, querierCount[*DecisionQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (dq *DecisionQuery) CountX(ctx context.Context) int { - count, err := dq.Count(ctx) +func (_q *DecisionQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -241,9 +241,9 @@ func (dq *DecisionQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (dq *DecisionQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, dq.ctx, ent.OpQueryExist) - switch _, err := dq.FirstID(ctx); { +func (_q *DecisionQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -254,8 +254,8 @@ func (dq *DecisionQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (dq *DecisionQuery) ExistX(ctx context.Context) bool { - exist, err := dq.Exist(ctx) +func (_q *DecisionQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -264,32 +264,32 @@ func (dq *DecisionQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the DecisionQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (dq *DecisionQuery) Clone() *DecisionQuery { - if dq == nil { +func (_q *DecisionQuery) Clone() *DecisionQuery { + if _q == nil { return nil } return &DecisionQuery{ - config: dq.config, - ctx: dq.ctx.Clone(), - order: append([]decision.OrderOption{}, dq.order...), - inters: append([]Interceptor{}, dq.inters...), - predicates: append([]predicate.Decision{}, dq.predicates...), - withOwner: dq.withOwner.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]decision.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Decision{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), // clone intermediate query. - sql: dq.sql.Clone(), - path: dq.path, + sql: _q.sql.Clone(), + path: _q.path, } } // WithOwner tells the query-builder to eager-load the nodes that are connected to // the "owner" edge. The optional arguments are used to configure the query builder of the edge. -func (dq *DecisionQuery) WithOwner(opts ...func(*AlertQuery)) *DecisionQuery { - query := (&AlertClient{config: dq.config}).Query() +func (_q *DecisionQuery) WithOwner(opts ...func(*AlertQuery)) *DecisionQuery { + query := (&AlertClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - dq.withOwner = query - return dq + _q.withOwner = query + return _q } // GroupBy is used to group vertices by one or more fields/columns. @@ -306,10 +306,10 @@ func (dq *DecisionQuery) WithOwner(opts ...func(*AlertQuery)) *DecisionQuery { // GroupBy(decision.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (dq *DecisionQuery) GroupBy(field string, fields ...string) *DecisionGroupBy { - dq.ctx.Fields = append([]string{field}, fields...) - grbuild := &DecisionGroupBy{build: dq} - grbuild.flds = &dq.ctx.Fields +func (_q *DecisionQuery) GroupBy(field string, fields ...string) *DecisionGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &DecisionGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = decision.Label grbuild.scan = grbuild.Scan return grbuild @@ -327,58 +327,58 @@ func (dq *DecisionQuery) GroupBy(field string, fields ...string) *DecisionGroupB // client.Decision.Query(). // Select(decision.FieldCreatedAt). // Scan(ctx, &v) -func (dq *DecisionQuery) Select(fields ...string) *DecisionSelect { - dq.ctx.Fields = append(dq.ctx.Fields, fields...) - sbuild := &DecisionSelect{DecisionQuery: dq} +func (_q *DecisionQuery) Select(fields ...string) *DecisionSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &DecisionSelect{DecisionQuery: _q} sbuild.label = decision.Label - sbuild.flds, sbuild.scan = &dq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a DecisionSelect configured with the given aggregations. -func (dq *DecisionQuery) Aggregate(fns ...AggregateFunc) *DecisionSelect { - return dq.Select().Aggregate(fns...) +func (_q *DecisionQuery) Aggregate(fns ...AggregateFunc) *DecisionSelect { + return _q.Select().Aggregate(fns...) } -func (dq *DecisionQuery) prepareQuery(ctx context.Context) error { - for _, inter := range dq.inters { +func (_q *DecisionQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, dq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range dq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !decision.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if dq.path != nil { - prev, err := dq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - dq.sql = prev + _q.sql = prev } return nil } -func (dq *DecisionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Decision, error) { +func (_q *DecisionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Decision, error) { var ( nodes = []*Decision{} - _spec = dq.querySpec() + _spec = _q.querySpec() loadedTypes = [1]bool{ - dq.withOwner != nil, + _q.withOwner != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Decision).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Decision{config: dq.config} + node := &Decision{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) @@ -386,14 +386,14 @@ func (dq *DecisionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Dec for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, dq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := dq.withOwner; query != nil { - if err := dq.loadOwner(ctx, query, nodes, nil, + if query := _q.withOwner; query != nil { + if err := _q.loadOwner(ctx, query, nodes, nil, func(n *Decision, e *Alert) { n.Edges.Owner = e }); err != nil { return nil, err } @@ -401,7 +401,7 @@ func (dq *DecisionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Dec return nodes, nil } -func (dq *DecisionQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []*Decision, init func(*Decision), assign func(*Decision, *Alert)) error { +func (_q *DecisionQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []*Decision, init func(*Decision), assign func(*Decision, *Alert)) error { ids := make([]int, 0, len(nodes)) nodeids := make(map[int][]*Decision) for i := range nodes { @@ -431,24 +431,24 @@ func (dq *DecisionQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes return nil } -func (dq *DecisionQuery) sqlCount(ctx context.Context) (int, error) { - _spec := dq.querySpec() - _spec.Node.Columns = dq.ctx.Fields - if len(dq.ctx.Fields) > 0 { - _spec.Unique = dq.ctx.Unique != nil && *dq.ctx.Unique +func (_q *DecisionQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, dq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (dq *DecisionQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *DecisionQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(decision.Table, decision.Columns, sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt)) - _spec.From = dq.sql - if unique := dq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if dq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := dq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, decision.FieldID) for i := range fields { @@ -456,24 +456,24 @@ func (dq *DecisionQuery) querySpec() *sqlgraph.QuerySpec { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } - if dq.withOwner != nil { + if _q.withOwner != nil { _spec.Node.AddColumnOnce(decision.FieldAlertDecisions) } } - if ps := dq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := dq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := dq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := dq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -483,33 +483,33 @@ func (dq *DecisionQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (dq *DecisionQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(dq.driver.Dialect()) +func (_q *DecisionQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(decision.Table) - columns := dq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = decision.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if dq.sql != nil { - selector = dq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if dq.ctx.Unique != nil && *dq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range dq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range dq.order { + for _, p := range _q.order { p(selector) } - if offset := dq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := dq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -522,41 +522,41 @@ type DecisionGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (dgb *DecisionGroupBy) Aggregate(fns ...AggregateFunc) *DecisionGroupBy { - dgb.fns = append(dgb.fns, fns...) - return dgb +func (_g *DecisionGroupBy) Aggregate(fns ...AggregateFunc) *DecisionGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (dgb *DecisionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, dgb.build.ctx, ent.OpQueryGroupBy) - if err := dgb.build.prepareQuery(ctx); err != nil { +func (_g *DecisionGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*DecisionQuery, *DecisionGroupBy](ctx, dgb.build, dgb, dgb.build.inters, v) + return scanWithInterceptors[*DecisionQuery, *DecisionGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (dgb *DecisionGroupBy) sqlScan(ctx context.Context, root *DecisionQuery, v any) error { +func (_g *DecisionGroupBy) sqlScan(ctx context.Context, root *DecisionQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(dgb.fns)) - for _, fn := range dgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*dgb.flds)+len(dgb.fns)) - for _, f := range *dgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*dgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := dgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -570,27 +570,27 @@ type DecisionSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ds *DecisionSelect) Aggregate(fns ...AggregateFunc) *DecisionSelect { - ds.fns = append(ds.fns, fns...) - return ds +func (_s *DecisionSelect) Aggregate(fns ...AggregateFunc) *DecisionSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ds *DecisionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ds.ctx, ent.OpQuerySelect) - if err := ds.prepareQuery(ctx); err != nil { +func (_s *DecisionSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*DecisionQuery, *DecisionSelect](ctx, ds.DecisionQuery, ds, ds.inters, v) + return scanWithInterceptors[*DecisionQuery, *DecisionSelect](ctx, _s.DecisionQuery, _s, _s.inters, v) } -func (ds *DecisionSelect) sqlScan(ctx context.Context, root *DecisionQuery, v any) error { +func (_s *DecisionSelect) sqlScan(ctx context.Context, root *DecisionQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ds.fns)) - for _, fn := range ds.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ds.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -598,7 +598,7 @@ func (ds *DecisionSelect) sqlScan(ctx context.Context, root *DecisionQuery, v an } rows := &sql.Rows{} query, args := selector.Query() - if err := ds.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/decision_update.go b/pkg/database/ent/decision_update.go index 68d0eb4ac..f37037957 100644 --- a/pkg/database/ent/decision_update.go +++ b/pkg/database/ent/decision_update.go @@ -24,96 +24,96 @@ type DecisionUpdate struct { } // Where appends a list predicates to the DecisionUpdate builder. -func (du *DecisionUpdate) Where(ps ...predicate.Decision) *DecisionUpdate { - du.mutation.Where(ps...) - return du +func (_u *DecisionUpdate) Where(ps ...predicate.Decision) *DecisionUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (du *DecisionUpdate) SetUpdatedAt(t time.Time) *DecisionUpdate { - du.mutation.SetUpdatedAt(t) - return du +func (_u *DecisionUpdate) SetUpdatedAt(v time.Time) *DecisionUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetUntil sets the "until" field. -func (du *DecisionUpdate) SetUntil(t time.Time) *DecisionUpdate { - du.mutation.SetUntil(t) - return du +func (_u *DecisionUpdate) SetUntil(v time.Time) *DecisionUpdate { + _u.mutation.SetUntil(v) + return _u } // SetNillableUntil sets the "until" field if the given value is not nil. -func (du *DecisionUpdate) SetNillableUntil(t *time.Time) *DecisionUpdate { - if t != nil { - du.SetUntil(*t) +func (_u *DecisionUpdate) SetNillableUntil(v *time.Time) *DecisionUpdate { + if v != nil { + _u.SetUntil(*v) } - return du + return _u } // ClearUntil clears the value of the "until" field. -func (du *DecisionUpdate) ClearUntil() *DecisionUpdate { - du.mutation.ClearUntil() - return du +func (_u *DecisionUpdate) ClearUntil() *DecisionUpdate { + _u.mutation.ClearUntil() + return _u } // SetAlertDecisions sets the "alert_decisions" field. -func (du *DecisionUpdate) SetAlertDecisions(i int) *DecisionUpdate { - du.mutation.SetAlertDecisions(i) - return du +func (_u *DecisionUpdate) SetAlertDecisions(v int) *DecisionUpdate { + _u.mutation.SetAlertDecisions(v) + return _u } // SetNillableAlertDecisions sets the "alert_decisions" field if the given value is not nil. -func (du *DecisionUpdate) SetNillableAlertDecisions(i *int) *DecisionUpdate { - if i != nil { - du.SetAlertDecisions(*i) +func (_u *DecisionUpdate) SetNillableAlertDecisions(v *int) *DecisionUpdate { + if v != nil { + _u.SetAlertDecisions(*v) } - return du + return _u } // ClearAlertDecisions clears the value of the "alert_decisions" field. -func (du *DecisionUpdate) ClearAlertDecisions() *DecisionUpdate { - du.mutation.ClearAlertDecisions() - return du +func (_u *DecisionUpdate) ClearAlertDecisions() *DecisionUpdate { + _u.mutation.ClearAlertDecisions() + return _u } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (du *DecisionUpdate) SetOwnerID(id int) *DecisionUpdate { - du.mutation.SetOwnerID(id) - return du +func (_u *DecisionUpdate) SetOwnerID(id int) *DecisionUpdate { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (du *DecisionUpdate) SetNillableOwnerID(id *int) *DecisionUpdate { +func (_u *DecisionUpdate) SetNillableOwnerID(id *int) *DecisionUpdate { if id != nil { - du = du.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return du + return _u } // SetOwner sets the "owner" edge to the Alert entity. -func (du *DecisionUpdate) SetOwner(a *Alert) *DecisionUpdate { - return du.SetOwnerID(a.ID) +func (_u *DecisionUpdate) SetOwner(v *Alert) *DecisionUpdate { + return _u.SetOwnerID(v.ID) } // Mutation returns the DecisionMutation object of the builder. -func (du *DecisionUpdate) Mutation() *DecisionMutation { - return du.mutation +func (_u *DecisionUpdate) Mutation() *DecisionMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Alert entity. -func (du *DecisionUpdate) ClearOwner() *DecisionUpdate { - du.mutation.ClearOwner() - return du +func (_u *DecisionUpdate) ClearOwner() *DecisionUpdate { + _u.mutation.ClearOwner() + return _u } // Save executes the query and returns the number of nodes affected by the update operation. -func (du *DecisionUpdate) Save(ctx context.Context) (int, error) { - du.defaults() - return withHooks(ctx, du.sqlSave, du.mutation, du.hooks) +func (_u *DecisionUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (du *DecisionUpdate) SaveX(ctx context.Context) int { - affected, err := du.Save(ctx) +func (_u *DecisionUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -121,63 +121,63 @@ func (du *DecisionUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (du *DecisionUpdate) Exec(ctx context.Context) error { - _, err := du.Save(ctx) +func (_u *DecisionUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (du *DecisionUpdate) ExecX(ctx context.Context) { - if err := du.Exec(ctx); err != nil { +func (_u *DecisionUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (du *DecisionUpdate) defaults() { - if _, ok := du.mutation.UpdatedAt(); !ok { +func (_u *DecisionUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := decision.UpdateDefaultUpdatedAt() - du.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (du *DecisionUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *DecisionUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(decision.Table, decision.Columns, sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt)) - if ps := du.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 := du.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(decision.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := du.mutation.Until(); ok { + if value, ok := _u.mutation.Until(); ok { _spec.SetField(decision.FieldUntil, field.TypeTime, value) } - if du.mutation.UntilCleared() { + if _u.mutation.UntilCleared() { _spec.ClearField(decision.FieldUntil, field.TypeTime) } - if du.mutation.StartIPCleared() { + if _u.mutation.StartIPCleared() { _spec.ClearField(decision.FieldStartIP, field.TypeInt64) } - if du.mutation.EndIPCleared() { + if _u.mutation.EndIPCleared() { _spec.ClearField(decision.FieldEndIP, field.TypeInt64) } - if du.mutation.StartSuffixCleared() { + if _u.mutation.StartSuffixCleared() { _spec.ClearField(decision.FieldStartSuffix, field.TypeInt64) } - if du.mutation.EndSuffixCleared() { + if _u.mutation.EndSuffixCleared() { _spec.ClearField(decision.FieldEndSuffix, field.TypeInt64) } - if du.mutation.IPSizeCleared() { + if _u.mutation.IPSizeCleared() { _spec.ClearField(decision.FieldIPSize, field.TypeInt64) } - if du.mutation.UUIDCleared() { + if _u.mutation.UUIDCleared() { _spec.ClearField(decision.FieldUUID, field.TypeString) } - if du.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -190,7 +190,7 @@ func (du *DecisionUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := du.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -206,7 +206,7 @@ func (du *DecisionUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if n, err = sqlgraph.UpdateNodes(ctx, du.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{decision.Label} } else if sqlgraph.IsConstraintError(err) { @@ -214,8 +214,8 @@ func (du *DecisionUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - du.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // DecisionUpdateOne is the builder for updating a single Decision entity. @@ -227,103 +227,103 @@ type DecisionUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (duo *DecisionUpdateOne) SetUpdatedAt(t time.Time) *DecisionUpdateOne { - duo.mutation.SetUpdatedAt(t) - return duo +func (_u *DecisionUpdateOne) SetUpdatedAt(v time.Time) *DecisionUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetUntil sets the "until" field. -func (duo *DecisionUpdateOne) SetUntil(t time.Time) *DecisionUpdateOne { - duo.mutation.SetUntil(t) - return duo +func (_u *DecisionUpdateOne) SetUntil(v time.Time) *DecisionUpdateOne { + _u.mutation.SetUntil(v) + return _u } // SetNillableUntil sets the "until" field if the given value is not nil. -func (duo *DecisionUpdateOne) SetNillableUntil(t *time.Time) *DecisionUpdateOne { - if t != nil { - duo.SetUntil(*t) +func (_u *DecisionUpdateOne) SetNillableUntil(v *time.Time) *DecisionUpdateOne { + if v != nil { + _u.SetUntil(*v) } - return duo + return _u } // ClearUntil clears the value of the "until" field. -func (duo *DecisionUpdateOne) ClearUntil() *DecisionUpdateOne { - duo.mutation.ClearUntil() - return duo +func (_u *DecisionUpdateOne) ClearUntil() *DecisionUpdateOne { + _u.mutation.ClearUntil() + return _u } // SetAlertDecisions sets the "alert_decisions" field. -func (duo *DecisionUpdateOne) SetAlertDecisions(i int) *DecisionUpdateOne { - duo.mutation.SetAlertDecisions(i) - return duo +func (_u *DecisionUpdateOne) SetAlertDecisions(v int) *DecisionUpdateOne { + _u.mutation.SetAlertDecisions(v) + return _u } // SetNillableAlertDecisions sets the "alert_decisions" field if the given value is not nil. -func (duo *DecisionUpdateOne) SetNillableAlertDecisions(i *int) *DecisionUpdateOne { - if i != nil { - duo.SetAlertDecisions(*i) +func (_u *DecisionUpdateOne) SetNillableAlertDecisions(v *int) *DecisionUpdateOne { + if v != nil { + _u.SetAlertDecisions(*v) } - return duo + return _u } // ClearAlertDecisions clears the value of the "alert_decisions" field. -func (duo *DecisionUpdateOne) ClearAlertDecisions() *DecisionUpdateOne { - duo.mutation.ClearAlertDecisions() - return duo +func (_u *DecisionUpdateOne) ClearAlertDecisions() *DecisionUpdateOne { + _u.mutation.ClearAlertDecisions() + return _u } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (duo *DecisionUpdateOne) SetOwnerID(id int) *DecisionUpdateOne { - duo.mutation.SetOwnerID(id) - return duo +func (_u *DecisionUpdateOne) SetOwnerID(id int) *DecisionUpdateOne { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (duo *DecisionUpdateOne) SetNillableOwnerID(id *int) *DecisionUpdateOne { +func (_u *DecisionUpdateOne) SetNillableOwnerID(id *int) *DecisionUpdateOne { if id != nil { - duo = duo.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return duo + return _u } // SetOwner sets the "owner" edge to the Alert entity. -func (duo *DecisionUpdateOne) SetOwner(a *Alert) *DecisionUpdateOne { - return duo.SetOwnerID(a.ID) +func (_u *DecisionUpdateOne) SetOwner(v *Alert) *DecisionUpdateOne { + return _u.SetOwnerID(v.ID) } // Mutation returns the DecisionMutation object of the builder. -func (duo *DecisionUpdateOne) Mutation() *DecisionMutation { - return duo.mutation +func (_u *DecisionUpdateOne) Mutation() *DecisionMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Alert entity. -func (duo *DecisionUpdateOne) ClearOwner() *DecisionUpdateOne { - duo.mutation.ClearOwner() - return duo +func (_u *DecisionUpdateOne) ClearOwner() *DecisionUpdateOne { + _u.mutation.ClearOwner() + return _u } // Where appends a list predicates to the DecisionUpdate builder. -func (duo *DecisionUpdateOne) Where(ps ...predicate.Decision) *DecisionUpdateOne { - duo.mutation.Where(ps...) - return duo +func (_u *DecisionUpdateOne) Where(ps ...predicate.Decision) *DecisionUpdateOne { + _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 (duo *DecisionUpdateOne) Select(field string, fields ...string) *DecisionUpdateOne { - duo.fields = append([]string{field}, fields...) - return duo +func (_u *DecisionUpdateOne) Select(field string, fields ...string) *DecisionUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Decision entity. -func (duo *DecisionUpdateOne) Save(ctx context.Context) (*Decision, error) { - duo.defaults() - return withHooks(ctx, duo.sqlSave, duo.mutation, duo.hooks) +func (_u *DecisionUpdateOne) Save(ctx context.Context) (*Decision, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (duo *DecisionUpdateOne) SaveX(ctx context.Context) *Decision { - node, err := duo.Save(ctx) +func (_u *DecisionUpdateOne) SaveX(ctx context.Context) *Decision { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -331,34 +331,34 @@ func (duo *DecisionUpdateOne) SaveX(ctx context.Context) *Decision { } // Exec executes the query on the entity. -func (duo *DecisionUpdateOne) Exec(ctx context.Context) error { - _, err := duo.Save(ctx) +func (_u *DecisionUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (duo *DecisionUpdateOne) ExecX(ctx context.Context) { - if err := duo.Exec(ctx); err != nil { +func (_u *DecisionUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (duo *DecisionUpdateOne) defaults() { - if _, ok := duo.mutation.UpdatedAt(); !ok { +func (_u *DecisionUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := decision.UpdateDefaultUpdatedAt() - duo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (duo *DecisionUpdateOne) sqlSave(ctx context.Context) (_node *Decision, err error) { +func (_u *DecisionUpdateOne) sqlSave(ctx context.Context) (_node *Decision, err error) { _spec := sqlgraph.NewUpdateSpec(decision.Table, decision.Columns, sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt)) - id, ok := duo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Decision.id" for update`)} } _spec.Node.ID.Value = id - if fields := duo.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, decision.FieldID) for _, f := range fields { @@ -370,41 +370,41 @@ func (duo *DecisionUpdateOne) sqlSave(ctx context.Context) (_node *Decision, err } } } - if ps := duo.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 := duo.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(decision.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := duo.mutation.Until(); ok { + if value, ok := _u.mutation.Until(); ok { _spec.SetField(decision.FieldUntil, field.TypeTime, value) } - if duo.mutation.UntilCleared() { + if _u.mutation.UntilCleared() { _spec.ClearField(decision.FieldUntil, field.TypeTime) } - if duo.mutation.StartIPCleared() { + if _u.mutation.StartIPCleared() { _spec.ClearField(decision.FieldStartIP, field.TypeInt64) } - if duo.mutation.EndIPCleared() { + if _u.mutation.EndIPCleared() { _spec.ClearField(decision.FieldEndIP, field.TypeInt64) } - if duo.mutation.StartSuffixCleared() { + if _u.mutation.StartSuffixCleared() { _spec.ClearField(decision.FieldStartSuffix, field.TypeInt64) } - if duo.mutation.EndSuffixCleared() { + if _u.mutation.EndSuffixCleared() { _spec.ClearField(decision.FieldEndSuffix, field.TypeInt64) } - if duo.mutation.IPSizeCleared() { + if _u.mutation.IPSizeCleared() { _spec.ClearField(decision.FieldIPSize, field.TypeInt64) } - if duo.mutation.UUIDCleared() { + if _u.mutation.UUIDCleared() { _spec.ClearField(decision.FieldUUID, field.TypeString) } - if duo.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -417,7 +417,7 @@ func (duo *DecisionUpdateOne) sqlSave(ctx context.Context) (_node *Decision, err } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := duo.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -433,10 +433,10 @@ func (duo *DecisionUpdateOne) sqlSave(ctx context.Context) (_node *Decision, err } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - _node = &Decision{config: duo.config} + _node = &Decision{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, duo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{decision.Label} } else if sqlgraph.IsConstraintError(err) { @@ -444,6 +444,6 @@ func (duo *DecisionUpdateOne) sqlSave(ctx context.Context) (_node *Decision, err } return nil, err } - duo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/ent.go b/pkg/database/ent/ent.go index b28333afa..6b9fe23a2 100644 --- a/pkg/database/ent/ent.go +++ b/pkg/database/ent/ent.go @@ -80,7 +80,7 @@ var ( ) // checkColumn checks if the column exists in the given table. -func checkColumn(table, column string) error { +func checkColumn(t, c string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ alert.Table: alert.ValidColumn, @@ -96,7 +96,7 @@ func checkColumn(table, column string) error { metric.Table: metric.ValidColumn, }) }) - return columnCheck(table, column) + return columnCheck(t, c) } // Asc applies the given fields in ASC order. diff --git a/pkg/database/ent/event.go b/pkg/database/ent/event.go index b57f1f34a..4def0c319 100644 --- a/pkg/database/ent/event.go +++ b/pkg/database/ent/event.go @@ -74,7 +74,7 @@ func (*Event) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Event fields. -func (e *Event) assignValues(columns []string, values []any) error { +func (_m *Event) 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) } @@ -85,39 +85,39 @@ func (e *Event) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - e.ID = int(value.Int64) + _m.ID = int(value.Int64) case event.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - e.CreatedAt = value.Time + _m.CreatedAt = value.Time } case event.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - e.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case event.FieldTime: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field time", values[i]) } else if value.Valid { - e.Time = value.Time + _m.Time = value.Time } case event.FieldSerialized: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field serialized", values[i]) } else if value.Valid { - e.Serialized = value.String + _m.Serialized = value.String } case event.FieldAlertEvents: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field alert_events", values[i]) } else if value.Valid { - e.AlertEvents = int(value.Int64) + _m.AlertEvents = int(value.Int64) } default: - e.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -125,52 +125,52 @@ func (e *Event) assignValues(columns []string, values []any) error { // Value returns the ent.Value that was dynamically selected and assigned to the Event. // This includes values selected through modifiers, order, etc. -func (e *Event) Value(name string) (ent.Value, error) { - return e.selectValues.Get(name) +func (_m *Event) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // QueryOwner queries the "owner" edge of the Event entity. -func (e *Event) QueryOwner() *AlertQuery { - return NewEventClient(e.config).QueryOwner(e) +func (_m *Event) QueryOwner() *AlertQuery { + return NewEventClient(_m.config).QueryOwner(_m) } // Update returns a builder for updating this Event. // Note that you need to call Event.Unwrap() before calling this method if this Event // was returned from a transaction, and the transaction was committed or rolled back. -func (e *Event) Update() *EventUpdateOne { - return NewEventClient(e.config).UpdateOne(e) +func (_m *Event) Update() *EventUpdateOne { + return NewEventClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Event 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 (e *Event) Unwrap() *Event { - _tx, ok := e.config.driver.(*txDriver) +func (_m *Event) Unwrap() *Event { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Event is not a transactional entity") } - e.config.driver = _tx.drv - return e + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (e *Event) String() string { +func (_m *Event) String() string { var builder strings.Builder builder.WriteString("Event(") - builder.WriteString(fmt.Sprintf("id=%v, ", e.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(e.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(e.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("time=") - builder.WriteString(e.Time.Format(time.ANSIC)) + builder.WriteString(_m.Time.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("serialized=") - builder.WriteString(e.Serialized) + builder.WriteString(_m.Serialized) builder.WriteString(", ") builder.WriteString("alert_events=") - builder.WriteString(fmt.Sprintf("%v", e.AlertEvents)) + builder.WriteString(fmt.Sprintf("%v", _m.AlertEvents)) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/event_create.go b/pkg/database/ent/event_create.go index 7505c616a..8e507b611 100644 --- a/pkg/database/ent/event_create.go +++ b/pkg/database/ent/event_create.go @@ -24,92 +24,92 @@ type EventCreate struct { } // SetCreatedAt sets the "created_at" field. -func (ec *EventCreate) SetCreatedAt(t time.Time) *EventCreate { - ec.mutation.SetCreatedAt(t) - return ec +func (_c *EventCreate) SetCreatedAt(v time.Time) *EventCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (ec *EventCreate) SetNillableCreatedAt(t *time.Time) *EventCreate { - if t != nil { - ec.SetCreatedAt(*t) +func (_c *EventCreate) SetNillableCreatedAt(v *time.Time) *EventCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return ec + return _c } // SetUpdatedAt sets the "updated_at" field. -func (ec *EventCreate) SetUpdatedAt(t time.Time) *EventCreate { - ec.mutation.SetUpdatedAt(t) - return ec +func (_c *EventCreate) SetUpdatedAt(v time.Time) *EventCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (ec *EventCreate) SetNillableUpdatedAt(t *time.Time) *EventCreate { - if t != nil { - ec.SetUpdatedAt(*t) +func (_c *EventCreate) SetNillableUpdatedAt(v *time.Time) *EventCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return ec + return _c } // SetTime sets the "time" field. -func (ec *EventCreate) SetTime(t time.Time) *EventCreate { - ec.mutation.SetTime(t) - return ec +func (_c *EventCreate) SetTime(v time.Time) *EventCreate { + _c.mutation.SetTime(v) + return _c } // SetSerialized sets the "serialized" field. -func (ec *EventCreate) SetSerialized(s string) *EventCreate { - ec.mutation.SetSerialized(s) - return ec +func (_c *EventCreate) SetSerialized(v string) *EventCreate { + _c.mutation.SetSerialized(v) + return _c } // SetAlertEvents sets the "alert_events" field. -func (ec *EventCreate) SetAlertEvents(i int) *EventCreate { - ec.mutation.SetAlertEvents(i) - return ec +func (_c *EventCreate) SetAlertEvents(v int) *EventCreate { + _c.mutation.SetAlertEvents(v) + return _c } // SetNillableAlertEvents sets the "alert_events" field if the given value is not nil. -func (ec *EventCreate) SetNillableAlertEvents(i *int) *EventCreate { - if i != nil { - ec.SetAlertEvents(*i) +func (_c *EventCreate) SetNillableAlertEvents(v *int) *EventCreate { + if v != nil { + _c.SetAlertEvents(*v) } - return ec + return _c } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (ec *EventCreate) SetOwnerID(id int) *EventCreate { - ec.mutation.SetOwnerID(id) - return ec +func (_c *EventCreate) SetOwnerID(id int) *EventCreate { + _c.mutation.SetOwnerID(id) + return _c } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (ec *EventCreate) SetNillableOwnerID(id *int) *EventCreate { +func (_c *EventCreate) SetNillableOwnerID(id *int) *EventCreate { if id != nil { - ec = ec.SetOwnerID(*id) + _c = _c.SetOwnerID(*id) } - return ec + return _c } // SetOwner sets the "owner" edge to the Alert entity. -func (ec *EventCreate) SetOwner(a *Alert) *EventCreate { - return ec.SetOwnerID(a.ID) +func (_c *EventCreate) SetOwner(v *Alert) *EventCreate { + return _c.SetOwnerID(v.ID) } // Mutation returns the EventMutation object of the builder. -func (ec *EventCreate) Mutation() *EventMutation { - return ec.mutation +func (_c *EventCreate) Mutation() *EventMutation { + return _c.mutation } // Save creates the Event in the database. -func (ec *EventCreate) Save(ctx context.Context) (*Event, error) { - ec.defaults() - return withHooks(ctx, ec.sqlSave, ec.mutation, ec.hooks) +func (_c *EventCreate) Save(ctx context.Context) (*Event, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (ec *EventCreate) SaveX(ctx context.Context) *Event { - v, err := ec.Save(ctx) +func (_c *EventCreate) SaveX(ctx context.Context) *Event { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -117,45 +117,45 @@ func (ec *EventCreate) SaveX(ctx context.Context) *Event { } // Exec executes the query. -func (ec *EventCreate) Exec(ctx context.Context) error { - _, err := ec.Save(ctx) +func (_c *EventCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (ec *EventCreate) ExecX(ctx context.Context) { - if err := ec.Exec(ctx); err != nil { +func (_c *EventCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (ec *EventCreate) defaults() { - if _, ok := ec.mutation.CreatedAt(); !ok { +func (_c *EventCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := event.DefaultCreatedAt() - ec.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := ec.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := event.DefaultUpdatedAt() - ec.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (ec *EventCreate) check() error { - if _, ok := ec.mutation.CreatedAt(); !ok { +func (_c *EventCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Event.created_at"`)} } - if _, ok := ec.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Event.updated_at"`)} } - if _, ok := ec.mutation.Time(); !ok { + if _, ok := _c.mutation.Time(); !ok { return &ValidationError{Name: "time", err: errors.New(`ent: missing required field "Event.time"`)} } - if _, ok := ec.mutation.Serialized(); !ok { + if _, ok := _c.mutation.Serialized(); !ok { return &ValidationError{Name: "serialized", err: errors.New(`ent: missing required field "Event.serialized"`)} } - if v, ok := ec.mutation.Serialized(); ok { + if v, ok := _c.mutation.Serialized(); ok { if err := event.SerializedValidator(v); err != nil { return &ValidationError{Name: "serialized", err: fmt.Errorf(`ent: validator failed for field "Event.serialized": %w`, err)} } @@ -163,12 +163,12 @@ func (ec *EventCreate) check() error { return nil } -func (ec *EventCreate) sqlSave(ctx context.Context) (*Event, error) { - if err := ec.check(); err != nil { +func (_c *EventCreate) sqlSave(ctx context.Context) (*Event, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := ec.createSpec() - if err := sqlgraph.CreateNode(ctx, ec.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -176,34 +176,34 @@ func (ec *EventCreate) sqlSave(ctx context.Context) (*Event, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - ec.mutation.id = &_node.ID - ec.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (ec *EventCreate) createSpec() (*Event, *sqlgraph.CreateSpec) { +func (_c *EventCreate) createSpec() (*Event, *sqlgraph.CreateSpec) { var ( - _node = &Event{config: ec.config} + _node = &Event{config: _c.config} _spec = sqlgraph.NewCreateSpec(event.Table, sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt)) ) - _spec.OnConflict = ec.conflict - if value, ok := ec.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(event.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := ec.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(event.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := ec.mutation.Time(); ok { + if value, ok := _c.mutation.Time(); ok { _spec.SetField(event.FieldTime, field.TypeTime, value) _node.Time = value } - if value, ok := ec.mutation.Serialized(); ok { + if value, ok := _c.mutation.Serialized(); ok { _spec.SetField(event.FieldSerialized, field.TypeString, value) _node.Serialized = value } - if nodes := ec.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -239,10 +239,10 @@ func (ec *EventCreate) createSpec() (*Event, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (ec *EventCreate) OnConflict(opts ...sql.ConflictOption) *EventUpsertOne { - ec.conflict = opts +func (_c *EventCreate) OnConflict(opts ...sql.ConflictOption) *EventUpsertOne { + _c.conflict = opts return &EventUpsertOne{ - create: ec, + create: _c, } } @@ -252,10 +252,10 @@ func (ec *EventCreate) OnConflict(opts ...sql.ConflictOption) *EventUpsertOne { // client.Event.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (ec *EventCreate) OnConflictColumns(columns ...string) *EventUpsertOne { - ec.conflict = append(ec.conflict, sql.ConflictColumns(columns...)) +func (_c *EventCreate) OnConflictColumns(columns ...string) *EventUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &EventUpsertOne{ - create: ec, + create: _c, } } @@ -430,16 +430,16 @@ type EventCreateBulk struct { } // Save creates the Event entities in the database. -func (ecb *EventCreateBulk) Save(ctx context.Context) ([]*Event, error) { - if ecb.err != nil { - return nil, ecb.err +func (_c *EventCreateBulk) Save(ctx context.Context) ([]*Event, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(ecb.builders)) - nodes := make([]*Event, len(ecb.builders)) - mutators := make([]Mutator, len(ecb.builders)) - for i := range ecb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Event, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := ecb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*EventMutation) @@ -453,12 +453,12 @@ func (ecb *EventCreateBulk) Save(ctx context.Context) ([]*Event, error) { var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, ecb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = ecb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, ecb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -482,7 +482,7 @@ func (ecb *EventCreateBulk) Save(ctx context.Context) ([]*Event, error) { }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, ecb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -490,8 +490,8 @@ func (ecb *EventCreateBulk) Save(ctx context.Context) ([]*Event, error) { } // SaveX is like Save, but panics if an error occurs. -func (ecb *EventCreateBulk) SaveX(ctx context.Context) []*Event { - v, err := ecb.Save(ctx) +func (_c *EventCreateBulk) SaveX(ctx context.Context) []*Event { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -499,14 +499,14 @@ func (ecb *EventCreateBulk) SaveX(ctx context.Context) []*Event { } // Exec executes the query. -func (ecb *EventCreateBulk) Exec(ctx context.Context) error { - _, err := ecb.Save(ctx) +func (_c *EventCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (ecb *EventCreateBulk) ExecX(ctx context.Context) { - if err := ecb.Exec(ctx); err != nil { +func (_c *EventCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -526,10 +526,10 @@ func (ecb *EventCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (ecb *EventCreateBulk) OnConflict(opts ...sql.ConflictOption) *EventUpsertBulk { - ecb.conflict = opts +func (_c *EventCreateBulk) OnConflict(opts ...sql.ConflictOption) *EventUpsertBulk { + _c.conflict = opts return &EventUpsertBulk{ - create: ecb, + create: _c, } } @@ -539,10 +539,10 @@ func (ecb *EventCreateBulk) OnConflict(opts ...sql.ConflictOption) *EventUpsertB // client.Event.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (ecb *EventCreateBulk) OnConflictColumns(columns ...string) *EventUpsertBulk { - ecb.conflict = append(ecb.conflict, sql.ConflictColumns(columns...)) +func (_c *EventCreateBulk) OnConflictColumns(columns ...string) *EventUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &EventUpsertBulk{ - create: ecb, + create: _c, } } diff --git a/pkg/database/ent/event_delete.go b/pkg/database/ent/event_delete.go index 93dd1246b..db1ee2683 100644 --- a/pkg/database/ent/event_delete.go +++ b/pkg/database/ent/event_delete.go @@ -20,56 +20,56 @@ type EventDelete struct { } // Where appends a list predicates to the EventDelete builder. -func (ed *EventDelete) Where(ps ...predicate.Event) *EventDelete { - ed.mutation.Where(ps...) - return ed +func (_d *EventDelete) Where(ps ...predicate.Event) *EventDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (ed *EventDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, ed.sqlExec, ed.mutation, ed.hooks) +func (_d *EventDelete) 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 (ed *EventDelete) ExecX(ctx context.Context) int { - n, err := ed.Exec(ctx) +func (_d *EventDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (ed *EventDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *EventDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(event.Table, sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt)) - if ps := ed.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, ed.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - ed.mutation.done = true + _d.mutation.done = true return affected, err } // EventDeleteOne is the builder for deleting a single Event entity. type EventDeleteOne struct { - ed *EventDelete + _d *EventDelete } // Where appends a list predicates to the EventDelete builder. -func (edo *EventDeleteOne) Where(ps ...predicate.Event) *EventDeleteOne { - edo.ed.mutation.Where(ps...) - return edo +func (_d *EventDeleteOne) Where(ps ...predicate.Event) *EventDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (edo *EventDeleteOne) Exec(ctx context.Context) error { - n, err := edo.ed.Exec(ctx) +func (_d *EventDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (edo *EventDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (edo *EventDeleteOne) ExecX(ctx context.Context) { - if err := edo.Exec(ctx); err != nil { +func (_d *EventDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/event_query.go b/pkg/database/ent/event_query.go index 2a8a8d641..abdddeac2 100644 --- a/pkg/database/ent/event_query.go +++ b/pkg/database/ent/event_query.go @@ -30,44 +30,44 @@ type EventQuery struct { } // Where adds a new predicate for the EventQuery builder. -func (eq *EventQuery) Where(ps ...predicate.Event) *EventQuery { - eq.predicates = append(eq.predicates, ps...) - return eq +func (_q *EventQuery) Where(ps ...predicate.Event) *EventQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (eq *EventQuery) Limit(limit int) *EventQuery { - eq.ctx.Limit = &limit - return eq +func (_q *EventQuery) Limit(limit int) *EventQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (eq *EventQuery) Offset(offset int) *EventQuery { - eq.ctx.Offset = &offset - return eq +func (_q *EventQuery) Offset(offset int) *EventQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (eq *EventQuery) Unique(unique bool) *EventQuery { - eq.ctx.Unique = &unique - return eq +func (_q *EventQuery) Unique(unique bool) *EventQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (eq *EventQuery) Order(o ...event.OrderOption) *EventQuery { - eq.order = append(eq.order, o...) - return eq +func (_q *EventQuery) Order(o ...event.OrderOption) *EventQuery { + _q.order = append(_q.order, o...) + return _q } // QueryOwner chains the current query on the "owner" edge. -func (eq *EventQuery) QueryOwner() *AlertQuery { - query := (&AlertClient{config: eq.config}).Query() +func (_q *EventQuery) QueryOwner() *AlertQuery { + query := (&AlertClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := eq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := eq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -76,7 +76,7 @@ func (eq *EventQuery) QueryOwner() *AlertQuery { sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, event.OwnerTable, event.OwnerColumn), ) - fromU = sqlgraph.SetNeighbors(eq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query @@ -84,8 +84,8 @@ func (eq *EventQuery) QueryOwner() *AlertQuery { // First returns the first Event entity from the query. // Returns a *NotFoundError when no Event was found. -func (eq *EventQuery) First(ctx context.Context) (*Event, error) { - nodes, err := eq.Limit(1).All(setContextOp(ctx, eq.ctx, ent.OpQueryFirst)) +func (_q *EventQuery) First(ctx context.Context) (*Event, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -96,8 +96,8 @@ func (eq *EventQuery) First(ctx context.Context) (*Event, error) { } // FirstX is like First, but panics if an error occurs. -func (eq *EventQuery) FirstX(ctx context.Context) *Event { - node, err := eq.First(ctx) +func (_q *EventQuery) FirstX(ctx context.Context) *Event { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -106,9 +106,9 @@ func (eq *EventQuery) FirstX(ctx context.Context) *Event { // FirstID returns the first Event ID from the query. // Returns a *NotFoundError when no Event ID was found. -func (eq *EventQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *EventQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = eq.Limit(1).IDs(setContextOp(ctx, eq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -119,8 +119,8 @@ func (eq *EventQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (eq *EventQuery) FirstIDX(ctx context.Context) int { - id, err := eq.FirstID(ctx) +func (_q *EventQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -130,8 +130,8 @@ func (eq *EventQuery) FirstIDX(ctx context.Context) int { // Only returns a single Event entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Event entity is found. // Returns a *NotFoundError when no Event entities are found. -func (eq *EventQuery) Only(ctx context.Context) (*Event, error) { - nodes, err := eq.Limit(2).All(setContextOp(ctx, eq.ctx, ent.OpQueryOnly)) +func (_q *EventQuery) Only(ctx context.Context) (*Event, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -146,8 +146,8 @@ func (eq *EventQuery) Only(ctx context.Context) (*Event, error) { } // OnlyX is like Only, but panics if an error occurs. -func (eq *EventQuery) OnlyX(ctx context.Context) *Event { - node, err := eq.Only(ctx) +func (_q *EventQuery) OnlyX(ctx context.Context) *Event { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -157,9 +157,9 @@ func (eq *EventQuery) OnlyX(ctx context.Context) *Event { // OnlyID is like Only, but returns the only Event ID in the query. // Returns a *NotSingularError when more than one Event ID is found. // Returns a *NotFoundError when no entities are found. -func (eq *EventQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *EventQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = eq.Limit(2).IDs(setContextOp(ctx, eq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -174,8 +174,8 @@ func (eq *EventQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (eq *EventQuery) OnlyIDX(ctx context.Context) int { - id, err := eq.OnlyID(ctx) +func (_q *EventQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -183,18 +183,18 @@ func (eq *EventQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of Events. -func (eq *EventQuery) All(ctx context.Context) ([]*Event, error) { - ctx = setContextOp(ctx, eq.ctx, ent.OpQueryAll) - if err := eq.prepareQuery(ctx); err != nil { +func (_q *EventQuery) All(ctx context.Context) ([]*Event, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Event, *EventQuery]() - return withInterceptors[[]*Event](ctx, eq, qr, eq.inters) + return withInterceptors[[]*Event](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (eq *EventQuery) AllX(ctx context.Context) []*Event { - nodes, err := eq.All(ctx) +func (_q *EventQuery) AllX(ctx context.Context) []*Event { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -202,20 +202,20 @@ func (eq *EventQuery) AllX(ctx context.Context) []*Event { } // IDs executes the query and returns a list of Event IDs. -func (eq *EventQuery) IDs(ctx context.Context) (ids []int, err error) { - if eq.ctx.Unique == nil && eq.path != nil { - eq.Unique(true) +func (_q *EventQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, eq.ctx, ent.OpQueryIDs) - if err = eq.Select(event.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(event.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (eq *EventQuery) IDsX(ctx context.Context) []int { - ids, err := eq.IDs(ctx) +func (_q *EventQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -223,17 +223,17 @@ func (eq *EventQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (eq *EventQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, eq.ctx, ent.OpQueryCount) - if err := eq.prepareQuery(ctx); err != nil { +func (_q *EventQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, eq, querierCount[*EventQuery](), eq.inters) + return withInterceptors[int](ctx, _q, querierCount[*EventQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (eq *EventQuery) CountX(ctx context.Context) int { - count, err := eq.Count(ctx) +func (_q *EventQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -241,9 +241,9 @@ func (eq *EventQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (eq *EventQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, eq.ctx, ent.OpQueryExist) - switch _, err := eq.FirstID(ctx); { +func (_q *EventQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -254,8 +254,8 @@ func (eq *EventQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (eq *EventQuery) ExistX(ctx context.Context) bool { - exist, err := eq.Exist(ctx) +func (_q *EventQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -264,32 +264,32 @@ func (eq *EventQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the EventQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (eq *EventQuery) Clone() *EventQuery { - if eq == nil { +func (_q *EventQuery) Clone() *EventQuery { + if _q == nil { return nil } return &EventQuery{ - config: eq.config, - ctx: eq.ctx.Clone(), - order: append([]event.OrderOption{}, eq.order...), - inters: append([]Interceptor{}, eq.inters...), - predicates: append([]predicate.Event{}, eq.predicates...), - withOwner: eq.withOwner.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]event.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Event{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), // clone intermediate query. - sql: eq.sql.Clone(), - path: eq.path, + sql: _q.sql.Clone(), + path: _q.path, } } // WithOwner tells the query-builder to eager-load the nodes that are connected to // the "owner" edge. The optional arguments are used to configure the query builder of the edge. -func (eq *EventQuery) WithOwner(opts ...func(*AlertQuery)) *EventQuery { - query := (&AlertClient{config: eq.config}).Query() +func (_q *EventQuery) WithOwner(opts ...func(*AlertQuery)) *EventQuery { + query := (&AlertClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - eq.withOwner = query - return eq + _q.withOwner = query + return _q } // GroupBy is used to group vertices by one or more fields/columns. @@ -306,10 +306,10 @@ func (eq *EventQuery) WithOwner(opts ...func(*AlertQuery)) *EventQuery { // GroupBy(event.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (eq *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy { - eq.ctx.Fields = append([]string{field}, fields...) - grbuild := &EventGroupBy{build: eq} - grbuild.flds = &eq.ctx.Fields +func (_q *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &EventGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = event.Label grbuild.scan = grbuild.Scan return grbuild @@ -327,58 +327,58 @@ func (eq *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy { // client.Event.Query(). // Select(event.FieldCreatedAt). // Scan(ctx, &v) -func (eq *EventQuery) Select(fields ...string) *EventSelect { - eq.ctx.Fields = append(eq.ctx.Fields, fields...) - sbuild := &EventSelect{EventQuery: eq} +func (_q *EventQuery) Select(fields ...string) *EventSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &EventSelect{EventQuery: _q} sbuild.label = event.Label - sbuild.flds, sbuild.scan = &eq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a EventSelect configured with the given aggregations. -func (eq *EventQuery) Aggregate(fns ...AggregateFunc) *EventSelect { - return eq.Select().Aggregate(fns...) +func (_q *EventQuery) Aggregate(fns ...AggregateFunc) *EventSelect { + return _q.Select().Aggregate(fns...) } -func (eq *EventQuery) prepareQuery(ctx context.Context) error { - for _, inter := range eq.inters { +func (_q *EventQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, eq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range eq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !event.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if eq.path != nil { - prev, err := eq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - eq.sql = prev + _q.sql = prev } return nil } -func (eq *EventQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Event, error) { +func (_q *EventQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Event, error) { var ( nodes = []*Event{} - _spec = eq.querySpec() + _spec = _q.querySpec() loadedTypes = [1]bool{ - eq.withOwner != nil, + _q.withOwner != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Event).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Event{config: eq.config} + node := &Event{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) @@ -386,14 +386,14 @@ func (eq *EventQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Event, for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, eq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := eq.withOwner; query != nil { - if err := eq.loadOwner(ctx, query, nodes, nil, + if query := _q.withOwner; query != nil { + if err := _q.loadOwner(ctx, query, nodes, nil, func(n *Event, e *Alert) { n.Edges.Owner = e }); err != nil { return nil, err } @@ -401,7 +401,7 @@ func (eq *EventQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Event, return nodes, nil } -func (eq *EventQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []*Event, init func(*Event), assign func(*Event, *Alert)) error { +func (_q *EventQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []*Event, init func(*Event), assign func(*Event, *Alert)) error { ids := make([]int, 0, len(nodes)) nodeids := make(map[int][]*Event) for i := range nodes { @@ -431,24 +431,24 @@ func (eq *EventQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes [] return nil } -func (eq *EventQuery) sqlCount(ctx context.Context) (int, error) { - _spec := eq.querySpec() - _spec.Node.Columns = eq.ctx.Fields - if len(eq.ctx.Fields) > 0 { - _spec.Unique = eq.ctx.Unique != nil && *eq.ctx.Unique +func (_q *EventQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, eq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (eq *EventQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *EventQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(event.Table, event.Columns, sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt)) - _spec.From = eq.sql - if unique := eq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if eq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := eq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, event.FieldID) for i := range fields { @@ -456,24 +456,24 @@ func (eq *EventQuery) querySpec() *sqlgraph.QuerySpec { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } - if eq.withOwner != nil { + if _q.withOwner != nil { _spec.Node.AddColumnOnce(event.FieldAlertEvents) } } - if ps := eq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := eq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := eq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := eq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -483,33 +483,33 @@ func (eq *EventQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (eq *EventQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(eq.driver.Dialect()) +func (_q *EventQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(event.Table) - columns := eq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = event.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if eq.sql != nil { - selector = eq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if eq.ctx.Unique != nil && *eq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range eq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range eq.order { + for _, p := range _q.order { p(selector) } - if offset := eq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := eq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -522,41 +522,41 @@ type EventGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (egb *EventGroupBy) Aggregate(fns ...AggregateFunc) *EventGroupBy { - egb.fns = append(egb.fns, fns...) - return egb +func (_g *EventGroupBy) Aggregate(fns ...AggregateFunc) *EventGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (egb *EventGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, egb.build.ctx, ent.OpQueryGroupBy) - if err := egb.build.prepareQuery(ctx); err != nil { +func (_g *EventGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*EventQuery, *EventGroupBy](ctx, egb.build, egb, egb.build.inters, v) + return scanWithInterceptors[*EventQuery, *EventGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (egb *EventGroupBy) sqlScan(ctx context.Context, root *EventQuery, v any) error { +func (_g *EventGroupBy) sqlScan(ctx context.Context, root *EventQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(egb.fns)) - for _, fn := range egb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*egb.flds)+len(egb.fns)) - for _, f := range *egb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*egb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := egb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -570,27 +570,27 @@ type EventSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (es *EventSelect) Aggregate(fns ...AggregateFunc) *EventSelect { - es.fns = append(es.fns, fns...) - return es +func (_s *EventSelect) Aggregate(fns ...AggregateFunc) *EventSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (es *EventSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, es.ctx, ent.OpQuerySelect) - if err := es.prepareQuery(ctx); err != nil { +func (_s *EventSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*EventQuery, *EventSelect](ctx, es.EventQuery, es, es.inters, v) + return scanWithInterceptors[*EventQuery, *EventSelect](ctx, _s.EventQuery, _s, _s.inters, v) } -func (es *EventSelect) sqlScan(ctx context.Context, root *EventQuery, v any) error { +func (_s *EventSelect) sqlScan(ctx context.Context, root *EventQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(es.fns)) - for _, fn := range es.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*es.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -598,7 +598,7 @@ func (es *EventSelect) sqlScan(ctx context.Context, root *EventQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := es.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/event_update.go b/pkg/database/ent/event_update.go index c2f5c6cdd..cc3a0d9f5 100644 --- a/pkg/database/ent/event_update.go +++ b/pkg/database/ent/event_update.go @@ -24,76 +24,76 @@ type EventUpdate struct { } // Where appends a list predicates to the EventUpdate builder. -func (eu *EventUpdate) Where(ps ...predicate.Event) *EventUpdate { - eu.mutation.Where(ps...) - return eu +func (_u *EventUpdate) Where(ps ...predicate.Event) *EventUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (eu *EventUpdate) SetUpdatedAt(t time.Time) *EventUpdate { - eu.mutation.SetUpdatedAt(t) - return eu +func (_u *EventUpdate) SetUpdatedAt(v time.Time) *EventUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetAlertEvents sets the "alert_events" field. -func (eu *EventUpdate) SetAlertEvents(i int) *EventUpdate { - eu.mutation.SetAlertEvents(i) - return eu +func (_u *EventUpdate) SetAlertEvents(v int) *EventUpdate { + _u.mutation.SetAlertEvents(v) + return _u } // SetNillableAlertEvents sets the "alert_events" field if the given value is not nil. -func (eu *EventUpdate) SetNillableAlertEvents(i *int) *EventUpdate { - if i != nil { - eu.SetAlertEvents(*i) +func (_u *EventUpdate) SetNillableAlertEvents(v *int) *EventUpdate { + if v != nil { + _u.SetAlertEvents(*v) } - return eu + return _u } // ClearAlertEvents clears the value of the "alert_events" field. -func (eu *EventUpdate) ClearAlertEvents() *EventUpdate { - eu.mutation.ClearAlertEvents() - return eu +func (_u *EventUpdate) ClearAlertEvents() *EventUpdate { + _u.mutation.ClearAlertEvents() + return _u } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (eu *EventUpdate) SetOwnerID(id int) *EventUpdate { - eu.mutation.SetOwnerID(id) - return eu +func (_u *EventUpdate) SetOwnerID(id int) *EventUpdate { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (eu *EventUpdate) SetNillableOwnerID(id *int) *EventUpdate { +func (_u *EventUpdate) SetNillableOwnerID(id *int) *EventUpdate { if id != nil { - eu = eu.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return eu + return _u } // SetOwner sets the "owner" edge to the Alert entity. -func (eu *EventUpdate) SetOwner(a *Alert) *EventUpdate { - return eu.SetOwnerID(a.ID) +func (_u *EventUpdate) SetOwner(v *Alert) *EventUpdate { + return _u.SetOwnerID(v.ID) } // Mutation returns the EventMutation object of the builder. -func (eu *EventUpdate) Mutation() *EventMutation { - return eu.mutation +func (_u *EventUpdate) Mutation() *EventMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Alert entity. -func (eu *EventUpdate) ClearOwner() *EventUpdate { - eu.mutation.ClearOwner() - return eu +func (_u *EventUpdate) ClearOwner() *EventUpdate { + _u.mutation.ClearOwner() + return _u } // Save executes the query and returns the number of nodes affected by the update operation. -func (eu *EventUpdate) Save(ctx context.Context) (int, error) { - eu.defaults() - return withHooks(ctx, eu.sqlSave, eu.mutation, eu.hooks) +func (_u *EventUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (eu *EventUpdate) SaveX(ctx context.Context) int { - affected, err := eu.Save(ctx) +func (_u *EventUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -101,39 +101,39 @@ func (eu *EventUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (eu *EventUpdate) Exec(ctx context.Context) error { - _, err := eu.Save(ctx) +func (_u *EventUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (eu *EventUpdate) ExecX(ctx context.Context) { - if err := eu.Exec(ctx); err != nil { +func (_u *EventUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (eu *EventUpdate) defaults() { - if _, ok := eu.mutation.UpdatedAt(); !ok { +func (_u *EventUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := event.UpdateDefaultUpdatedAt() - eu.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (eu *EventUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *EventUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(event.Table, event.Columns, sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt)) - if ps := eu.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 := eu.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(event.FieldUpdatedAt, field.TypeTime, value) } - if eu.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -146,7 +146,7 @@ func (eu *EventUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := eu.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -162,7 +162,7 @@ func (eu *EventUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if n, err = sqlgraph.UpdateNodes(ctx, eu.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{event.Label} } else if sqlgraph.IsConstraintError(err) { @@ -170,8 +170,8 @@ func (eu *EventUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - eu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // EventUpdateOne is the builder for updating a single Event entity. @@ -183,83 +183,83 @@ type EventUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (euo *EventUpdateOne) SetUpdatedAt(t time.Time) *EventUpdateOne { - euo.mutation.SetUpdatedAt(t) - return euo +func (_u *EventUpdateOne) SetUpdatedAt(v time.Time) *EventUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetAlertEvents sets the "alert_events" field. -func (euo *EventUpdateOne) SetAlertEvents(i int) *EventUpdateOne { - euo.mutation.SetAlertEvents(i) - return euo +func (_u *EventUpdateOne) SetAlertEvents(v int) *EventUpdateOne { + _u.mutation.SetAlertEvents(v) + return _u } // SetNillableAlertEvents sets the "alert_events" field if the given value is not nil. -func (euo *EventUpdateOne) SetNillableAlertEvents(i *int) *EventUpdateOne { - if i != nil { - euo.SetAlertEvents(*i) +func (_u *EventUpdateOne) SetNillableAlertEvents(v *int) *EventUpdateOne { + if v != nil { + _u.SetAlertEvents(*v) } - return euo + return _u } // ClearAlertEvents clears the value of the "alert_events" field. -func (euo *EventUpdateOne) ClearAlertEvents() *EventUpdateOne { - euo.mutation.ClearAlertEvents() - return euo +func (_u *EventUpdateOne) ClearAlertEvents() *EventUpdateOne { + _u.mutation.ClearAlertEvents() + return _u } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (euo *EventUpdateOne) SetOwnerID(id int) *EventUpdateOne { - euo.mutation.SetOwnerID(id) - return euo +func (_u *EventUpdateOne) SetOwnerID(id int) *EventUpdateOne { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (euo *EventUpdateOne) SetNillableOwnerID(id *int) *EventUpdateOne { +func (_u *EventUpdateOne) SetNillableOwnerID(id *int) *EventUpdateOne { if id != nil { - euo = euo.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return euo + return _u } // SetOwner sets the "owner" edge to the Alert entity. -func (euo *EventUpdateOne) SetOwner(a *Alert) *EventUpdateOne { - return euo.SetOwnerID(a.ID) +func (_u *EventUpdateOne) SetOwner(v *Alert) *EventUpdateOne { + return _u.SetOwnerID(v.ID) } // Mutation returns the EventMutation object of the builder. -func (euo *EventUpdateOne) Mutation() *EventMutation { - return euo.mutation +func (_u *EventUpdateOne) Mutation() *EventMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Alert entity. -func (euo *EventUpdateOne) ClearOwner() *EventUpdateOne { - euo.mutation.ClearOwner() - return euo +func (_u *EventUpdateOne) ClearOwner() *EventUpdateOne { + _u.mutation.ClearOwner() + return _u } // Where appends a list predicates to the EventUpdate builder. -func (euo *EventUpdateOne) Where(ps ...predicate.Event) *EventUpdateOne { - euo.mutation.Where(ps...) - return euo +func (_u *EventUpdateOne) Where(ps ...predicate.Event) *EventUpdateOne { + _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 (euo *EventUpdateOne) Select(field string, fields ...string) *EventUpdateOne { - euo.fields = append([]string{field}, fields...) - return euo +func (_u *EventUpdateOne) Select(field string, fields ...string) *EventUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Event entity. -func (euo *EventUpdateOne) Save(ctx context.Context) (*Event, error) { - euo.defaults() - return withHooks(ctx, euo.sqlSave, euo.mutation, euo.hooks) +func (_u *EventUpdateOne) Save(ctx context.Context) (*Event, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (euo *EventUpdateOne) SaveX(ctx context.Context) *Event { - node, err := euo.Save(ctx) +func (_u *EventUpdateOne) SaveX(ctx context.Context) *Event { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -267,34 +267,34 @@ func (euo *EventUpdateOne) SaveX(ctx context.Context) *Event { } // Exec executes the query on the entity. -func (euo *EventUpdateOne) Exec(ctx context.Context) error { - _, err := euo.Save(ctx) +func (_u *EventUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (euo *EventUpdateOne) ExecX(ctx context.Context) { - if err := euo.Exec(ctx); err != nil { +func (_u *EventUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (euo *EventUpdateOne) defaults() { - if _, ok := euo.mutation.UpdatedAt(); !ok { +func (_u *EventUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := event.UpdateDefaultUpdatedAt() - euo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (euo *EventUpdateOne) sqlSave(ctx context.Context) (_node *Event, err error) { +func (_u *EventUpdateOne) sqlSave(ctx context.Context) (_node *Event, err error) { _spec := sqlgraph.NewUpdateSpec(event.Table, event.Columns, sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt)) - id, ok := euo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Event.id" for update`)} } _spec.Node.ID.Value = id - if fields := euo.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, event.FieldID) for _, f := range fields { @@ -306,17 +306,17 @@ func (euo *EventUpdateOne) sqlSave(ctx context.Context) (_node *Event, err error } } } - if ps := euo.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 := euo.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(event.FieldUpdatedAt, field.TypeTime, value) } - if euo.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -329,7 +329,7 @@ func (euo *EventUpdateOne) sqlSave(ctx context.Context) (_node *Event, err error } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := euo.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -345,10 +345,10 @@ func (euo *EventUpdateOne) sqlSave(ctx context.Context) (_node *Event, err error } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - _node = &Event{config: euo.config} + _node = &Event{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, euo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{event.Label} } else if sqlgraph.IsConstraintError(err) { @@ -356,6 +356,6 @@ func (euo *EventUpdateOne) sqlSave(ctx context.Context) (_node *Event, err error } return nil, err } - euo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/generate.go b/pkg/database/ent/generate.go index 3f9ba6722..44f2a4f7e 100644 --- a/pkg/database/ent/generate.go +++ b/pkg/database/ent/generate.go @@ -1,4 +1,4 @@ package ent -//go:generate go run -mod=mod entgo.io/ent/cmd/ent@v0.14.2 generate ./schema --feature sql/upsert +//go:generate go run -mod=mod entgo.io/ent/cmd/ent@v0.14.6 generate ./schema --feature sql/upsert diff --git a/pkg/database/ent/lock.go b/pkg/database/ent/lock.go index 85556a306..684a6712e 100644 --- a/pkg/database/ent/lock.go +++ b/pkg/database/ent/lock.go @@ -44,7 +44,7 @@ func (*Lock) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Lock fields. -func (l *Lock) assignValues(columns []string, values []any) error { +func (_m *Lock) 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) } @@ -55,21 +55,21 @@ func (l *Lock) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - l.ID = int(value.Int64) + _m.ID = int(value.Int64) case lock.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { - l.Name = value.String + _m.Name = value.String } case lock.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - l.CreatedAt = value.Time + _m.CreatedAt = value.Time } default: - l.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -77,38 +77,38 @@ func (l *Lock) assignValues(columns []string, values []any) error { // Value returns the ent.Value that was dynamically selected and assigned to the Lock. // This includes values selected through modifiers, order, etc. -func (l *Lock) Value(name string) (ent.Value, error) { - return l.selectValues.Get(name) +func (_m *Lock) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // Update returns a builder for updating this Lock. // Note that you need to call Lock.Unwrap() before calling this method if this Lock // was returned from a transaction, and the transaction was committed or rolled back. -func (l *Lock) Update() *LockUpdateOne { - return NewLockClient(l.config).UpdateOne(l) +func (_m *Lock) Update() *LockUpdateOne { + return NewLockClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Lock 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 (l *Lock) Unwrap() *Lock { - _tx, ok := l.config.driver.(*txDriver) +func (_m *Lock) Unwrap() *Lock { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Lock is not a transactional entity") } - l.config.driver = _tx.drv - return l + _m.config.driver = _tx.drv + return _m } // String implements the fmt.Stringer. -func (l *Lock) String() string { +func (_m *Lock) String() string { var builder strings.Builder builder.WriteString("Lock(") - builder.WriteString(fmt.Sprintf("id=%v, ", l.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("name=") - builder.WriteString(l.Name) + builder.WriteString(_m.Name) builder.WriteString(", ") builder.WriteString("created_at=") - builder.WriteString(l.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/lock_create.go b/pkg/database/ent/lock_create.go index 024e4b2d3..15ed43051 100644 --- a/pkg/database/ent/lock_create.go +++ b/pkg/database/ent/lock_create.go @@ -23,39 +23,39 @@ type LockCreate struct { } // SetName sets the "name" field. -func (lc *LockCreate) SetName(s string) *LockCreate { - lc.mutation.SetName(s) - return lc +func (_c *LockCreate) SetName(v string) *LockCreate { + _c.mutation.SetName(v) + return _c } // SetCreatedAt sets the "created_at" field. -func (lc *LockCreate) SetCreatedAt(t time.Time) *LockCreate { - lc.mutation.SetCreatedAt(t) - return lc +func (_c *LockCreate) SetCreatedAt(v time.Time) *LockCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (lc *LockCreate) SetNillableCreatedAt(t *time.Time) *LockCreate { - if t != nil { - lc.SetCreatedAt(*t) +func (_c *LockCreate) SetNillableCreatedAt(v *time.Time) *LockCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return lc + return _c } // Mutation returns the LockMutation object of the builder. -func (lc *LockCreate) Mutation() *LockMutation { - return lc.mutation +func (_c *LockCreate) Mutation() *LockMutation { + return _c.mutation } // Save creates the Lock in the database. -func (lc *LockCreate) Save(ctx context.Context) (*Lock, error) { - lc.defaults() - return withHooks(ctx, lc.sqlSave, lc.mutation, lc.hooks) +func (_c *LockCreate) Save(ctx context.Context) (*Lock, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (lc *LockCreate) SaveX(ctx context.Context) *Lock { - v, err := lc.Save(ctx) +func (_c *LockCreate) SaveX(ctx context.Context) *Lock { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -63,43 +63,43 @@ func (lc *LockCreate) SaveX(ctx context.Context) *Lock { } // Exec executes the query. -func (lc *LockCreate) Exec(ctx context.Context) error { - _, err := lc.Save(ctx) +func (_c *LockCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (lc *LockCreate) ExecX(ctx context.Context) { - if err := lc.Exec(ctx); err != nil { +func (_c *LockCreate) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (lc *LockCreate) defaults() { - if _, ok := lc.mutation.CreatedAt(); !ok { +func (_c *LockCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := lock.DefaultCreatedAt() - lc.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (lc *LockCreate) check() error { - if _, ok := lc.mutation.Name(); !ok { +func (_c *LockCreate) check() error { + if _, ok := _c.mutation.Name(); !ok { return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Lock.name"`)} } - if _, ok := lc.mutation.CreatedAt(); !ok { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Lock.created_at"`)} } return nil } -func (lc *LockCreate) sqlSave(ctx context.Context) (*Lock, error) { - if err := lc.check(); err != nil { +func (_c *LockCreate) sqlSave(ctx context.Context) (*Lock, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := lc.createSpec() - if err := sqlgraph.CreateNode(ctx, lc.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -107,22 +107,22 @@ func (lc *LockCreate) sqlSave(ctx context.Context) (*Lock, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - lc.mutation.id = &_node.ID - lc.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (lc *LockCreate) createSpec() (*Lock, *sqlgraph.CreateSpec) { +func (_c *LockCreate) createSpec() (*Lock, *sqlgraph.CreateSpec) { var ( - _node = &Lock{config: lc.config} + _node = &Lock{config: _c.config} _spec = sqlgraph.NewCreateSpec(lock.Table, sqlgraph.NewFieldSpec(lock.FieldID, field.TypeInt)) ) - _spec.OnConflict = lc.conflict - if value, ok := lc.mutation.Name(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.Name(); ok { _spec.SetField(lock.FieldName, field.TypeString, value) _node.Name = value } - if value, ok := lc.mutation.CreatedAt(); ok { + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(lock.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } @@ -145,10 +145,10 @@ func (lc *LockCreate) createSpec() (*Lock, *sqlgraph.CreateSpec) { // SetName(v+v). // }). // Exec(ctx) -func (lc *LockCreate) OnConflict(opts ...sql.ConflictOption) *LockUpsertOne { - lc.conflict = opts +func (_c *LockCreate) OnConflict(opts ...sql.ConflictOption) *LockUpsertOne { + _c.conflict = opts return &LockUpsertOne{ - create: lc, + create: _c, } } @@ -158,10 +158,10 @@ func (lc *LockCreate) OnConflict(opts ...sql.ConflictOption) *LockUpsertOne { // client.Lock.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (lc *LockCreate) OnConflictColumns(columns ...string) *LockUpsertOne { - lc.conflict = append(lc.conflict, sql.ConflictColumns(columns...)) +func (_c *LockCreate) OnConflictColumns(columns ...string) *LockUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &LockUpsertOne{ - create: lc, + create: _c, } } @@ -268,16 +268,16 @@ type LockCreateBulk struct { } // Save creates the Lock entities in the database. -func (lcb *LockCreateBulk) Save(ctx context.Context) ([]*Lock, error) { - if lcb.err != nil { - return nil, lcb.err +func (_c *LockCreateBulk) Save(ctx context.Context) ([]*Lock, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(lcb.builders)) - nodes := make([]*Lock, len(lcb.builders)) - mutators := make([]Mutator, len(lcb.builders)) - for i := range lcb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Lock, len(_c.builders)) + mutators := make([]Mutator, len(_c.builders)) + for i := range _c.builders { func(i int, root context.Context) { - builder := lcb.builders[i] + builder := _c.builders[i] builder.defaults() var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { mutation, ok := m.(*LockMutation) @@ -291,12 +291,12 @@ func (lcb *LockCreateBulk) Save(ctx context.Context) ([]*Lock, error) { var err error nodes[i], specs[i] = builder.createSpec() if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, lcb.builders[i+1].mutation) + _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) } else { spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = lcb.conflict + spec.OnConflict = _c.conflict // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, lcb.driver, spec); err != nil { + if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -320,7 +320,7 @@ func (lcb *LockCreateBulk) Save(ctx context.Context) ([]*Lock, error) { }(i, ctx) } if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, lcb.builders[0].mutation); err != nil { + if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { return nil, err } } @@ -328,8 +328,8 @@ func (lcb *LockCreateBulk) Save(ctx context.Context) ([]*Lock, error) { } // SaveX is like Save, but panics if an error occurs. -func (lcb *LockCreateBulk) SaveX(ctx context.Context) []*Lock { - v, err := lcb.Save(ctx) +func (_c *LockCreateBulk) SaveX(ctx context.Context) []*Lock { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -337,14 +337,14 @@ func (lcb *LockCreateBulk) SaveX(ctx context.Context) []*Lock { } // Exec executes the query. -func (lcb *LockCreateBulk) Exec(ctx context.Context) error { - _, err := lcb.Save(ctx) +func (_c *LockCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (lcb *LockCreateBulk) ExecX(ctx context.Context) { - if err := lcb.Exec(ctx); err != nil { +func (_c *LockCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -364,10 +364,10 @@ func (lcb *LockCreateBulk) ExecX(ctx context.Context) { // SetName(v+v). // }). // Exec(ctx) -func (lcb *LockCreateBulk) OnConflict(opts ...sql.ConflictOption) *LockUpsertBulk { - lcb.conflict = opts +func (_c *LockCreateBulk) OnConflict(opts ...sql.ConflictOption) *LockUpsertBulk { + _c.conflict = opts return &LockUpsertBulk{ - create: lcb, + create: _c, } } @@ -377,10 +377,10 @@ func (lcb *LockCreateBulk) OnConflict(opts ...sql.ConflictOption) *LockUpsertBul // client.Lock.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (lcb *LockCreateBulk) OnConflictColumns(columns ...string) *LockUpsertBulk { - lcb.conflict = append(lcb.conflict, sql.ConflictColumns(columns...)) +func (_c *LockCreateBulk) OnConflictColumns(columns ...string) *LockUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &LockUpsertBulk{ - create: lcb, + create: _c, } } diff --git a/pkg/database/ent/lock_delete.go b/pkg/database/ent/lock_delete.go index 2275c608f..b618f68c0 100644 --- a/pkg/database/ent/lock_delete.go +++ b/pkg/database/ent/lock_delete.go @@ -20,56 +20,56 @@ type LockDelete struct { } // Where appends a list predicates to the LockDelete builder. -func (ld *LockDelete) Where(ps ...predicate.Lock) *LockDelete { - ld.mutation.Where(ps...) - return ld +func (_d *LockDelete) Where(ps ...predicate.Lock) *LockDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (ld *LockDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, ld.sqlExec, ld.mutation, ld.hooks) +func (_d *LockDelete) 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 (ld *LockDelete) ExecX(ctx context.Context) int { - n, err := ld.Exec(ctx) +func (_d *LockDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (ld *LockDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *LockDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(lock.Table, sqlgraph.NewFieldSpec(lock.FieldID, field.TypeInt)) - if ps := ld.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := sqlgraph.DeleteNodes(ctx, ld.driver, _spec) + affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) if err != nil && sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } - ld.mutation.done = true + _d.mutation.done = true return affected, err } // LockDeleteOne is the builder for deleting a single Lock entity. type LockDeleteOne struct { - ld *LockDelete + _d *LockDelete } // Where appends a list predicates to the LockDelete builder. -func (ldo *LockDeleteOne) Where(ps ...predicate.Lock) *LockDeleteOne { - ldo.ld.mutation.Where(ps...) - return ldo +func (_d *LockDeleteOne) Where(ps ...predicate.Lock) *LockDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (ldo *LockDeleteOne) Exec(ctx context.Context) error { - n, err := ldo.ld.Exec(ctx) +func (_d *LockDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (ldo *LockDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (ldo *LockDeleteOne) ExecX(ctx context.Context) { - if err := ldo.Exec(ctx); err != nil { +func (_d *LockDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/lock_query.go b/pkg/database/ent/lock_query.go index 5bc2c749a..63c9c84ea 100644 --- a/pkg/database/ent/lock_query.go +++ b/pkg/database/ent/lock_query.go @@ -28,40 +28,40 @@ type LockQuery struct { } // Where adds a new predicate for the LockQuery builder. -func (lq *LockQuery) Where(ps ...predicate.Lock) *LockQuery { - lq.predicates = append(lq.predicates, ps...) - return lq +func (_q *LockQuery) Where(ps ...predicate.Lock) *LockQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (lq *LockQuery) Limit(limit int) *LockQuery { - lq.ctx.Limit = &limit - return lq +func (_q *LockQuery) Limit(limit int) *LockQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (lq *LockQuery) Offset(offset int) *LockQuery { - lq.ctx.Offset = &offset - return lq +func (_q *LockQuery) Offset(offset int) *LockQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (lq *LockQuery) Unique(unique bool) *LockQuery { - lq.ctx.Unique = &unique - return lq +func (_q *LockQuery) Unique(unique bool) *LockQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (lq *LockQuery) Order(o ...lock.OrderOption) *LockQuery { - lq.order = append(lq.order, o...) - return lq +func (_q *LockQuery) Order(o ...lock.OrderOption) *LockQuery { + _q.order = append(_q.order, o...) + return _q } // First returns the first Lock entity from the query. // Returns a *NotFoundError when no Lock was found. -func (lq *LockQuery) First(ctx context.Context) (*Lock, error) { - nodes, err := lq.Limit(1).All(setContextOp(ctx, lq.ctx, ent.OpQueryFirst)) +func (_q *LockQuery) First(ctx context.Context) (*Lock, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -72,8 +72,8 @@ func (lq *LockQuery) First(ctx context.Context) (*Lock, error) { } // FirstX is like First, but panics if an error occurs. -func (lq *LockQuery) FirstX(ctx context.Context) *Lock { - node, err := lq.First(ctx) +func (_q *LockQuery) FirstX(ctx context.Context) *Lock { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -82,9 +82,9 @@ func (lq *LockQuery) FirstX(ctx context.Context) *Lock { // FirstID returns the first Lock ID from the query. // Returns a *NotFoundError when no Lock ID was found. -func (lq *LockQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *LockQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = lq.Limit(1).IDs(setContextOp(ctx, lq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -95,8 +95,8 @@ func (lq *LockQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (lq *LockQuery) FirstIDX(ctx context.Context) int { - id, err := lq.FirstID(ctx) +func (_q *LockQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -106,8 +106,8 @@ func (lq *LockQuery) FirstIDX(ctx context.Context) int { // Only returns a single Lock entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Lock entity is found. // Returns a *NotFoundError when no Lock entities are found. -func (lq *LockQuery) Only(ctx context.Context) (*Lock, error) { - nodes, err := lq.Limit(2).All(setContextOp(ctx, lq.ctx, ent.OpQueryOnly)) +func (_q *LockQuery) Only(ctx context.Context) (*Lock, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -122,8 +122,8 @@ func (lq *LockQuery) Only(ctx context.Context) (*Lock, error) { } // OnlyX is like Only, but panics if an error occurs. -func (lq *LockQuery) OnlyX(ctx context.Context) *Lock { - node, err := lq.Only(ctx) +func (_q *LockQuery) OnlyX(ctx context.Context) *Lock { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -133,9 +133,9 @@ func (lq *LockQuery) OnlyX(ctx context.Context) *Lock { // OnlyID is like Only, but returns the only Lock ID in the query. // Returns a *NotSingularError when more than one Lock ID is found. // Returns a *NotFoundError when no entities are found. -func (lq *LockQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *LockQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = lq.Limit(2).IDs(setContextOp(ctx, lq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -150,8 +150,8 @@ func (lq *LockQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (lq *LockQuery) OnlyIDX(ctx context.Context) int { - id, err := lq.OnlyID(ctx) +func (_q *LockQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -159,18 +159,18 @@ func (lq *LockQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of Locks. -func (lq *LockQuery) All(ctx context.Context) ([]*Lock, error) { - ctx = setContextOp(ctx, lq.ctx, ent.OpQueryAll) - if err := lq.prepareQuery(ctx); err != nil { +func (_q *LockQuery) All(ctx context.Context) ([]*Lock, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Lock, *LockQuery]() - return withInterceptors[[]*Lock](ctx, lq, qr, lq.inters) + return withInterceptors[[]*Lock](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (lq *LockQuery) AllX(ctx context.Context) []*Lock { - nodes, err := lq.All(ctx) +func (_q *LockQuery) AllX(ctx context.Context) []*Lock { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -178,20 +178,20 @@ func (lq *LockQuery) AllX(ctx context.Context) []*Lock { } // IDs executes the query and returns a list of Lock IDs. -func (lq *LockQuery) IDs(ctx context.Context) (ids []int, err error) { - if lq.ctx.Unique == nil && lq.path != nil { - lq.Unique(true) +func (_q *LockQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, lq.ctx, ent.OpQueryIDs) - if err = lq.Select(lock.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(lock.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (lq *LockQuery) IDsX(ctx context.Context) []int { - ids, err := lq.IDs(ctx) +func (_q *LockQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -199,17 +199,17 @@ func (lq *LockQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (lq *LockQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, lq.ctx, ent.OpQueryCount) - if err := lq.prepareQuery(ctx); err != nil { +func (_q *LockQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, lq, querierCount[*LockQuery](), lq.inters) + return withInterceptors[int](ctx, _q, querierCount[*LockQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (lq *LockQuery) CountX(ctx context.Context) int { - count, err := lq.Count(ctx) +func (_q *LockQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -217,9 +217,9 @@ func (lq *LockQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (lq *LockQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, lq.ctx, ent.OpQueryExist) - switch _, err := lq.FirstID(ctx); { +func (_q *LockQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -230,8 +230,8 @@ func (lq *LockQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (lq *LockQuery) ExistX(ctx context.Context) bool { - exist, err := lq.Exist(ctx) +func (_q *LockQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -240,19 +240,19 @@ func (lq *LockQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the LockQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (lq *LockQuery) Clone() *LockQuery { - if lq == nil { +func (_q *LockQuery) Clone() *LockQuery { + if _q == nil { return nil } return &LockQuery{ - config: lq.config, - ctx: lq.ctx.Clone(), - order: append([]lock.OrderOption{}, lq.order...), - inters: append([]Interceptor{}, lq.inters...), - predicates: append([]predicate.Lock{}, lq.predicates...), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]lock.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Lock{}, _q.predicates...), // clone intermediate query. - sql: lq.sql.Clone(), - path: lq.path, + sql: _q.sql.Clone(), + path: _q.path, } } @@ -270,10 +270,10 @@ func (lq *LockQuery) Clone() *LockQuery { // GroupBy(lock.FieldName). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (lq *LockQuery) GroupBy(field string, fields ...string) *LockGroupBy { - lq.ctx.Fields = append([]string{field}, fields...) - grbuild := &LockGroupBy{build: lq} - grbuild.flds = &lq.ctx.Fields +func (_q *LockQuery) GroupBy(field string, fields ...string) *LockGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &LockGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = lock.Label grbuild.scan = grbuild.Scan return grbuild @@ -291,62 +291,62 @@ func (lq *LockQuery) GroupBy(field string, fields ...string) *LockGroupBy { // client.Lock.Query(). // Select(lock.FieldName). // Scan(ctx, &v) -func (lq *LockQuery) Select(fields ...string) *LockSelect { - lq.ctx.Fields = append(lq.ctx.Fields, fields...) - sbuild := &LockSelect{LockQuery: lq} +func (_q *LockQuery) Select(fields ...string) *LockSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &LockSelect{LockQuery: _q} sbuild.label = lock.Label - sbuild.flds, sbuild.scan = &lq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a LockSelect configured with the given aggregations. -func (lq *LockQuery) Aggregate(fns ...AggregateFunc) *LockSelect { - return lq.Select().Aggregate(fns...) +func (_q *LockQuery) Aggregate(fns ...AggregateFunc) *LockSelect { + return _q.Select().Aggregate(fns...) } -func (lq *LockQuery) prepareQuery(ctx context.Context) error { - for _, inter := range lq.inters { +func (_q *LockQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, lq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range lq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !lock.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if lq.path != nil { - prev, err := lq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - lq.sql = prev + _q.sql = prev } return nil } -func (lq *LockQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Lock, error) { +func (_q *LockQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Lock, error) { var ( nodes = []*Lock{} - _spec = lq.querySpec() + _spec = _q.querySpec() ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Lock).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Lock{config: lq.config} + node := &Lock{config: _q.config} nodes = append(nodes, node) return node.assignValues(columns, values) } for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, lq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { @@ -355,24 +355,24 @@ func (lq *LockQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Lock, e return nodes, nil } -func (lq *LockQuery) sqlCount(ctx context.Context) (int, error) { - _spec := lq.querySpec() - _spec.Node.Columns = lq.ctx.Fields - if len(lq.ctx.Fields) > 0 { - _spec.Unique = lq.ctx.Unique != nil && *lq.ctx.Unique +func (_q *LockQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, lq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (lq *LockQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *LockQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(lock.Table, lock.Columns, sqlgraph.NewFieldSpec(lock.FieldID, field.TypeInt)) - _spec.From = lq.sql - if unique := lq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if lq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := lq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, lock.FieldID) for i := range fields { @@ -381,20 +381,20 @@ func (lq *LockQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := lq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := lq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := lq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := lq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -404,33 +404,33 @@ func (lq *LockQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (lq *LockQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(lq.driver.Dialect()) +func (_q *LockQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(lock.Table) - columns := lq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = lock.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if lq.sql != nil { - selector = lq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if lq.ctx.Unique != nil && *lq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range lq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range lq.order { + for _, p := range _q.order { p(selector) } - if offset := lq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := lq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -443,41 +443,41 @@ type LockGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (lgb *LockGroupBy) Aggregate(fns ...AggregateFunc) *LockGroupBy { - lgb.fns = append(lgb.fns, fns...) - return lgb +func (_g *LockGroupBy) Aggregate(fns ...AggregateFunc) *LockGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (lgb *LockGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, lgb.build.ctx, ent.OpQueryGroupBy) - if err := lgb.build.prepareQuery(ctx); err != nil { +func (_g *LockGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LockQuery, *LockGroupBy](ctx, lgb.build, lgb, lgb.build.inters, v) + return scanWithInterceptors[*LockQuery, *LockGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (lgb *LockGroupBy) sqlScan(ctx context.Context, root *LockQuery, v any) error { +func (_g *LockGroupBy) sqlScan(ctx context.Context, root *LockQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(lgb.fns)) - for _, fn := range lgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*lgb.flds)+len(lgb.fns)) - for _, f := range *lgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*lgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := lgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type LockSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ls *LockSelect) Aggregate(fns ...AggregateFunc) *LockSelect { - ls.fns = append(ls.fns, fns...) - return ls +func (_s *LockSelect) Aggregate(fns ...AggregateFunc) *LockSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ls *LockSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ls.ctx, ent.OpQuerySelect) - if err := ls.prepareQuery(ctx); err != nil { +func (_s *LockSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LockQuery, *LockSelect](ctx, ls.LockQuery, ls, ls.inters, v) + return scanWithInterceptors[*LockQuery, *LockSelect](ctx, _s.LockQuery, _s, _s.inters, v) } -func (ls *LockSelect) sqlScan(ctx context.Context, root *LockQuery, v any) error { +func (_s *LockSelect) sqlScan(ctx context.Context, root *LockQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ls.fns)) - for _, fn := range ls.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ls.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (ls *LockSelect) sqlScan(ctx context.Context, root *LockQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ls.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/lock_update.go b/pkg/database/ent/lock_update.go index 934e68c07..257189062 100644 --- a/pkg/database/ent/lock_update.go +++ b/pkg/database/ent/lock_update.go @@ -22,24 +22,24 @@ type LockUpdate struct { } // Where appends a list predicates to the LockUpdate builder. -func (lu *LockUpdate) Where(ps ...predicate.Lock) *LockUpdate { - lu.mutation.Where(ps...) - return lu +func (_u *LockUpdate) Where(ps ...predicate.Lock) *LockUpdate { + _u.mutation.Where(ps...) + return _u } // Mutation returns the LockMutation object of the builder. -func (lu *LockUpdate) Mutation() *LockMutation { - return lu.mutation +func (_u *LockUpdate) Mutation() *LockMutation { + return _u.mutation } // Save executes the query and returns the number of nodes affected by the update operation. -func (lu *LockUpdate) Save(ctx context.Context) (int, error) { - return withHooks(ctx, lu.sqlSave, lu.mutation, lu.hooks) +func (_u *LockUpdate) 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 (lu *LockUpdate) SaveX(ctx context.Context) int { - affected, err := lu.Save(ctx) +func (_u *LockUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -47,28 +47,28 @@ func (lu *LockUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (lu *LockUpdate) Exec(ctx context.Context) error { - _, err := lu.Save(ctx) +func (_u *LockUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (lu *LockUpdate) ExecX(ctx context.Context) { - if err := lu.Exec(ctx); err != nil { +func (_u *LockUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } -func (lu *LockUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *LockUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(lock.Table, lock.Columns, sqlgraph.NewFieldSpec(lock.FieldID, field.TypeInt)) - if ps := lu.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 n, err = sqlgraph.UpdateNodes(ctx, lu.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{lock.Label} } else if sqlgraph.IsConstraintError(err) { @@ -76,8 +76,8 @@ func (lu *LockUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - lu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // LockUpdateOne is the builder for updating a single Lock entity. @@ -89,31 +89,31 @@ type LockUpdateOne struct { } // Mutation returns the LockMutation object of the builder. -func (luo *LockUpdateOne) Mutation() *LockMutation { - return luo.mutation +func (_u *LockUpdateOne) Mutation() *LockMutation { + return _u.mutation } // Where appends a list predicates to the LockUpdate builder. -func (luo *LockUpdateOne) Where(ps ...predicate.Lock) *LockUpdateOne { - luo.mutation.Where(ps...) - return luo +func (_u *LockUpdateOne) Where(ps ...predicate.Lock) *LockUpdateOne { + _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 (luo *LockUpdateOne) Select(field string, fields ...string) *LockUpdateOne { - luo.fields = append([]string{field}, fields...) - return luo +func (_u *LockUpdateOne) Select(field string, fields ...string) *LockUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Lock entity. -func (luo *LockUpdateOne) Save(ctx context.Context) (*Lock, error) { - return withHooks(ctx, luo.sqlSave, luo.mutation, luo.hooks) +func (_u *LockUpdateOne) Save(ctx context.Context) (*Lock, error) { + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (luo *LockUpdateOne) SaveX(ctx context.Context) *Lock { - node, err := luo.Save(ctx) +func (_u *LockUpdateOne) SaveX(ctx context.Context) *Lock { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -121,26 +121,26 @@ func (luo *LockUpdateOne) SaveX(ctx context.Context) *Lock { } // Exec executes the query on the entity. -func (luo *LockUpdateOne) Exec(ctx context.Context) error { - _, err := luo.Save(ctx) +func (_u *LockUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (luo *LockUpdateOne) ExecX(ctx context.Context) { - if err := luo.Exec(ctx); err != nil { +func (_u *LockUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } -func (luo *LockUpdateOne) sqlSave(ctx context.Context) (_node *Lock, err error) { +func (_u *LockUpdateOne) sqlSave(ctx context.Context) (_node *Lock, err error) { _spec := sqlgraph.NewUpdateSpec(lock.Table, lock.Columns, sqlgraph.NewFieldSpec(lock.FieldID, field.TypeInt)) - id, ok := luo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Lock.id" for update`)} } _spec.Node.ID.Value = id - if fields := luo.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, lock.FieldID) for _, f := range fields { @@ -152,17 +152,17 @@ func (luo *LockUpdateOne) sqlSave(ctx context.Context) (_node *Lock, err error) } } } - if ps := luo.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) } } } - _node = &Lock{config: luo.config} + _node = &Lock{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, luo.driver, _spec); err != nil { + if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{lock.Label} } else if sqlgraph.IsConstraintError(err) { @@ -170,6 +170,6 @@ func (luo *LockUpdateOne) sqlSave(ctx context.Context) (_node *Lock, err error) } return nil, err } - luo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/machine.go b/pkg/database/ent/machine.go index 07c1ef70d..241b0bf7e 100644 --- a/pkg/database/ent/machine.go +++ b/pkg/database/ent/machine.go @@ -101,7 +101,7 @@ func (*Machine) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Machine fields. -func (m *Machine) assignValues(columns []string, values []any) error { +func (_m *Machine) 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) } @@ -112,104 +112,104 @@ func (m *Machine) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - m.ID = int(value.Int64) + _m.ID = int(value.Int64) case machine.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - m.CreatedAt = value.Time + _m.CreatedAt = value.Time } case machine.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - m.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case machine.FieldLastPush: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field last_push", values[i]) } else if value.Valid { - m.LastPush = new(time.Time) - *m.LastPush = value.Time + _m.LastPush = new(time.Time) + *_m.LastPush = value.Time } case machine.FieldLastHeartbeat: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field last_heartbeat", values[i]) } else if value.Valid { - m.LastHeartbeat = new(time.Time) - *m.LastHeartbeat = value.Time + _m.LastHeartbeat = new(time.Time) + *_m.LastHeartbeat = value.Time } case machine.FieldMachineId: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field machineId", values[i]) } else if value.Valid { - m.MachineId = value.String + _m.MachineId = value.String } case machine.FieldPassword: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field password", values[i]) } else if value.Valid { - m.Password = value.String + _m.Password = value.String } case machine.FieldIpAddress: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field ipAddress", values[i]) } else if value.Valid { - m.IpAddress = value.String + _m.IpAddress = value.String } case machine.FieldScenarios: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field scenarios", values[i]) } else if value.Valid { - m.Scenarios = value.String + _m.Scenarios = value.String } case machine.FieldVersion: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field version", values[i]) } else if value.Valid { - m.Version = value.String + _m.Version = value.String } case machine.FieldIsValidated: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field isValidated", values[i]) } else if value.Valid { - m.IsValidated = value.Bool + _m.IsValidated = value.Bool } case machine.FieldAuthType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field auth_type", values[i]) } else if value.Valid { - m.AuthType = value.String + _m.AuthType = value.String } case machine.FieldOsname: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field osname", values[i]) } else if value.Valid { - m.Osname = value.String + _m.Osname = value.String } case machine.FieldOsfamily: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field osfamily", values[i]) } else if value.Valid { - m.Osfamily = value.String + _m.Osfamily = value.String } case machine.FieldOsversion: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field osversion", values[i]) } else if value.Valid { - m.Osversion = value.String + _m.Osversion = value.String } case machine.FieldFeatureflags: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field featureflags", values[i]) } else if value.Valid { - m.Featureflags = value.String + _m.Featureflags = value.String } case machine.FieldHubstate: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field hubstate", values[i]) } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &m.Hubstate); err != nil { + if err := json.Unmarshal(*value, &_m.Hubstate); err != nil { return fmt.Errorf("unmarshal field hubstate: %w", err) } } @@ -217,12 +217,12 @@ func (m *Machine) assignValues(columns []string, values []any) error { if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field datasources", values[i]) } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &m.Datasources); err != nil { + if err := json.Unmarshal(*value, &_m.Datasources); err != nil { return fmt.Errorf("unmarshal field datasources: %w", err) } } default: - m.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -230,91 +230,91 @@ func (m *Machine) assignValues(columns []string, values []any) error { // Value returns the ent.Value that was dynamically selected and assigned to the Machine. // This includes values selected through modifiers, order, etc. -func (m *Machine) Value(name string) (ent.Value, error) { - return m.selectValues.Get(name) +func (_m *Machine) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // QueryAlerts queries the "alerts" edge of the Machine entity. -func (m *Machine) QueryAlerts() *AlertQuery { - return NewMachineClient(m.config).QueryAlerts(m) +func (_m *Machine) QueryAlerts() *AlertQuery { + return NewMachineClient(_m.config).QueryAlerts(_m) } // Update returns a builder for updating this Machine. // Note that you need to call Machine.Unwrap() before calling this method if this Machine // was returned from a transaction, and the transaction was committed or rolled back. -func (m *Machine) Update() *MachineUpdateOne { - return NewMachineClient(m.config).UpdateOne(m) +func (_m *Machine) Update() *MachineUpdateOne { + return NewMachineClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Machine 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 *Machine) Unwrap() *Machine { - _tx, ok := m.config.driver.(*txDriver) +func (_m *Machine) Unwrap() *Machine { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Machine 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 *Machine) String() string { +func (_m *Machine) String() string { var builder strings.Builder builder.WriteString("Machine(") - builder.WriteString(fmt.Sprintf("id=%v, ", m.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(m.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(m.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") - if v := m.LastPush; v != nil { + if v := _m.LastPush; v != nil { builder.WriteString("last_push=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") - if v := m.LastHeartbeat; v != nil { + if v := _m.LastHeartbeat; v != nil { builder.WriteString("last_heartbeat=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("machineId=") - builder.WriteString(m.MachineId) + builder.WriteString(_m.MachineId) builder.WriteString(", ") builder.WriteString("password=") builder.WriteString(", ") builder.WriteString("ipAddress=") - builder.WriteString(m.IpAddress) + builder.WriteString(_m.IpAddress) builder.WriteString(", ") builder.WriteString("scenarios=") - builder.WriteString(m.Scenarios) + builder.WriteString(_m.Scenarios) builder.WriteString(", ") builder.WriteString("version=") - builder.WriteString(m.Version) + builder.WriteString(_m.Version) builder.WriteString(", ") builder.WriteString("isValidated=") - builder.WriteString(fmt.Sprintf("%v", m.IsValidated)) + builder.WriteString(fmt.Sprintf("%v", _m.IsValidated)) builder.WriteString(", ") builder.WriteString("auth_type=") - builder.WriteString(m.AuthType) + builder.WriteString(_m.AuthType) builder.WriteString(", ") builder.WriteString("osname=") - builder.WriteString(m.Osname) + builder.WriteString(_m.Osname) builder.WriteString(", ") builder.WriteString("osfamily=") - builder.WriteString(m.Osfamily) + builder.WriteString(_m.Osfamily) builder.WriteString(", ") builder.WriteString("osversion=") - builder.WriteString(m.Osversion) + builder.WriteString(_m.Osversion) builder.WriteString(", ") builder.WriteString("featureflags=") - builder.WriteString(m.Featureflags) + builder.WriteString(_m.Featureflags) builder.WriteString(", ") builder.WriteString("hubstate=") - builder.WriteString(fmt.Sprintf("%v", m.Hubstate)) + builder.WriteString(fmt.Sprintf("%v", _m.Hubstate)) builder.WriteString(", ") builder.WriteString("datasources=") - builder.WriteString(fmt.Sprintf("%v", m.Datasources)) + builder.WriteString(fmt.Sprintf("%v", _m.Datasources)) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/machine_create.go b/pkg/database/ent/machine_create.go index 6064254fa..8d42b4adb 100644 --- a/pkg/database/ent/machine_create.go +++ b/pkg/database/ent/machine_create.go @@ -25,232 +25,232 @@ type MachineCreate struct { } // SetCreatedAt sets the "created_at" field. -func (mc *MachineCreate) SetCreatedAt(t time.Time) *MachineCreate { - mc.mutation.SetCreatedAt(t) - return mc +func (_c *MachineCreate) SetCreatedAt(v time.Time) *MachineCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (mc *MachineCreate) SetNillableCreatedAt(t *time.Time) *MachineCreate { - if t != nil { - mc.SetCreatedAt(*t) +func (_c *MachineCreate) SetNillableCreatedAt(v *time.Time) *MachineCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return mc + return _c } // SetUpdatedAt sets the "updated_at" field. -func (mc *MachineCreate) SetUpdatedAt(t time.Time) *MachineCreate { - mc.mutation.SetUpdatedAt(t) - return mc +func (_c *MachineCreate) SetUpdatedAt(v time.Time) *MachineCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (mc *MachineCreate) SetNillableUpdatedAt(t *time.Time) *MachineCreate { - if t != nil { - mc.SetUpdatedAt(*t) +func (_c *MachineCreate) SetNillableUpdatedAt(v *time.Time) *MachineCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return mc + return _c } // SetLastPush sets the "last_push" field. -func (mc *MachineCreate) SetLastPush(t time.Time) *MachineCreate { - mc.mutation.SetLastPush(t) - return mc +func (_c *MachineCreate) SetLastPush(v time.Time) *MachineCreate { + _c.mutation.SetLastPush(v) + return _c } // SetNillableLastPush sets the "last_push" field if the given value is not nil. -func (mc *MachineCreate) SetNillableLastPush(t *time.Time) *MachineCreate { - if t != nil { - mc.SetLastPush(*t) +func (_c *MachineCreate) SetNillableLastPush(v *time.Time) *MachineCreate { + if v != nil { + _c.SetLastPush(*v) } - return mc + return _c } // SetLastHeartbeat sets the "last_heartbeat" field. -func (mc *MachineCreate) SetLastHeartbeat(t time.Time) *MachineCreate { - mc.mutation.SetLastHeartbeat(t) - return mc +func (_c *MachineCreate) SetLastHeartbeat(v time.Time) *MachineCreate { + _c.mutation.SetLastHeartbeat(v) + return _c } // SetNillableLastHeartbeat sets the "last_heartbeat" field if the given value is not nil. -func (mc *MachineCreate) SetNillableLastHeartbeat(t *time.Time) *MachineCreate { - if t != nil { - mc.SetLastHeartbeat(*t) +func (_c *MachineCreate) SetNillableLastHeartbeat(v *time.Time) *MachineCreate { + if v != nil { + _c.SetLastHeartbeat(*v) } - return mc + return _c } // SetMachineId sets the "machineId" field. -func (mc *MachineCreate) SetMachineId(s string) *MachineCreate { - mc.mutation.SetMachineId(s) - return mc +func (_c *MachineCreate) SetMachineId(v string) *MachineCreate { + _c.mutation.SetMachineId(v) + return _c } // SetPassword sets the "password" field. -func (mc *MachineCreate) SetPassword(s string) *MachineCreate { - mc.mutation.SetPassword(s) - return mc +func (_c *MachineCreate) SetPassword(v string) *MachineCreate { + _c.mutation.SetPassword(v) + return _c } // SetIpAddress sets the "ipAddress" field. -func (mc *MachineCreate) SetIpAddress(s string) *MachineCreate { - mc.mutation.SetIpAddress(s) - return mc +func (_c *MachineCreate) SetIpAddress(v string) *MachineCreate { + _c.mutation.SetIpAddress(v) + return _c } // SetScenarios sets the "scenarios" field. -func (mc *MachineCreate) SetScenarios(s string) *MachineCreate { - mc.mutation.SetScenarios(s) - return mc +func (_c *MachineCreate) SetScenarios(v string) *MachineCreate { + _c.mutation.SetScenarios(v) + return _c } // SetNillableScenarios sets the "scenarios" field if the given value is not nil. -func (mc *MachineCreate) SetNillableScenarios(s *string) *MachineCreate { - if s != nil { - mc.SetScenarios(*s) +func (_c *MachineCreate) SetNillableScenarios(v *string) *MachineCreate { + if v != nil { + _c.SetScenarios(*v) } - return mc + return _c } // SetVersion sets the "version" field. -func (mc *MachineCreate) SetVersion(s string) *MachineCreate { - mc.mutation.SetVersion(s) - return mc +func (_c *MachineCreate) SetVersion(v string) *MachineCreate { + _c.mutation.SetVersion(v) + return _c } // SetNillableVersion sets the "version" field if the given value is not nil. -func (mc *MachineCreate) SetNillableVersion(s *string) *MachineCreate { - if s != nil { - mc.SetVersion(*s) +func (_c *MachineCreate) SetNillableVersion(v *string) *MachineCreate { + if v != nil { + _c.SetVersion(*v) } - return mc + return _c } // SetIsValidated sets the "isValidated" field. -func (mc *MachineCreate) SetIsValidated(b bool) *MachineCreate { - mc.mutation.SetIsValidated(b) - return mc +func (_c *MachineCreate) SetIsValidated(v bool) *MachineCreate { + _c.mutation.SetIsValidated(v) + return _c } // SetNillableIsValidated sets the "isValidated" field if the given value is not nil. -func (mc *MachineCreate) SetNillableIsValidated(b *bool) *MachineCreate { - if b != nil { - mc.SetIsValidated(*b) +func (_c *MachineCreate) SetNillableIsValidated(v *bool) *MachineCreate { + if v != nil { + _c.SetIsValidated(*v) } - return mc + return _c } // SetAuthType sets the "auth_type" field. -func (mc *MachineCreate) SetAuthType(s string) *MachineCreate { - mc.mutation.SetAuthType(s) - return mc +func (_c *MachineCreate) SetAuthType(v string) *MachineCreate { + _c.mutation.SetAuthType(v) + return _c } // SetNillableAuthType sets the "auth_type" field if the given value is not nil. -func (mc *MachineCreate) SetNillableAuthType(s *string) *MachineCreate { - if s != nil { - mc.SetAuthType(*s) +func (_c *MachineCreate) SetNillableAuthType(v *string) *MachineCreate { + if v != nil { + _c.SetAuthType(*v) } - return mc + return _c } // SetOsname sets the "osname" field. -func (mc *MachineCreate) SetOsname(s string) *MachineCreate { - mc.mutation.SetOsname(s) - return mc +func (_c *MachineCreate) SetOsname(v string) *MachineCreate { + _c.mutation.SetOsname(v) + return _c } // SetNillableOsname sets the "osname" field if the given value is not nil. -func (mc *MachineCreate) SetNillableOsname(s *string) *MachineCreate { - if s != nil { - mc.SetOsname(*s) +func (_c *MachineCreate) SetNillableOsname(v *string) *MachineCreate { + if v != nil { + _c.SetOsname(*v) } - return mc + return _c } // SetOsfamily sets the "osfamily" field. -func (mc *MachineCreate) SetOsfamily(s string) *MachineCreate { - mc.mutation.SetOsfamily(s) - return mc +func (_c *MachineCreate) SetOsfamily(v string) *MachineCreate { + _c.mutation.SetOsfamily(v) + return _c } // SetNillableOsfamily sets the "osfamily" field if the given value is not nil. -func (mc *MachineCreate) SetNillableOsfamily(s *string) *MachineCreate { - if s != nil { - mc.SetOsfamily(*s) +func (_c *MachineCreate) SetNillableOsfamily(v *string) *MachineCreate { + if v != nil { + _c.SetOsfamily(*v) } - return mc + return _c } // SetOsversion sets the "osversion" field. -func (mc *MachineCreate) SetOsversion(s string) *MachineCreate { - mc.mutation.SetOsversion(s) - return mc +func (_c *MachineCreate) SetOsversion(v string) *MachineCreate { + _c.mutation.SetOsversion(v) + return _c } // SetNillableOsversion sets the "osversion" field if the given value is not nil. -func (mc *MachineCreate) SetNillableOsversion(s *string) *MachineCreate { - if s != nil { - mc.SetOsversion(*s) +func (_c *MachineCreate) SetNillableOsversion(v *string) *MachineCreate { + if v != nil { + _c.SetOsversion(*v) } - return mc + return _c } // SetFeatureflags sets the "featureflags" field. -func (mc *MachineCreate) SetFeatureflags(s string) *MachineCreate { - mc.mutation.SetFeatureflags(s) - return mc +func (_c *MachineCreate) SetFeatureflags(v string) *MachineCreate { + _c.mutation.SetFeatureflags(v) + return _c } // SetNillableFeatureflags sets the "featureflags" field if the given value is not nil. -func (mc *MachineCreate) SetNillableFeatureflags(s *string) *MachineCreate { - if s != nil { - mc.SetFeatureflags(*s) +func (_c *MachineCreate) SetNillableFeatureflags(v *string) *MachineCreate { + if v != nil { + _c.SetFeatureflags(*v) } - return mc + return _c } // SetHubstate sets the "hubstate" field. -func (mc *MachineCreate) SetHubstate(ms map[string][]schema.ItemState) *MachineCreate { - mc.mutation.SetHubstate(ms) - return mc +func (_c *MachineCreate) SetHubstate(v map[string][]schema.ItemState) *MachineCreate { + _c.mutation.SetHubstate(v) + return _c } // SetDatasources sets the "datasources" field. -func (mc *MachineCreate) SetDatasources(m map[string]int64) *MachineCreate { - mc.mutation.SetDatasources(m) - return mc +func (_c *MachineCreate) SetDatasources(v map[string]int64) *MachineCreate { + _c.mutation.SetDatasources(v) + return _c } // AddAlertIDs adds the "alerts" edge to the Alert entity by IDs. -func (mc *MachineCreate) AddAlertIDs(ids ...int) *MachineCreate { - mc.mutation.AddAlertIDs(ids...) - return mc +func (_c *MachineCreate) AddAlertIDs(ids ...int) *MachineCreate { + _c.mutation.AddAlertIDs(ids...) + return _c } // AddAlerts adds the "alerts" edges to the Alert entity. -func (mc *MachineCreate) AddAlerts(a ...*Alert) *MachineCreate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_c *MachineCreate) AddAlerts(v ...*Alert) *MachineCreate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return mc.AddAlertIDs(ids...) + return _c.AddAlertIDs(ids...) } // Mutation returns the MachineMutation object of the builder. -func (mc *MachineCreate) Mutation() *MachineMutation { - return mc.mutation +func (_c *MachineCreate) Mutation() *MachineMutation { + return _c.mutation } // Save creates the Machine in the database. -func (mc *MachineCreate) Save(ctx context.Context) (*Machine, error) { - mc.defaults() - return withHooks(ctx, mc.sqlSave, mc.mutation, mc.hooks) +func (_c *MachineCreate) Save(ctx context.Context) (*Machine, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (mc *MachineCreate) SaveX(ctx context.Context) *Machine { - v, err := mc.Save(ctx) +func (_c *MachineCreate) SaveX(ctx context.Context) *Machine { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -258,79 +258,79 @@ func (mc *MachineCreate) SaveX(ctx context.Context) *Machine { } // Exec executes the query. -func (mc *MachineCreate) Exec(ctx context.Context) error { - _, err := mc.Save(ctx) +func (_c *MachineCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mc *MachineCreate) ExecX(ctx context.Context) { - if err := mc.Exec(ctx); err != nil { +func (_c *MachineCreate) 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 *MachineCreate) defaults() { - if _, ok := mc.mutation.CreatedAt(); !ok { +func (_c *MachineCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := machine.DefaultCreatedAt() - mc.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := mc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := machine.DefaultUpdatedAt() - mc.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } - if _, ok := mc.mutation.LastPush(); !ok { + if _, ok := _c.mutation.LastPush(); !ok { v := machine.DefaultLastPush() - mc.mutation.SetLastPush(v) + _c.mutation.SetLastPush(v) } - if _, ok := mc.mutation.IsValidated(); !ok { + if _, ok := _c.mutation.IsValidated(); !ok { v := machine.DefaultIsValidated - mc.mutation.SetIsValidated(v) + _c.mutation.SetIsValidated(v) } - if _, ok := mc.mutation.AuthType(); !ok { + if _, ok := _c.mutation.AuthType(); !ok { v := machine.DefaultAuthType - mc.mutation.SetAuthType(v) + _c.mutation.SetAuthType(v) } } // check runs all checks and user-defined validators on the builder. -func (mc *MachineCreate) check() error { - if _, ok := mc.mutation.CreatedAt(); !ok { +func (_c *MachineCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Machine.created_at"`)} } - if _, ok := mc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Machine.updated_at"`)} } - if _, ok := mc.mutation.MachineId(); !ok { + if _, ok := _c.mutation.MachineId(); !ok { return &ValidationError{Name: "machineId", err: errors.New(`ent: missing required field "Machine.machineId"`)} } - if _, ok := mc.mutation.Password(); !ok { + if _, ok := _c.mutation.Password(); !ok { return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "Machine.password"`)} } - if _, ok := mc.mutation.IpAddress(); !ok { + if _, ok := _c.mutation.IpAddress(); !ok { return &ValidationError{Name: "ipAddress", err: errors.New(`ent: missing required field "Machine.ipAddress"`)} } - if v, ok := mc.mutation.Scenarios(); ok { + if v, ok := _c.mutation.Scenarios(); ok { if err := machine.ScenariosValidator(v); err != nil { return &ValidationError{Name: "scenarios", err: fmt.Errorf(`ent: validator failed for field "Machine.scenarios": %w`, err)} } } - if _, ok := mc.mutation.IsValidated(); !ok { + if _, ok := _c.mutation.IsValidated(); !ok { return &ValidationError{Name: "isValidated", err: errors.New(`ent: missing required field "Machine.isValidated"`)} } - if _, ok := mc.mutation.AuthType(); !ok { + if _, ok := _c.mutation.AuthType(); !ok { return &ValidationError{Name: "auth_type", err: errors.New(`ent: missing required field "Machine.auth_type"`)} } return nil } -func (mc *MachineCreate) sqlSave(ctx context.Context) (*Machine, error) { - if err := mc.check(); err != nil { +func (_c *MachineCreate) sqlSave(ctx context.Context) (*Machine, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := mc.createSpec() - if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -338,86 +338,86 @@ func (mc *MachineCreate) sqlSave(ctx context.Context) (*Machine, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - mc.mutation.id = &_node.ID - mc.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (mc *MachineCreate) createSpec() (*Machine, *sqlgraph.CreateSpec) { +func (_c *MachineCreate) createSpec() (*Machine, *sqlgraph.CreateSpec) { var ( - _node = &Machine{config: mc.config} + _node = &Machine{config: _c.config} _spec = sqlgraph.NewCreateSpec(machine.Table, sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt)) ) - _spec.OnConflict = mc.conflict - if value, ok := mc.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(machine.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := mc.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(machine.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := mc.mutation.LastPush(); ok { + if value, ok := _c.mutation.LastPush(); ok { _spec.SetField(machine.FieldLastPush, field.TypeTime, value) _node.LastPush = &value } - if value, ok := mc.mutation.LastHeartbeat(); ok { + if value, ok := _c.mutation.LastHeartbeat(); ok { _spec.SetField(machine.FieldLastHeartbeat, field.TypeTime, value) _node.LastHeartbeat = &value } - if value, ok := mc.mutation.MachineId(); ok { + if value, ok := _c.mutation.MachineId(); ok { _spec.SetField(machine.FieldMachineId, field.TypeString, value) _node.MachineId = value } - if value, ok := mc.mutation.Password(); ok { + if value, ok := _c.mutation.Password(); ok { _spec.SetField(machine.FieldPassword, field.TypeString, value) _node.Password = value } - if value, ok := mc.mutation.IpAddress(); ok { + if value, ok := _c.mutation.IpAddress(); ok { _spec.SetField(machine.FieldIpAddress, field.TypeString, value) _node.IpAddress = value } - if value, ok := mc.mutation.Scenarios(); ok { + if value, ok := _c.mutation.Scenarios(); ok { _spec.SetField(machine.FieldScenarios, field.TypeString, value) _node.Scenarios = value } - if value, ok := mc.mutation.Version(); ok { + if value, ok := _c.mutation.Version(); ok { _spec.SetField(machine.FieldVersion, field.TypeString, value) _node.Version = value } - if value, ok := mc.mutation.IsValidated(); ok { + if value, ok := _c.mutation.IsValidated(); ok { _spec.SetField(machine.FieldIsValidated, field.TypeBool, value) _node.IsValidated = value } - if value, ok := mc.mutation.AuthType(); ok { + if value, ok := _c.mutation.AuthType(); ok { _spec.SetField(machine.FieldAuthType, field.TypeString, value) _node.AuthType = value } - if value, ok := mc.mutation.Osname(); ok { + if value, ok := _c.mutation.Osname(); ok { _spec.SetField(machine.FieldOsname, field.TypeString, value) _node.Osname = value } - if value, ok := mc.mutation.Osfamily(); ok { + if value, ok := _c.mutation.Osfamily(); ok { _spec.SetField(machine.FieldOsfamily, field.TypeString, value) _node.Osfamily = value } - if value, ok := mc.mutation.Osversion(); ok { + if value, ok := _c.mutation.Osversion(); ok { _spec.SetField(machine.FieldOsversion, field.TypeString, value) _node.Osversion = value } - if value, ok := mc.mutation.Featureflags(); ok { + if value, ok := _c.mutation.Featureflags(); ok { _spec.SetField(machine.FieldFeatureflags, field.TypeString, value) _node.Featureflags = value } - if value, ok := mc.mutation.Hubstate(); ok { + if value, ok := _c.mutation.Hubstate(); ok { _spec.SetField(machine.FieldHubstate, field.TypeJSON, value) _node.Hubstate = value } - if value, ok := mc.mutation.Datasources(); ok { + if value, ok := _c.mutation.Datasources(); ok { _spec.SetField(machine.FieldDatasources, field.TypeJSON, value) _node.Datasources = value } - if nodes := mc.mutation.AlertsIDs(); len(nodes) > 0 { + if nodes := _c.mutation.AlertsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -452,10 +452,10 @@ func (mc *MachineCreate) createSpec() (*Machine, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (mc *MachineCreate) OnConflict(opts ...sql.ConflictOption) *MachineUpsertOne { - mc.conflict = opts +func (_c *MachineCreate) OnConflict(opts ...sql.ConflictOption) *MachineUpsertOne { + _c.conflict = opts return &MachineUpsertOne{ - create: mc, + create: _c, } } @@ -465,10 +465,10 @@ func (mc *MachineCreate) OnConflict(opts ...sql.ConflictOption) *MachineUpsertOn // client.Machine.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (mc *MachineCreate) OnConflictColumns(columns ...string) *MachineUpsertOne { - mc.conflict = append(mc.conflict, sql.ConflictColumns(columns...)) +func (_c *MachineCreate) OnConflictColumns(columns ...string) *MachineUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &MachineUpsertOne{ - create: mc, + create: _c, } } @@ -1095,16 +1095,16 @@ type MachineCreateBulk struct { } // Save creates the Machine entities in the database. -func (mcb *MachineCreateBulk) Save(ctx context.Context) ([]*Machine, error) { - if mcb.err != nil { - return nil, mcb.err +func (_c *MachineCreateBulk) Save(ctx context.Context) ([]*Machine, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(mcb.builders)) - nodes := make([]*Machine, len(mcb.builders)) - mutators := make([]Mutator, len(mcb.builders)) - for i := range mcb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Machine, 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.(*MachineMutation) @@ -1118,12 +1118,12 @@ func (mcb *MachineCreateBulk) Save(ctx context.Context) ([]*Machine, error) { 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} - spec.OnConflict = mcb.conflict + spec.OnConflict = _c.conflict // 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{msg: err.Error(), wrap: err} } @@ -1147,7 +1147,7 @@ func (mcb *MachineCreateBulk) Save(ctx context.Context) ([]*Machine, 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 } } @@ -1155,8 +1155,8 @@ func (mcb *MachineCreateBulk) Save(ctx context.Context) ([]*Machine, error) { } // SaveX is like Save, but panics if an error occurs. -func (mcb *MachineCreateBulk) SaveX(ctx context.Context) []*Machine { - v, err := mcb.Save(ctx) +func (_c *MachineCreateBulk) SaveX(ctx context.Context) []*Machine { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -1164,14 +1164,14 @@ func (mcb *MachineCreateBulk) SaveX(ctx context.Context) []*Machine { } // Exec executes the query. -func (mcb *MachineCreateBulk) Exec(ctx context.Context) error { - _, err := mcb.Save(ctx) +func (_c *MachineCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mcb *MachineCreateBulk) ExecX(ctx context.Context) { - if err := mcb.Exec(ctx); err != nil { +func (_c *MachineCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -1191,10 +1191,10 @@ func (mcb *MachineCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (mcb *MachineCreateBulk) OnConflict(opts ...sql.ConflictOption) *MachineUpsertBulk { - mcb.conflict = opts +func (_c *MachineCreateBulk) OnConflict(opts ...sql.ConflictOption) *MachineUpsertBulk { + _c.conflict = opts return &MachineUpsertBulk{ - create: mcb, + create: _c, } } @@ -1204,10 +1204,10 @@ func (mcb *MachineCreateBulk) OnConflict(opts ...sql.ConflictOption) *MachineUps // client.Machine.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (mcb *MachineCreateBulk) OnConflictColumns(columns ...string) *MachineUpsertBulk { - mcb.conflict = append(mcb.conflict, sql.ConflictColumns(columns...)) +func (_c *MachineCreateBulk) OnConflictColumns(columns ...string) *MachineUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &MachineUpsertBulk{ - create: mcb, + create: _c, } } diff --git a/pkg/database/ent/machine_delete.go b/pkg/database/ent/machine_delete.go index ac3aa751d..5aeb9a413 100644 --- a/pkg/database/ent/machine_delete.go +++ b/pkg/database/ent/machine_delete.go @@ -20,56 +20,56 @@ type MachineDelete struct { } // Where appends a list predicates to the MachineDelete builder. -func (md *MachineDelete) Where(ps ...predicate.Machine) *MachineDelete { - md.mutation.Where(ps...) - return md +func (_d *MachineDelete) Where(ps ...predicate.Machine) *MachineDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (md *MachineDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, md.sqlExec, md.mutation, md.hooks) +func (_d *MachineDelete) 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 *MachineDelete) ExecX(ctx context.Context) int { - n, err := md.Exec(ctx) +func (_d *MachineDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (md *MachineDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *MachineDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(machine.Table, sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt)) - if ps := md.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := 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} } - md.mutation.done = true + _d.mutation.done = true return affected, err } // MachineDeleteOne is the builder for deleting a single Machine entity. type MachineDeleteOne struct { - md *MachineDelete + _d *MachineDelete } // Where appends a list predicates to the MachineDelete builder. -func (mdo *MachineDeleteOne) Where(ps ...predicate.Machine) *MachineDeleteOne { - mdo.md.mutation.Where(ps...) - return mdo +func (_d *MachineDeleteOne) Where(ps ...predicate.Machine) *MachineDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (mdo *MachineDeleteOne) Exec(ctx context.Context) error { - n, err := mdo.md.Exec(ctx) +func (_d *MachineDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (mdo *MachineDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (mdo *MachineDeleteOne) ExecX(ctx context.Context) { - if err := mdo.Exec(ctx); err != nil { +func (_d *MachineDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/machine_query.go b/pkg/database/ent/machine_query.go index 4367dc396..9dc3f16ff 100644 --- a/pkg/database/ent/machine_query.go +++ b/pkg/database/ent/machine_query.go @@ -31,44 +31,44 @@ type MachineQuery struct { } // Where adds a new predicate for the MachineQuery builder. -func (mq *MachineQuery) Where(ps ...predicate.Machine) *MachineQuery { - mq.predicates = append(mq.predicates, ps...) - return mq +func (_q *MachineQuery) Where(ps ...predicate.Machine) *MachineQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (mq *MachineQuery) Limit(limit int) *MachineQuery { - mq.ctx.Limit = &limit - return mq +func (_q *MachineQuery) Limit(limit int) *MachineQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (mq *MachineQuery) Offset(offset int) *MachineQuery { - mq.ctx.Offset = &offset - return mq +func (_q *MachineQuery) Offset(offset int) *MachineQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (mq *MachineQuery) Unique(unique bool) *MachineQuery { - mq.ctx.Unique = &unique - return mq +func (_q *MachineQuery) Unique(unique bool) *MachineQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (mq *MachineQuery) Order(o ...machine.OrderOption) *MachineQuery { - mq.order = append(mq.order, o...) - return mq +func (_q *MachineQuery) Order(o ...machine.OrderOption) *MachineQuery { + _q.order = append(_q.order, o...) + return _q } // QueryAlerts chains the current query on the "alerts" edge. -func (mq *MachineQuery) QueryAlerts() *AlertQuery { - query := (&AlertClient{config: mq.config}).Query() +func (_q *MachineQuery) QueryAlerts() *AlertQuery { + query := (&AlertClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := mq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := mq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -77,7 +77,7 @@ func (mq *MachineQuery) QueryAlerts() *AlertQuery { sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.O2M, false, machine.AlertsTable, machine.AlertsColumn), ) - fromU = sqlgraph.SetNeighbors(mq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query @@ -85,8 +85,8 @@ func (mq *MachineQuery) QueryAlerts() *AlertQuery { // First returns the first Machine entity from the query. // Returns a *NotFoundError when no Machine was found. -func (mq *MachineQuery) First(ctx context.Context) (*Machine, error) { - nodes, err := mq.Limit(1).All(setContextOp(ctx, mq.ctx, ent.OpQueryFirst)) +func (_q *MachineQuery) First(ctx context.Context) (*Machine, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -97,8 +97,8 @@ func (mq *MachineQuery) First(ctx context.Context) (*Machine, error) { } // FirstX is like First, but panics if an error occurs. -func (mq *MachineQuery) FirstX(ctx context.Context) *Machine { - node, err := mq.First(ctx) +func (_q *MachineQuery) FirstX(ctx context.Context) *Machine { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -107,9 +107,9 @@ func (mq *MachineQuery) FirstX(ctx context.Context) *Machine { // FirstID returns the first Machine ID from the query. // Returns a *NotFoundError when no Machine ID was found. -func (mq *MachineQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *MachineQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(1).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -120,8 +120,8 @@ func (mq *MachineQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (mq *MachineQuery) FirstIDX(ctx context.Context) int { - id, err := mq.FirstID(ctx) +func (_q *MachineQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -131,8 +131,8 @@ func (mq *MachineQuery) FirstIDX(ctx context.Context) int { // Only returns a single Machine entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Machine entity is found. // Returns a *NotFoundError when no Machine entities are found. -func (mq *MachineQuery) Only(ctx context.Context) (*Machine, error) { - nodes, err := mq.Limit(2).All(setContextOp(ctx, mq.ctx, ent.OpQueryOnly)) +func (_q *MachineQuery) Only(ctx context.Context) (*Machine, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -147,8 +147,8 @@ func (mq *MachineQuery) Only(ctx context.Context) (*Machine, error) { } // OnlyX is like Only, but panics if an error occurs. -func (mq *MachineQuery) OnlyX(ctx context.Context) *Machine { - node, err := mq.Only(ctx) +func (_q *MachineQuery) OnlyX(ctx context.Context) *Machine { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -158,9 +158,9 @@ func (mq *MachineQuery) OnlyX(ctx context.Context) *Machine { // OnlyID is like Only, but returns the only Machine ID in the query. // Returns a *NotSingularError when more than one Machine ID is found. // Returns a *NotFoundError when no entities are found. -func (mq *MachineQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *MachineQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(2).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -175,8 +175,8 @@ func (mq *MachineQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (mq *MachineQuery) OnlyIDX(ctx context.Context) int { - id, err := mq.OnlyID(ctx) +func (_q *MachineQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -184,18 +184,18 @@ func (mq *MachineQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of Machines. -func (mq *MachineQuery) All(ctx context.Context) ([]*Machine, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryAll) - if err := mq.prepareQuery(ctx); err != nil { +func (_q *MachineQuery) All(ctx context.Context) ([]*Machine, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Machine, *MachineQuery]() - return withInterceptors[[]*Machine](ctx, mq, qr, mq.inters) + return withInterceptors[[]*Machine](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (mq *MachineQuery) AllX(ctx context.Context) []*Machine { - nodes, err := mq.All(ctx) +func (_q *MachineQuery) AllX(ctx context.Context) []*Machine { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -203,20 +203,20 @@ func (mq *MachineQuery) AllX(ctx context.Context) []*Machine { } // IDs executes the query and returns a list of Machine IDs. -func (mq *MachineQuery) IDs(ctx context.Context) (ids []int, err error) { - if mq.ctx.Unique == nil && mq.path != nil { - mq.Unique(true) +func (_q *MachineQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryIDs) - if err = mq.Select(machine.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(machine.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (mq *MachineQuery) IDsX(ctx context.Context) []int { - ids, err := mq.IDs(ctx) +func (_q *MachineQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -224,17 +224,17 @@ func (mq *MachineQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (mq *MachineQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryCount) - if err := mq.prepareQuery(ctx); err != nil { +func (_q *MachineQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, mq, querierCount[*MachineQuery](), mq.inters) + return withInterceptors[int](ctx, _q, querierCount[*MachineQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (mq *MachineQuery) CountX(ctx context.Context) int { - count, err := mq.Count(ctx) +func (_q *MachineQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -242,9 +242,9 @@ func (mq *MachineQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (mq *MachineQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryExist) - switch _, err := mq.FirstID(ctx); { +func (_q *MachineQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -255,8 +255,8 @@ func (mq *MachineQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (mq *MachineQuery) ExistX(ctx context.Context) bool { - exist, err := mq.Exist(ctx) +func (_q *MachineQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -265,32 +265,32 @@ func (mq *MachineQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the MachineQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (mq *MachineQuery) Clone() *MachineQuery { - if mq == nil { +func (_q *MachineQuery) Clone() *MachineQuery { + if _q == nil { return nil } return &MachineQuery{ - config: mq.config, - ctx: mq.ctx.Clone(), - order: append([]machine.OrderOption{}, mq.order...), - inters: append([]Interceptor{}, mq.inters...), - predicates: append([]predicate.Machine{}, mq.predicates...), - withAlerts: mq.withAlerts.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]machine.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Machine{}, _q.predicates...), + withAlerts: _q.withAlerts.Clone(), // clone intermediate query. - sql: mq.sql.Clone(), - path: mq.path, + sql: _q.sql.Clone(), + path: _q.path, } } // WithAlerts tells the query-builder to eager-load the nodes that are connected to // the "alerts" edge. The optional arguments are used to configure the query builder of the edge. -func (mq *MachineQuery) WithAlerts(opts ...func(*AlertQuery)) *MachineQuery { - query := (&AlertClient{config: mq.config}).Query() +func (_q *MachineQuery) WithAlerts(opts ...func(*AlertQuery)) *MachineQuery { + query := (&AlertClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - mq.withAlerts = query - return mq + _q.withAlerts = query + return _q } // GroupBy is used to group vertices by one or more fields/columns. @@ -307,10 +307,10 @@ func (mq *MachineQuery) WithAlerts(opts ...func(*AlertQuery)) *MachineQuery { // GroupBy(machine.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (mq *MachineQuery) GroupBy(field string, fields ...string) *MachineGroupBy { - mq.ctx.Fields = append([]string{field}, fields...) - grbuild := &MachineGroupBy{build: mq} - grbuild.flds = &mq.ctx.Fields +func (_q *MachineQuery) GroupBy(field string, fields ...string) *MachineGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &MachineGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = machine.Label grbuild.scan = grbuild.Scan return grbuild @@ -328,58 +328,58 @@ func (mq *MachineQuery) GroupBy(field string, fields ...string) *MachineGroupBy // client.Machine.Query(). // Select(machine.FieldCreatedAt). // Scan(ctx, &v) -func (mq *MachineQuery) Select(fields ...string) *MachineSelect { - mq.ctx.Fields = append(mq.ctx.Fields, fields...) - sbuild := &MachineSelect{MachineQuery: mq} +func (_q *MachineQuery) Select(fields ...string) *MachineSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &MachineSelect{MachineQuery: _q} sbuild.label = machine.Label - sbuild.flds, sbuild.scan = &mq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a MachineSelect configured with the given aggregations. -func (mq *MachineQuery) Aggregate(fns ...AggregateFunc) *MachineSelect { - return mq.Select().Aggregate(fns...) +func (_q *MachineQuery) Aggregate(fns ...AggregateFunc) *MachineSelect { + return _q.Select().Aggregate(fns...) } -func (mq *MachineQuery) prepareQuery(ctx context.Context) error { - for _, inter := range mq.inters { +func (_q *MachineQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, mq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range mq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !machine.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if mq.path != nil { - prev, err := mq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - mq.sql = prev + _q.sql = prev } return nil } -func (mq *MachineQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Machine, error) { +func (_q *MachineQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Machine, error) { var ( nodes = []*Machine{} - _spec = mq.querySpec() + _spec = _q.querySpec() loadedTypes = [1]bool{ - mq.withAlerts != nil, + _q.withAlerts != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Machine).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Machine{config: mq.config} + node := &Machine{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) @@ -387,14 +387,14 @@ func (mq *MachineQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Mach for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, mq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := mq.withAlerts; query != nil { - if err := mq.loadAlerts(ctx, query, nodes, + if query := _q.withAlerts; query != nil { + if err := _q.loadAlerts(ctx, query, nodes, func(n *Machine) { n.Edges.Alerts = []*Alert{} }, func(n *Machine, e *Alert) { n.Edges.Alerts = append(n.Edges.Alerts, e) }); err != nil { return nil, err @@ -403,7 +403,7 @@ func (mq *MachineQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Mach return nodes, nil } -func (mq *MachineQuery) loadAlerts(ctx context.Context, query *AlertQuery, nodes []*Machine, init func(*Machine), assign func(*Machine, *Alert)) error { +func (_q *MachineQuery) loadAlerts(ctx context.Context, query *AlertQuery, nodes []*Machine, init func(*Machine), assign func(*Machine, *Alert)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[int]*Machine) for i := range nodes { @@ -435,24 +435,24 @@ func (mq *MachineQuery) loadAlerts(ctx context.Context, query *AlertQuery, nodes return nil } -func (mq *MachineQuery) sqlCount(ctx context.Context) (int, error) { - _spec := mq.querySpec() - _spec.Node.Columns = mq.ctx.Fields - if len(mq.ctx.Fields) > 0 { - _spec.Unique = mq.ctx.Unique != nil && *mq.ctx.Unique +func (_q *MachineQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, mq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (mq *MachineQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *MachineQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(machine.Table, machine.Columns, sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt)) - _spec.From = mq.sql - if unique := mq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if mq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := mq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, machine.FieldID) for i := range fields { @@ -461,20 +461,20 @@ func (mq *MachineQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := mq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := mq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := mq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := mq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -484,33 +484,33 @@ func (mq *MachineQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (mq *MachineQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(mq.driver.Dialect()) +func (_q *MachineQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(machine.Table) - columns := mq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = machine.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if mq.sql != nil { - selector = mq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if mq.ctx.Unique != nil && *mq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range mq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range mq.order { + for _, p := range _q.order { p(selector) } - if offset := mq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := mq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -523,41 +523,41 @@ type MachineGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (mgb *MachineGroupBy) Aggregate(fns ...AggregateFunc) *MachineGroupBy { - mgb.fns = append(mgb.fns, fns...) - return mgb +func (_g *MachineGroupBy) Aggregate(fns ...AggregateFunc) *MachineGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (mgb *MachineGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, mgb.build.ctx, ent.OpQueryGroupBy) - if err := mgb.build.prepareQuery(ctx); err != nil { +func (_g *MachineGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MachineQuery, *MachineGroupBy](ctx, mgb.build, mgb, mgb.build.inters, v) + return scanWithInterceptors[*MachineQuery, *MachineGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (mgb *MachineGroupBy) sqlScan(ctx context.Context, root *MachineQuery, v any) error { +func (_g *MachineGroupBy) sqlScan(ctx context.Context, root *MachineQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(mgb.fns)) - for _, fn := range mgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*mgb.flds)+len(mgb.fns)) - for _, f := range *mgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*mgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := mgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -571,27 +571,27 @@ type MachineSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ms *MachineSelect) Aggregate(fns ...AggregateFunc) *MachineSelect { - ms.fns = append(ms.fns, fns...) - return ms +func (_s *MachineSelect) Aggregate(fns ...AggregateFunc) *MachineSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ms *MachineSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ms.ctx, ent.OpQuerySelect) - if err := ms.prepareQuery(ctx); err != nil { +func (_s *MachineSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MachineQuery, *MachineSelect](ctx, ms.MachineQuery, ms, ms.inters, v) + return scanWithInterceptors[*MachineQuery, *MachineSelect](ctx, _s.MachineQuery, _s, _s.inters, v) } -func (ms *MachineSelect) sqlScan(ctx context.Context, root *MachineQuery, v any) error { +func (_s *MachineSelect) sqlScan(ctx context.Context, root *MachineQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ms.fns)) - for _, fn := range ms.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ms.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -599,7 +599,7 @@ func (ms *MachineSelect) sqlScan(ctx context.Context, root *MachineQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := ms.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/machine_update.go b/pkg/database/ent/machine_update.go index c0a91f7ad..ccefaf16f 100644 --- a/pkg/database/ent/machine_update.go +++ b/pkg/database/ent/machine_update.go @@ -25,307 +25,307 @@ type MachineUpdate struct { } // Where appends a list predicates to the MachineUpdate builder. -func (mu *MachineUpdate) Where(ps ...predicate.Machine) *MachineUpdate { - mu.mutation.Where(ps...) - return mu +func (_u *MachineUpdate) Where(ps ...predicate.Machine) *MachineUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (mu *MachineUpdate) SetUpdatedAt(t time.Time) *MachineUpdate { - mu.mutation.SetUpdatedAt(t) - return mu +func (_u *MachineUpdate) SetUpdatedAt(v time.Time) *MachineUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetLastPush sets the "last_push" field. -func (mu *MachineUpdate) SetLastPush(t time.Time) *MachineUpdate { - mu.mutation.SetLastPush(t) - return mu +func (_u *MachineUpdate) SetLastPush(v time.Time) *MachineUpdate { + _u.mutation.SetLastPush(v) + return _u } // SetNillableLastPush sets the "last_push" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableLastPush(t *time.Time) *MachineUpdate { - if t != nil { - mu.SetLastPush(*t) +func (_u *MachineUpdate) SetNillableLastPush(v *time.Time) *MachineUpdate { + if v != nil { + _u.SetLastPush(*v) } - return mu + return _u } // ClearLastPush clears the value of the "last_push" field. -func (mu *MachineUpdate) ClearLastPush() *MachineUpdate { - mu.mutation.ClearLastPush() - return mu +func (_u *MachineUpdate) ClearLastPush() *MachineUpdate { + _u.mutation.ClearLastPush() + return _u } // SetLastHeartbeat sets the "last_heartbeat" field. -func (mu *MachineUpdate) SetLastHeartbeat(t time.Time) *MachineUpdate { - mu.mutation.SetLastHeartbeat(t) - return mu +func (_u *MachineUpdate) SetLastHeartbeat(v time.Time) *MachineUpdate { + _u.mutation.SetLastHeartbeat(v) + return _u } // SetNillableLastHeartbeat sets the "last_heartbeat" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableLastHeartbeat(t *time.Time) *MachineUpdate { - if t != nil { - mu.SetLastHeartbeat(*t) +func (_u *MachineUpdate) SetNillableLastHeartbeat(v *time.Time) *MachineUpdate { + if v != nil { + _u.SetLastHeartbeat(*v) } - return mu + return _u } // ClearLastHeartbeat clears the value of the "last_heartbeat" field. -func (mu *MachineUpdate) ClearLastHeartbeat() *MachineUpdate { - mu.mutation.ClearLastHeartbeat() - return mu +func (_u *MachineUpdate) ClearLastHeartbeat() *MachineUpdate { + _u.mutation.ClearLastHeartbeat() + return _u } // SetPassword sets the "password" field. -func (mu *MachineUpdate) SetPassword(s string) *MachineUpdate { - mu.mutation.SetPassword(s) - return mu +func (_u *MachineUpdate) SetPassword(v string) *MachineUpdate { + _u.mutation.SetPassword(v) + return _u } // SetNillablePassword sets the "password" field if the given value is not nil. -func (mu *MachineUpdate) SetNillablePassword(s *string) *MachineUpdate { - if s != nil { - mu.SetPassword(*s) +func (_u *MachineUpdate) SetNillablePassword(v *string) *MachineUpdate { + if v != nil { + _u.SetPassword(*v) } - return mu + return _u } // SetIpAddress sets the "ipAddress" field. -func (mu *MachineUpdate) SetIpAddress(s string) *MachineUpdate { - mu.mutation.SetIpAddress(s) - return mu +func (_u *MachineUpdate) SetIpAddress(v string) *MachineUpdate { + _u.mutation.SetIpAddress(v) + return _u } // SetNillableIpAddress sets the "ipAddress" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableIpAddress(s *string) *MachineUpdate { - if s != nil { - mu.SetIpAddress(*s) +func (_u *MachineUpdate) SetNillableIpAddress(v *string) *MachineUpdate { + if v != nil { + _u.SetIpAddress(*v) } - return mu + return _u } // SetScenarios sets the "scenarios" field. -func (mu *MachineUpdate) SetScenarios(s string) *MachineUpdate { - mu.mutation.SetScenarios(s) - return mu +func (_u *MachineUpdate) SetScenarios(v string) *MachineUpdate { + _u.mutation.SetScenarios(v) + return _u } // SetNillableScenarios sets the "scenarios" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableScenarios(s *string) *MachineUpdate { - if s != nil { - mu.SetScenarios(*s) +func (_u *MachineUpdate) SetNillableScenarios(v *string) *MachineUpdate { + if v != nil { + _u.SetScenarios(*v) } - return mu + return _u } // ClearScenarios clears the value of the "scenarios" field. -func (mu *MachineUpdate) ClearScenarios() *MachineUpdate { - mu.mutation.ClearScenarios() - return mu +func (_u *MachineUpdate) ClearScenarios() *MachineUpdate { + _u.mutation.ClearScenarios() + return _u } // SetVersion sets the "version" field. -func (mu *MachineUpdate) SetVersion(s string) *MachineUpdate { - mu.mutation.SetVersion(s) - return mu +func (_u *MachineUpdate) SetVersion(v string) *MachineUpdate { + _u.mutation.SetVersion(v) + return _u } // SetNillableVersion sets the "version" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableVersion(s *string) *MachineUpdate { - if s != nil { - mu.SetVersion(*s) +func (_u *MachineUpdate) SetNillableVersion(v *string) *MachineUpdate { + if v != nil { + _u.SetVersion(*v) } - return mu + return _u } // ClearVersion clears the value of the "version" field. -func (mu *MachineUpdate) ClearVersion() *MachineUpdate { - mu.mutation.ClearVersion() - return mu +func (_u *MachineUpdate) ClearVersion() *MachineUpdate { + _u.mutation.ClearVersion() + return _u } // SetIsValidated sets the "isValidated" field. -func (mu *MachineUpdate) SetIsValidated(b bool) *MachineUpdate { - mu.mutation.SetIsValidated(b) - return mu +func (_u *MachineUpdate) SetIsValidated(v bool) *MachineUpdate { + _u.mutation.SetIsValidated(v) + return _u } // SetNillableIsValidated sets the "isValidated" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableIsValidated(b *bool) *MachineUpdate { - if b != nil { - mu.SetIsValidated(*b) +func (_u *MachineUpdate) SetNillableIsValidated(v *bool) *MachineUpdate { + if v != nil { + _u.SetIsValidated(*v) } - return mu + return _u } // SetAuthType sets the "auth_type" field. -func (mu *MachineUpdate) SetAuthType(s string) *MachineUpdate { - mu.mutation.SetAuthType(s) - return mu +func (_u *MachineUpdate) SetAuthType(v string) *MachineUpdate { + _u.mutation.SetAuthType(v) + return _u } // SetNillableAuthType sets the "auth_type" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableAuthType(s *string) *MachineUpdate { - if s != nil { - mu.SetAuthType(*s) +func (_u *MachineUpdate) SetNillableAuthType(v *string) *MachineUpdate { + if v != nil { + _u.SetAuthType(*v) } - return mu + return _u } // SetOsname sets the "osname" field. -func (mu *MachineUpdate) SetOsname(s string) *MachineUpdate { - mu.mutation.SetOsname(s) - return mu +func (_u *MachineUpdate) SetOsname(v string) *MachineUpdate { + _u.mutation.SetOsname(v) + return _u } // SetNillableOsname sets the "osname" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableOsname(s *string) *MachineUpdate { - if s != nil { - mu.SetOsname(*s) +func (_u *MachineUpdate) SetNillableOsname(v *string) *MachineUpdate { + if v != nil { + _u.SetOsname(*v) } - return mu + return _u } // ClearOsname clears the value of the "osname" field. -func (mu *MachineUpdate) ClearOsname() *MachineUpdate { - mu.mutation.ClearOsname() - return mu +func (_u *MachineUpdate) ClearOsname() *MachineUpdate { + _u.mutation.ClearOsname() + return _u } // SetOsfamily sets the "osfamily" field. -func (mu *MachineUpdate) SetOsfamily(s string) *MachineUpdate { - mu.mutation.SetOsfamily(s) - return mu +func (_u *MachineUpdate) SetOsfamily(v string) *MachineUpdate { + _u.mutation.SetOsfamily(v) + return _u } // SetNillableOsfamily sets the "osfamily" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableOsfamily(s *string) *MachineUpdate { - if s != nil { - mu.SetOsfamily(*s) +func (_u *MachineUpdate) SetNillableOsfamily(v *string) *MachineUpdate { + if v != nil { + _u.SetOsfamily(*v) } - return mu + return _u } // ClearOsfamily clears the value of the "osfamily" field. -func (mu *MachineUpdate) ClearOsfamily() *MachineUpdate { - mu.mutation.ClearOsfamily() - return mu +func (_u *MachineUpdate) ClearOsfamily() *MachineUpdate { + _u.mutation.ClearOsfamily() + return _u } // SetOsversion sets the "osversion" field. -func (mu *MachineUpdate) SetOsversion(s string) *MachineUpdate { - mu.mutation.SetOsversion(s) - return mu +func (_u *MachineUpdate) SetOsversion(v string) *MachineUpdate { + _u.mutation.SetOsversion(v) + return _u } // SetNillableOsversion sets the "osversion" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableOsversion(s *string) *MachineUpdate { - if s != nil { - mu.SetOsversion(*s) +func (_u *MachineUpdate) SetNillableOsversion(v *string) *MachineUpdate { + if v != nil { + _u.SetOsversion(*v) } - return mu + return _u } // ClearOsversion clears the value of the "osversion" field. -func (mu *MachineUpdate) ClearOsversion() *MachineUpdate { - mu.mutation.ClearOsversion() - return mu +func (_u *MachineUpdate) ClearOsversion() *MachineUpdate { + _u.mutation.ClearOsversion() + return _u } // SetFeatureflags sets the "featureflags" field. -func (mu *MachineUpdate) SetFeatureflags(s string) *MachineUpdate { - mu.mutation.SetFeatureflags(s) - return mu +func (_u *MachineUpdate) SetFeatureflags(v string) *MachineUpdate { + _u.mutation.SetFeatureflags(v) + return _u } // SetNillableFeatureflags sets the "featureflags" field if the given value is not nil. -func (mu *MachineUpdate) SetNillableFeatureflags(s *string) *MachineUpdate { - if s != nil { - mu.SetFeatureflags(*s) +func (_u *MachineUpdate) SetNillableFeatureflags(v *string) *MachineUpdate { + if v != nil { + _u.SetFeatureflags(*v) } - return mu + return _u } // ClearFeatureflags clears the value of the "featureflags" field. -func (mu *MachineUpdate) ClearFeatureflags() *MachineUpdate { - mu.mutation.ClearFeatureflags() - return mu +func (_u *MachineUpdate) ClearFeatureflags() *MachineUpdate { + _u.mutation.ClearFeatureflags() + return _u } // SetHubstate sets the "hubstate" field. -func (mu *MachineUpdate) SetHubstate(ms map[string][]schema.ItemState) *MachineUpdate { - mu.mutation.SetHubstate(ms) - return mu +func (_u *MachineUpdate) SetHubstate(v map[string][]schema.ItemState) *MachineUpdate { + _u.mutation.SetHubstate(v) + return _u } // ClearHubstate clears the value of the "hubstate" field. -func (mu *MachineUpdate) ClearHubstate() *MachineUpdate { - mu.mutation.ClearHubstate() - return mu +func (_u *MachineUpdate) ClearHubstate() *MachineUpdate { + _u.mutation.ClearHubstate() + return _u } // SetDatasources sets the "datasources" field. -func (mu *MachineUpdate) SetDatasources(m map[string]int64) *MachineUpdate { - mu.mutation.SetDatasources(m) - return mu +func (_u *MachineUpdate) SetDatasources(v map[string]int64) *MachineUpdate { + _u.mutation.SetDatasources(v) + return _u } // ClearDatasources clears the value of the "datasources" field. -func (mu *MachineUpdate) ClearDatasources() *MachineUpdate { - mu.mutation.ClearDatasources() - return mu +func (_u *MachineUpdate) ClearDatasources() *MachineUpdate { + _u.mutation.ClearDatasources() + return _u } // AddAlertIDs adds the "alerts" edge to the Alert entity by IDs. -func (mu *MachineUpdate) AddAlertIDs(ids ...int) *MachineUpdate { - mu.mutation.AddAlertIDs(ids...) - return mu +func (_u *MachineUpdate) AddAlertIDs(ids ...int) *MachineUpdate { + _u.mutation.AddAlertIDs(ids...) + return _u } // AddAlerts adds the "alerts" edges to the Alert entity. -func (mu *MachineUpdate) AddAlerts(a ...*Alert) *MachineUpdate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *MachineUpdate) AddAlerts(v ...*Alert) *MachineUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return mu.AddAlertIDs(ids...) + return _u.AddAlertIDs(ids...) } // Mutation returns the MachineMutation object of the builder. -func (mu *MachineUpdate) Mutation() *MachineMutation { - return mu.mutation +func (_u *MachineUpdate) Mutation() *MachineMutation { + return _u.mutation } // ClearAlerts clears all "alerts" edges to the Alert entity. -func (mu *MachineUpdate) ClearAlerts() *MachineUpdate { - mu.mutation.ClearAlerts() - return mu +func (_u *MachineUpdate) ClearAlerts() *MachineUpdate { + _u.mutation.ClearAlerts() + return _u } // RemoveAlertIDs removes the "alerts" edge to Alert entities by IDs. -func (mu *MachineUpdate) RemoveAlertIDs(ids ...int) *MachineUpdate { - mu.mutation.RemoveAlertIDs(ids...) - return mu +func (_u *MachineUpdate) RemoveAlertIDs(ids ...int) *MachineUpdate { + _u.mutation.RemoveAlertIDs(ids...) + return _u } // RemoveAlerts removes "alerts" edges to Alert entities. -func (mu *MachineUpdate) RemoveAlerts(a ...*Alert) *MachineUpdate { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *MachineUpdate) RemoveAlerts(v ...*Alert) *MachineUpdate { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return mu.RemoveAlertIDs(ids...) + return _u.RemoveAlertIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. -func (mu *MachineUpdate) Save(ctx context.Context) (int, error) { - mu.defaults() - return withHooks(ctx, mu.sqlSave, mu.mutation, mu.hooks) +func (_u *MachineUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (mu *MachineUpdate) SaveX(ctx context.Context) int { - affected, err := mu.Save(ctx) +func (_u *MachineUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -333,29 +333,29 @@ func (mu *MachineUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (mu *MachineUpdate) Exec(ctx context.Context) error { - _, err := mu.Save(ctx) +func (_u *MachineUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mu *MachineUpdate) ExecX(ctx context.Context) { - if err := mu.Exec(ctx); err != nil { +func (_u *MachineUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (mu *MachineUpdate) defaults() { - if _, ok := mu.mutation.UpdatedAt(); !ok { +func (_u *MachineUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := machine.UpdateDefaultUpdatedAt() - mu.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (mu *MachineUpdate) check() error { - if v, ok := mu.mutation.Scenarios(); ok { +func (_u *MachineUpdate) check() error { + if v, ok := _u.mutation.Scenarios(); ok { if err := machine.ScenariosValidator(v); err != nil { return &ValidationError{Name: "scenarios", err: fmt.Errorf(`ent: validator failed for field "Machine.scenarios": %w`, err)} } @@ -363,94 +363,94 @@ func (mu *MachineUpdate) check() error { return nil } -func (mu *MachineUpdate) sqlSave(ctx context.Context) (n int, err error) { - if err := mu.check(); err != nil { - return n, err +func (_u *MachineUpdate) sqlSave(ctx context.Context) (_node int, err error) { + if err := _u.check(); err != nil { + return _node, err } _spec := sqlgraph.NewUpdateSpec(machine.Table, machine.Columns, sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt)) - if ps := mu.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 := mu.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(machine.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := mu.mutation.LastPush(); ok { + if value, ok := _u.mutation.LastPush(); ok { _spec.SetField(machine.FieldLastPush, field.TypeTime, value) } - if mu.mutation.LastPushCleared() { + if _u.mutation.LastPushCleared() { _spec.ClearField(machine.FieldLastPush, field.TypeTime) } - if value, ok := mu.mutation.LastHeartbeat(); ok { + if value, ok := _u.mutation.LastHeartbeat(); ok { _spec.SetField(machine.FieldLastHeartbeat, field.TypeTime, value) } - if mu.mutation.LastHeartbeatCleared() { + if _u.mutation.LastHeartbeatCleared() { _spec.ClearField(machine.FieldLastHeartbeat, field.TypeTime) } - if value, ok := mu.mutation.Password(); ok { + if value, ok := _u.mutation.Password(); ok { _spec.SetField(machine.FieldPassword, field.TypeString, value) } - if value, ok := mu.mutation.IpAddress(); ok { + if value, ok := _u.mutation.IpAddress(); ok { _spec.SetField(machine.FieldIpAddress, field.TypeString, value) } - if value, ok := mu.mutation.Scenarios(); ok { + if value, ok := _u.mutation.Scenarios(); ok { _spec.SetField(machine.FieldScenarios, field.TypeString, value) } - if mu.mutation.ScenariosCleared() { + if _u.mutation.ScenariosCleared() { _spec.ClearField(machine.FieldScenarios, field.TypeString) } - if value, ok := mu.mutation.Version(); ok { + if value, ok := _u.mutation.Version(); ok { _spec.SetField(machine.FieldVersion, field.TypeString, value) } - if mu.mutation.VersionCleared() { + if _u.mutation.VersionCleared() { _spec.ClearField(machine.FieldVersion, field.TypeString) } - if value, ok := mu.mutation.IsValidated(); ok { + if value, ok := _u.mutation.IsValidated(); ok { _spec.SetField(machine.FieldIsValidated, field.TypeBool, value) } - if value, ok := mu.mutation.AuthType(); ok { + if value, ok := _u.mutation.AuthType(); ok { _spec.SetField(machine.FieldAuthType, field.TypeString, value) } - if value, ok := mu.mutation.Osname(); ok { + if value, ok := _u.mutation.Osname(); ok { _spec.SetField(machine.FieldOsname, field.TypeString, value) } - if mu.mutation.OsnameCleared() { + if _u.mutation.OsnameCleared() { _spec.ClearField(machine.FieldOsname, field.TypeString) } - if value, ok := mu.mutation.Osfamily(); ok { + if value, ok := _u.mutation.Osfamily(); ok { _spec.SetField(machine.FieldOsfamily, field.TypeString, value) } - if mu.mutation.OsfamilyCleared() { + if _u.mutation.OsfamilyCleared() { _spec.ClearField(machine.FieldOsfamily, field.TypeString) } - if value, ok := mu.mutation.Osversion(); ok { + if value, ok := _u.mutation.Osversion(); ok { _spec.SetField(machine.FieldOsversion, field.TypeString, value) } - if mu.mutation.OsversionCleared() { + if _u.mutation.OsversionCleared() { _spec.ClearField(machine.FieldOsversion, field.TypeString) } - if value, ok := mu.mutation.Featureflags(); ok { + if value, ok := _u.mutation.Featureflags(); ok { _spec.SetField(machine.FieldFeatureflags, field.TypeString, value) } - if mu.mutation.FeatureflagsCleared() { + if _u.mutation.FeatureflagsCleared() { _spec.ClearField(machine.FieldFeatureflags, field.TypeString) } - if value, ok := mu.mutation.Hubstate(); ok { + if value, ok := _u.mutation.Hubstate(); ok { _spec.SetField(machine.FieldHubstate, field.TypeJSON, value) } - if mu.mutation.HubstateCleared() { + if _u.mutation.HubstateCleared() { _spec.ClearField(machine.FieldHubstate, field.TypeJSON) } - if value, ok := mu.mutation.Datasources(); ok { + if value, ok := _u.mutation.Datasources(); ok { _spec.SetField(machine.FieldDatasources, field.TypeJSON, value) } - if mu.mutation.DatasourcesCleared() { + if _u.mutation.DatasourcesCleared() { _spec.ClearField(machine.FieldDatasources, field.TypeJSON) } - if mu.mutation.AlertsCleared() { + if _u.mutation.AlertsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -463,7 +463,7 @@ func (mu *MachineUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := mu.mutation.RemovedAlertsIDs(); len(nodes) > 0 && !mu.mutation.AlertsCleared() { + if nodes := _u.mutation.RemovedAlertsIDs(); len(nodes) > 0 && !_u.mutation.AlertsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -479,7 +479,7 @@ func (mu *MachineUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := mu.mutation.AlertsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.AlertsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -495,7 +495,7 @@ func (mu *MachineUpdate) 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 { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{machine.Label} } else if sqlgraph.IsConstraintError(err) { @@ -503,8 +503,8 @@ func (mu *MachineUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - mu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // MachineUpdateOne is the builder for updating a single Machine entity. @@ -516,314 +516,314 @@ type MachineUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (muo *MachineUpdateOne) SetUpdatedAt(t time.Time) *MachineUpdateOne { - muo.mutation.SetUpdatedAt(t) - return muo +func (_u *MachineUpdateOne) SetUpdatedAt(v time.Time) *MachineUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetLastPush sets the "last_push" field. -func (muo *MachineUpdateOne) SetLastPush(t time.Time) *MachineUpdateOne { - muo.mutation.SetLastPush(t) - return muo +func (_u *MachineUpdateOne) SetLastPush(v time.Time) *MachineUpdateOne { + _u.mutation.SetLastPush(v) + return _u } // SetNillableLastPush sets the "last_push" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableLastPush(t *time.Time) *MachineUpdateOne { - if t != nil { - muo.SetLastPush(*t) +func (_u *MachineUpdateOne) SetNillableLastPush(v *time.Time) *MachineUpdateOne { + if v != nil { + _u.SetLastPush(*v) } - return muo + return _u } // ClearLastPush clears the value of the "last_push" field. -func (muo *MachineUpdateOne) ClearLastPush() *MachineUpdateOne { - muo.mutation.ClearLastPush() - return muo +func (_u *MachineUpdateOne) ClearLastPush() *MachineUpdateOne { + _u.mutation.ClearLastPush() + return _u } // SetLastHeartbeat sets the "last_heartbeat" field. -func (muo *MachineUpdateOne) SetLastHeartbeat(t time.Time) *MachineUpdateOne { - muo.mutation.SetLastHeartbeat(t) - return muo +func (_u *MachineUpdateOne) SetLastHeartbeat(v time.Time) *MachineUpdateOne { + _u.mutation.SetLastHeartbeat(v) + return _u } // SetNillableLastHeartbeat sets the "last_heartbeat" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableLastHeartbeat(t *time.Time) *MachineUpdateOne { - if t != nil { - muo.SetLastHeartbeat(*t) +func (_u *MachineUpdateOne) SetNillableLastHeartbeat(v *time.Time) *MachineUpdateOne { + if v != nil { + _u.SetLastHeartbeat(*v) } - return muo + return _u } // ClearLastHeartbeat clears the value of the "last_heartbeat" field. -func (muo *MachineUpdateOne) ClearLastHeartbeat() *MachineUpdateOne { - muo.mutation.ClearLastHeartbeat() - return muo +func (_u *MachineUpdateOne) ClearLastHeartbeat() *MachineUpdateOne { + _u.mutation.ClearLastHeartbeat() + return _u } // SetPassword sets the "password" field. -func (muo *MachineUpdateOne) SetPassword(s string) *MachineUpdateOne { - muo.mutation.SetPassword(s) - return muo +func (_u *MachineUpdateOne) SetPassword(v string) *MachineUpdateOne { + _u.mutation.SetPassword(v) + return _u } // SetNillablePassword sets the "password" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillablePassword(s *string) *MachineUpdateOne { - if s != nil { - muo.SetPassword(*s) +func (_u *MachineUpdateOne) SetNillablePassword(v *string) *MachineUpdateOne { + if v != nil { + _u.SetPassword(*v) } - return muo + return _u } // SetIpAddress sets the "ipAddress" field. -func (muo *MachineUpdateOne) SetIpAddress(s string) *MachineUpdateOne { - muo.mutation.SetIpAddress(s) - return muo +func (_u *MachineUpdateOne) SetIpAddress(v string) *MachineUpdateOne { + _u.mutation.SetIpAddress(v) + return _u } // SetNillableIpAddress sets the "ipAddress" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableIpAddress(s *string) *MachineUpdateOne { - if s != nil { - muo.SetIpAddress(*s) +func (_u *MachineUpdateOne) SetNillableIpAddress(v *string) *MachineUpdateOne { + if v != nil { + _u.SetIpAddress(*v) } - return muo + return _u } // SetScenarios sets the "scenarios" field. -func (muo *MachineUpdateOne) SetScenarios(s string) *MachineUpdateOne { - muo.mutation.SetScenarios(s) - return muo +func (_u *MachineUpdateOne) SetScenarios(v string) *MachineUpdateOne { + _u.mutation.SetScenarios(v) + return _u } // SetNillableScenarios sets the "scenarios" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableScenarios(s *string) *MachineUpdateOne { - if s != nil { - muo.SetScenarios(*s) +func (_u *MachineUpdateOne) SetNillableScenarios(v *string) *MachineUpdateOne { + if v != nil { + _u.SetScenarios(*v) } - return muo + return _u } // ClearScenarios clears the value of the "scenarios" field. -func (muo *MachineUpdateOne) ClearScenarios() *MachineUpdateOne { - muo.mutation.ClearScenarios() - return muo +func (_u *MachineUpdateOne) ClearScenarios() *MachineUpdateOne { + _u.mutation.ClearScenarios() + return _u } // SetVersion sets the "version" field. -func (muo *MachineUpdateOne) SetVersion(s string) *MachineUpdateOne { - muo.mutation.SetVersion(s) - return muo +func (_u *MachineUpdateOne) SetVersion(v string) *MachineUpdateOne { + _u.mutation.SetVersion(v) + return _u } // SetNillableVersion sets the "version" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableVersion(s *string) *MachineUpdateOne { - if s != nil { - muo.SetVersion(*s) +func (_u *MachineUpdateOne) SetNillableVersion(v *string) *MachineUpdateOne { + if v != nil { + _u.SetVersion(*v) } - return muo + return _u } // ClearVersion clears the value of the "version" field. -func (muo *MachineUpdateOne) ClearVersion() *MachineUpdateOne { - muo.mutation.ClearVersion() - return muo +func (_u *MachineUpdateOne) ClearVersion() *MachineUpdateOne { + _u.mutation.ClearVersion() + return _u } // SetIsValidated sets the "isValidated" field. -func (muo *MachineUpdateOne) SetIsValidated(b bool) *MachineUpdateOne { - muo.mutation.SetIsValidated(b) - return muo +func (_u *MachineUpdateOne) SetIsValidated(v bool) *MachineUpdateOne { + _u.mutation.SetIsValidated(v) + return _u } // SetNillableIsValidated sets the "isValidated" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableIsValidated(b *bool) *MachineUpdateOne { - if b != nil { - muo.SetIsValidated(*b) +func (_u *MachineUpdateOne) SetNillableIsValidated(v *bool) *MachineUpdateOne { + if v != nil { + _u.SetIsValidated(*v) } - return muo + return _u } // SetAuthType sets the "auth_type" field. -func (muo *MachineUpdateOne) SetAuthType(s string) *MachineUpdateOne { - muo.mutation.SetAuthType(s) - return muo +func (_u *MachineUpdateOne) SetAuthType(v string) *MachineUpdateOne { + _u.mutation.SetAuthType(v) + return _u } // SetNillableAuthType sets the "auth_type" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableAuthType(s *string) *MachineUpdateOne { - if s != nil { - muo.SetAuthType(*s) +func (_u *MachineUpdateOne) SetNillableAuthType(v *string) *MachineUpdateOne { + if v != nil { + _u.SetAuthType(*v) } - return muo + return _u } // SetOsname sets the "osname" field. -func (muo *MachineUpdateOne) SetOsname(s string) *MachineUpdateOne { - muo.mutation.SetOsname(s) - return muo +func (_u *MachineUpdateOne) SetOsname(v string) *MachineUpdateOne { + _u.mutation.SetOsname(v) + return _u } // SetNillableOsname sets the "osname" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableOsname(s *string) *MachineUpdateOne { - if s != nil { - muo.SetOsname(*s) +func (_u *MachineUpdateOne) SetNillableOsname(v *string) *MachineUpdateOne { + if v != nil { + _u.SetOsname(*v) } - return muo + return _u } // ClearOsname clears the value of the "osname" field. -func (muo *MachineUpdateOne) ClearOsname() *MachineUpdateOne { - muo.mutation.ClearOsname() - return muo +func (_u *MachineUpdateOne) ClearOsname() *MachineUpdateOne { + _u.mutation.ClearOsname() + return _u } // SetOsfamily sets the "osfamily" field. -func (muo *MachineUpdateOne) SetOsfamily(s string) *MachineUpdateOne { - muo.mutation.SetOsfamily(s) - return muo +func (_u *MachineUpdateOne) SetOsfamily(v string) *MachineUpdateOne { + _u.mutation.SetOsfamily(v) + return _u } // SetNillableOsfamily sets the "osfamily" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableOsfamily(s *string) *MachineUpdateOne { - if s != nil { - muo.SetOsfamily(*s) +func (_u *MachineUpdateOne) SetNillableOsfamily(v *string) *MachineUpdateOne { + if v != nil { + _u.SetOsfamily(*v) } - return muo + return _u } // ClearOsfamily clears the value of the "osfamily" field. -func (muo *MachineUpdateOne) ClearOsfamily() *MachineUpdateOne { - muo.mutation.ClearOsfamily() - return muo +func (_u *MachineUpdateOne) ClearOsfamily() *MachineUpdateOne { + _u.mutation.ClearOsfamily() + return _u } // SetOsversion sets the "osversion" field. -func (muo *MachineUpdateOne) SetOsversion(s string) *MachineUpdateOne { - muo.mutation.SetOsversion(s) - return muo +func (_u *MachineUpdateOne) SetOsversion(v string) *MachineUpdateOne { + _u.mutation.SetOsversion(v) + return _u } // SetNillableOsversion sets the "osversion" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableOsversion(s *string) *MachineUpdateOne { - if s != nil { - muo.SetOsversion(*s) +func (_u *MachineUpdateOne) SetNillableOsversion(v *string) *MachineUpdateOne { + if v != nil { + _u.SetOsversion(*v) } - return muo + return _u } // ClearOsversion clears the value of the "osversion" field. -func (muo *MachineUpdateOne) ClearOsversion() *MachineUpdateOne { - muo.mutation.ClearOsversion() - return muo +func (_u *MachineUpdateOne) ClearOsversion() *MachineUpdateOne { + _u.mutation.ClearOsversion() + return _u } // SetFeatureflags sets the "featureflags" field. -func (muo *MachineUpdateOne) SetFeatureflags(s string) *MachineUpdateOne { - muo.mutation.SetFeatureflags(s) - return muo +func (_u *MachineUpdateOne) SetFeatureflags(v string) *MachineUpdateOne { + _u.mutation.SetFeatureflags(v) + return _u } // SetNillableFeatureflags sets the "featureflags" field if the given value is not nil. -func (muo *MachineUpdateOne) SetNillableFeatureflags(s *string) *MachineUpdateOne { - if s != nil { - muo.SetFeatureflags(*s) +func (_u *MachineUpdateOne) SetNillableFeatureflags(v *string) *MachineUpdateOne { + if v != nil { + _u.SetFeatureflags(*v) } - return muo + return _u } // ClearFeatureflags clears the value of the "featureflags" field. -func (muo *MachineUpdateOne) ClearFeatureflags() *MachineUpdateOne { - muo.mutation.ClearFeatureflags() - return muo +func (_u *MachineUpdateOne) ClearFeatureflags() *MachineUpdateOne { + _u.mutation.ClearFeatureflags() + return _u } // SetHubstate sets the "hubstate" field. -func (muo *MachineUpdateOne) SetHubstate(ms map[string][]schema.ItemState) *MachineUpdateOne { - muo.mutation.SetHubstate(ms) - return muo +func (_u *MachineUpdateOne) SetHubstate(v map[string][]schema.ItemState) *MachineUpdateOne { + _u.mutation.SetHubstate(v) + return _u } // ClearHubstate clears the value of the "hubstate" field. -func (muo *MachineUpdateOne) ClearHubstate() *MachineUpdateOne { - muo.mutation.ClearHubstate() - return muo +func (_u *MachineUpdateOne) ClearHubstate() *MachineUpdateOne { + _u.mutation.ClearHubstate() + return _u } // SetDatasources sets the "datasources" field. -func (muo *MachineUpdateOne) SetDatasources(m map[string]int64) *MachineUpdateOne { - muo.mutation.SetDatasources(m) - return muo +func (_u *MachineUpdateOne) SetDatasources(v map[string]int64) *MachineUpdateOne { + _u.mutation.SetDatasources(v) + return _u } // ClearDatasources clears the value of the "datasources" field. -func (muo *MachineUpdateOne) ClearDatasources() *MachineUpdateOne { - muo.mutation.ClearDatasources() - return muo +func (_u *MachineUpdateOne) ClearDatasources() *MachineUpdateOne { + _u.mutation.ClearDatasources() + return _u } // AddAlertIDs adds the "alerts" edge to the Alert entity by IDs. -func (muo *MachineUpdateOne) AddAlertIDs(ids ...int) *MachineUpdateOne { - muo.mutation.AddAlertIDs(ids...) - return muo +func (_u *MachineUpdateOne) AddAlertIDs(ids ...int) *MachineUpdateOne { + _u.mutation.AddAlertIDs(ids...) + return _u } // AddAlerts adds the "alerts" edges to the Alert entity. -func (muo *MachineUpdateOne) AddAlerts(a ...*Alert) *MachineUpdateOne { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *MachineUpdateOne) AddAlerts(v ...*Alert) *MachineUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return muo.AddAlertIDs(ids...) + return _u.AddAlertIDs(ids...) } // Mutation returns the MachineMutation object of the builder. -func (muo *MachineUpdateOne) Mutation() *MachineMutation { - return muo.mutation +func (_u *MachineUpdateOne) Mutation() *MachineMutation { + return _u.mutation } // ClearAlerts clears all "alerts" edges to the Alert entity. -func (muo *MachineUpdateOne) ClearAlerts() *MachineUpdateOne { - muo.mutation.ClearAlerts() - return muo +func (_u *MachineUpdateOne) ClearAlerts() *MachineUpdateOne { + _u.mutation.ClearAlerts() + return _u } // RemoveAlertIDs removes the "alerts" edge to Alert entities by IDs. -func (muo *MachineUpdateOne) RemoveAlertIDs(ids ...int) *MachineUpdateOne { - muo.mutation.RemoveAlertIDs(ids...) - return muo +func (_u *MachineUpdateOne) RemoveAlertIDs(ids ...int) *MachineUpdateOne { + _u.mutation.RemoveAlertIDs(ids...) + return _u } // RemoveAlerts removes "alerts" edges to Alert entities. -func (muo *MachineUpdateOne) RemoveAlerts(a ...*Alert) *MachineUpdateOne { - ids := make([]int, len(a)) - for i := range a { - ids[i] = a[i].ID +func (_u *MachineUpdateOne) RemoveAlerts(v ...*Alert) *MachineUpdateOne { + ids := make([]int, len(v)) + for i := range v { + ids[i] = v[i].ID } - return muo.RemoveAlertIDs(ids...) + return _u.RemoveAlertIDs(ids...) } // Where appends a list predicates to the MachineUpdate builder. -func (muo *MachineUpdateOne) Where(ps ...predicate.Machine) *MachineUpdateOne { - muo.mutation.Where(ps...) - return muo +func (_u *MachineUpdateOne) Where(ps ...predicate.Machine) *MachineUpdateOne { + _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 *MachineUpdateOne) Select(field string, fields ...string) *MachineUpdateOne { - muo.fields = append([]string{field}, fields...) - return muo +func (_u *MachineUpdateOne) Select(field string, fields ...string) *MachineUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Machine entity. -func (muo *MachineUpdateOne) Save(ctx context.Context) (*Machine, error) { - muo.defaults() - return withHooks(ctx, muo.sqlSave, muo.mutation, muo.hooks) +func (_u *MachineUpdateOne) Save(ctx context.Context) (*Machine, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (muo *MachineUpdateOne) SaveX(ctx context.Context) *Machine { - node, err := muo.Save(ctx) +func (_u *MachineUpdateOne) SaveX(ctx context.Context) *Machine { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -831,29 +831,29 @@ func (muo *MachineUpdateOne) SaveX(ctx context.Context) *Machine { } // Exec executes the query on the entity. -func (muo *MachineUpdateOne) Exec(ctx context.Context) error { - _, err := muo.Save(ctx) +func (_u *MachineUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (muo *MachineUpdateOne) ExecX(ctx context.Context) { - if err := muo.Exec(ctx); err != nil { +func (_u *MachineUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (muo *MachineUpdateOne) defaults() { - if _, ok := muo.mutation.UpdatedAt(); !ok { +func (_u *MachineUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := machine.UpdateDefaultUpdatedAt() - muo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (muo *MachineUpdateOne) check() error { - if v, ok := muo.mutation.Scenarios(); ok { +func (_u *MachineUpdateOne) check() error { + if v, ok := _u.mutation.Scenarios(); ok { if err := machine.ScenariosValidator(v); err != nil { return &ValidationError{Name: "scenarios", err: fmt.Errorf(`ent: validator failed for field "Machine.scenarios": %w`, err)} } @@ -861,17 +861,17 @@ func (muo *MachineUpdateOne) check() error { return nil } -func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err error) { - if err := muo.check(); err != nil { +func (_u *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err error) { + if err := _u.check(); err != nil { return _node, err } _spec := sqlgraph.NewUpdateSpec(machine.Table, machine.Columns, sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt)) - id, ok := muo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Machine.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, machine.FieldID) for _, f := range fields { @@ -883,89 +883,89 @@ func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err e } } } - 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.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(machine.FieldUpdatedAt, field.TypeTime, value) } - if value, ok := muo.mutation.LastPush(); ok { + if value, ok := _u.mutation.LastPush(); ok { _spec.SetField(machine.FieldLastPush, field.TypeTime, value) } - if muo.mutation.LastPushCleared() { + if _u.mutation.LastPushCleared() { _spec.ClearField(machine.FieldLastPush, field.TypeTime) } - if value, ok := muo.mutation.LastHeartbeat(); ok { + if value, ok := _u.mutation.LastHeartbeat(); ok { _spec.SetField(machine.FieldLastHeartbeat, field.TypeTime, value) } - if muo.mutation.LastHeartbeatCleared() { + if _u.mutation.LastHeartbeatCleared() { _spec.ClearField(machine.FieldLastHeartbeat, field.TypeTime) } - if value, ok := muo.mutation.Password(); ok { + if value, ok := _u.mutation.Password(); ok { _spec.SetField(machine.FieldPassword, field.TypeString, value) } - if value, ok := muo.mutation.IpAddress(); ok { + if value, ok := _u.mutation.IpAddress(); ok { _spec.SetField(machine.FieldIpAddress, field.TypeString, value) } - if value, ok := muo.mutation.Scenarios(); ok { + if value, ok := _u.mutation.Scenarios(); ok { _spec.SetField(machine.FieldScenarios, field.TypeString, value) } - if muo.mutation.ScenariosCleared() { + if _u.mutation.ScenariosCleared() { _spec.ClearField(machine.FieldScenarios, field.TypeString) } - if value, ok := muo.mutation.Version(); ok { + if value, ok := _u.mutation.Version(); ok { _spec.SetField(machine.FieldVersion, field.TypeString, value) } - if muo.mutation.VersionCleared() { + if _u.mutation.VersionCleared() { _spec.ClearField(machine.FieldVersion, field.TypeString) } - if value, ok := muo.mutation.IsValidated(); ok { + if value, ok := _u.mutation.IsValidated(); ok { _spec.SetField(machine.FieldIsValidated, field.TypeBool, value) } - if value, ok := muo.mutation.AuthType(); ok { + if value, ok := _u.mutation.AuthType(); ok { _spec.SetField(machine.FieldAuthType, field.TypeString, value) } - if value, ok := muo.mutation.Osname(); ok { + if value, ok := _u.mutation.Osname(); ok { _spec.SetField(machine.FieldOsname, field.TypeString, value) } - if muo.mutation.OsnameCleared() { + if _u.mutation.OsnameCleared() { _spec.ClearField(machine.FieldOsname, field.TypeString) } - if value, ok := muo.mutation.Osfamily(); ok { + if value, ok := _u.mutation.Osfamily(); ok { _spec.SetField(machine.FieldOsfamily, field.TypeString, value) } - if muo.mutation.OsfamilyCleared() { + if _u.mutation.OsfamilyCleared() { _spec.ClearField(machine.FieldOsfamily, field.TypeString) } - if value, ok := muo.mutation.Osversion(); ok { + if value, ok := _u.mutation.Osversion(); ok { _spec.SetField(machine.FieldOsversion, field.TypeString, value) } - if muo.mutation.OsversionCleared() { + if _u.mutation.OsversionCleared() { _spec.ClearField(machine.FieldOsversion, field.TypeString) } - if value, ok := muo.mutation.Featureflags(); ok { + if value, ok := _u.mutation.Featureflags(); ok { _spec.SetField(machine.FieldFeatureflags, field.TypeString, value) } - if muo.mutation.FeatureflagsCleared() { + if _u.mutation.FeatureflagsCleared() { _spec.ClearField(machine.FieldFeatureflags, field.TypeString) } - if value, ok := muo.mutation.Hubstate(); ok { + if value, ok := _u.mutation.Hubstate(); ok { _spec.SetField(machine.FieldHubstate, field.TypeJSON, value) } - if muo.mutation.HubstateCleared() { + if _u.mutation.HubstateCleared() { _spec.ClearField(machine.FieldHubstate, field.TypeJSON) } - if value, ok := muo.mutation.Datasources(); ok { + if value, ok := _u.mutation.Datasources(); ok { _spec.SetField(machine.FieldDatasources, field.TypeJSON, value) } - if muo.mutation.DatasourcesCleared() { + if _u.mutation.DatasourcesCleared() { _spec.ClearField(machine.FieldDatasources, field.TypeJSON) } - if muo.mutation.AlertsCleared() { + if _u.mutation.AlertsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -978,7 +978,7 @@ func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err e } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := muo.mutation.RemovedAlertsIDs(); len(nodes) > 0 && !muo.mutation.AlertsCleared() { + if nodes := _u.mutation.RemovedAlertsIDs(); len(nodes) > 0 && !_u.mutation.AlertsCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -994,7 +994,7 @@ func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err e } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := muo.mutation.AlertsIDs(); len(nodes) > 0 { + if nodes := _u.mutation.AlertsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, @@ -1010,10 +1010,10 @@ func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err e } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - _node = &Machine{config: muo.config} + _node = &Machine{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{machine.Label} } else if sqlgraph.IsConstraintError(err) { @@ -1021,6 +1021,6 @@ func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err e } return nil, err } - muo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/meta.go b/pkg/database/ent/meta.go index 7e2962795..8dfd1557d 100644 --- a/pkg/database/ent/meta.go +++ b/pkg/database/ent/meta.go @@ -74,7 +74,7 @@ func (*Meta) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Meta fields. -func (m *Meta) assignValues(columns []string, values []any) error { +func (_m *Meta) 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) } @@ -85,39 +85,39 @@ func (m *Meta) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - m.ID = int(value.Int64) + _m.ID = int(value.Int64) case meta.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - m.CreatedAt = value.Time + _m.CreatedAt = value.Time } case meta.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - m.UpdatedAt = value.Time + _m.UpdatedAt = value.Time } case meta.FieldKey: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field key", values[i]) } else if value.Valid { - m.Key = value.String + _m.Key = value.String } case meta.FieldValue: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field value", values[i]) } else if value.Valid { - m.Value = value.String + _m.Value = value.String } case meta.FieldAlertMetas: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field alert_metas", values[i]) } else if value.Valid { - m.AlertMetas = int(value.Int64) + _m.AlertMetas = int(value.Int64) } default: - m.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -125,52 +125,52 @@ func (m *Meta) assignValues(columns []string, values []any) error { // GetValue returns the ent.Value that was dynamically selected and assigned to the Meta. // This includes values selected through modifiers, order, etc. -func (m *Meta) GetValue(name string) (ent.Value, error) { - return m.selectValues.Get(name) +func (_m *Meta) GetValue(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // QueryOwner queries the "owner" edge of the Meta entity. -func (m *Meta) QueryOwner() *AlertQuery { - return NewMetaClient(m.config).QueryOwner(m) +func (_m *Meta) QueryOwner() *AlertQuery { + return NewMetaClient(_m.config).QueryOwner(_m) } // Update returns a builder for updating this Meta. // Note that you need to call Meta.Unwrap() before calling this method if this Meta // was returned from a transaction, and the transaction was committed or rolled back. -func (m *Meta) Update() *MetaUpdateOne { - return NewMetaClient(m.config).UpdateOne(m) +func (_m *Meta) Update() *MetaUpdateOne { + return NewMetaClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Meta 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 *Meta) Unwrap() *Meta { - _tx, ok := m.config.driver.(*txDriver) +func (_m *Meta) Unwrap() *Meta { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Meta 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 *Meta) String() string { +func (_m *Meta) String() string { var builder strings.Builder builder.WriteString("Meta(") - builder.WriteString(fmt.Sprintf("id=%v, ", m.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") - builder.WriteString(m.CreatedAt.Format(time.ANSIC)) + builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(m.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(_m.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("key=") - builder.WriteString(m.Key) + builder.WriteString(_m.Key) builder.WriteString(", ") builder.WriteString("value=") - builder.WriteString(m.Value) + builder.WriteString(_m.Value) builder.WriteString(", ") builder.WriteString("alert_metas=") - builder.WriteString(fmt.Sprintf("%v", m.AlertMetas)) + builder.WriteString(fmt.Sprintf("%v", _m.AlertMetas)) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/meta_create.go b/pkg/database/ent/meta_create.go index f577637f4..6b3e02844 100644 --- a/pkg/database/ent/meta_create.go +++ b/pkg/database/ent/meta_create.go @@ -24,92 +24,92 @@ type MetaCreate struct { } // SetCreatedAt sets the "created_at" field. -func (mc *MetaCreate) SetCreatedAt(t time.Time) *MetaCreate { - mc.mutation.SetCreatedAt(t) - return mc +func (_c *MetaCreate) SetCreatedAt(v time.Time) *MetaCreate { + _c.mutation.SetCreatedAt(v) + return _c } // SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (mc *MetaCreate) SetNillableCreatedAt(t *time.Time) *MetaCreate { - if t != nil { - mc.SetCreatedAt(*t) +func (_c *MetaCreate) SetNillableCreatedAt(v *time.Time) *MetaCreate { + if v != nil { + _c.SetCreatedAt(*v) } - return mc + return _c } // SetUpdatedAt sets the "updated_at" field. -func (mc *MetaCreate) SetUpdatedAt(t time.Time) *MetaCreate { - mc.mutation.SetUpdatedAt(t) - return mc +func (_c *MetaCreate) SetUpdatedAt(v time.Time) *MetaCreate { + _c.mutation.SetUpdatedAt(v) + return _c } // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (mc *MetaCreate) SetNillableUpdatedAt(t *time.Time) *MetaCreate { - if t != nil { - mc.SetUpdatedAt(*t) +func (_c *MetaCreate) SetNillableUpdatedAt(v *time.Time) *MetaCreate { + if v != nil { + _c.SetUpdatedAt(*v) } - return mc + return _c } // SetKey sets the "key" field. -func (mc *MetaCreate) SetKey(s string) *MetaCreate { - mc.mutation.SetKey(s) - return mc +func (_c *MetaCreate) SetKey(v string) *MetaCreate { + _c.mutation.SetKey(v) + return _c } // SetValue sets the "value" field. -func (mc *MetaCreate) SetValue(s string) *MetaCreate { - mc.mutation.SetValue(s) - return mc +func (_c *MetaCreate) SetValue(v string) *MetaCreate { + _c.mutation.SetValue(v) + return _c } // SetAlertMetas sets the "alert_metas" field. -func (mc *MetaCreate) SetAlertMetas(i int) *MetaCreate { - mc.mutation.SetAlertMetas(i) - return mc +func (_c *MetaCreate) SetAlertMetas(v int) *MetaCreate { + _c.mutation.SetAlertMetas(v) + return _c } // SetNillableAlertMetas sets the "alert_metas" field if the given value is not nil. -func (mc *MetaCreate) SetNillableAlertMetas(i *int) *MetaCreate { - if i != nil { - mc.SetAlertMetas(*i) +func (_c *MetaCreate) SetNillableAlertMetas(v *int) *MetaCreate { + if v != nil { + _c.SetAlertMetas(*v) } - return mc + return _c } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (mc *MetaCreate) SetOwnerID(id int) *MetaCreate { - mc.mutation.SetOwnerID(id) - return mc +func (_c *MetaCreate) SetOwnerID(id int) *MetaCreate { + _c.mutation.SetOwnerID(id) + return _c } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (mc *MetaCreate) SetNillableOwnerID(id *int) *MetaCreate { +func (_c *MetaCreate) SetNillableOwnerID(id *int) *MetaCreate { if id != nil { - mc = mc.SetOwnerID(*id) + _c = _c.SetOwnerID(*id) } - return mc + return _c } // SetOwner sets the "owner" edge to the Alert entity. -func (mc *MetaCreate) SetOwner(a *Alert) *MetaCreate { - return mc.SetOwnerID(a.ID) +func (_c *MetaCreate) SetOwner(v *Alert) *MetaCreate { + return _c.SetOwnerID(v.ID) } // Mutation returns the MetaMutation object of the builder. -func (mc *MetaCreate) Mutation() *MetaMutation { - return mc.mutation +func (_c *MetaCreate) Mutation() *MetaMutation { + return _c.mutation } // Save creates the Meta in the database. -func (mc *MetaCreate) Save(ctx context.Context) (*Meta, error) { - mc.defaults() - return withHooks(ctx, mc.sqlSave, mc.mutation, mc.hooks) +func (_c *MetaCreate) Save(ctx context.Context) (*Meta, error) { + _c.defaults() + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (mc *MetaCreate) SaveX(ctx context.Context) *Meta { - v, err := mc.Save(ctx) +func (_c *MetaCreate) SaveX(ctx context.Context) *Meta { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -117,45 +117,45 @@ func (mc *MetaCreate) SaveX(ctx context.Context) *Meta { } // Exec executes the query. -func (mc *MetaCreate) Exec(ctx context.Context) error { - _, err := mc.Save(ctx) +func (_c *MetaCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mc *MetaCreate) ExecX(ctx context.Context) { - if err := mc.Exec(ctx); err != nil { +func (_c *MetaCreate) 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 *MetaCreate) defaults() { - if _, ok := mc.mutation.CreatedAt(); !ok { +func (_c *MetaCreate) defaults() { + if _, ok := _c.mutation.CreatedAt(); !ok { v := meta.DefaultCreatedAt() - mc.mutation.SetCreatedAt(v) + _c.mutation.SetCreatedAt(v) } - if _, ok := mc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { v := meta.DefaultUpdatedAt() - mc.mutation.SetUpdatedAt(v) + _c.mutation.SetUpdatedAt(v) } } // check runs all checks and user-defined validators on the builder. -func (mc *MetaCreate) check() error { - if _, ok := mc.mutation.CreatedAt(); !ok { +func (_c *MetaCreate) check() error { + if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Meta.created_at"`)} } - if _, ok := mc.mutation.UpdatedAt(); !ok { + if _, ok := _c.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Meta.updated_at"`)} } - if _, ok := mc.mutation.Key(); !ok { + if _, ok := _c.mutation.Key(); !ok { return &ValidationError{Name: "key", err: errors.New(`ent: missing required field "Meta.key"`)} } - if _, ok := mc.mutation.Value(); !ok { + if _, ok := _c.mutation.Value(); !ok { return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "Meta.value"`)} } - if v, ok := mc.mutation.Value(); ok { + if v, ok := _c.mutation.Value(); ok { if err := meta.ValueValidator(v); err != nil { return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "Meta.value": %w`, err)} } @@ -163,12 +163,12 @@ func (mc *MetaCreate) check() error { return nil } -func (mc *MetaCreate) sqlSave(ctx context.Context) (*Meta, error) { - if err := mc.check(); err != nil { +func (_c *MetaCreate) sqlSave(ctx context.Context) (*Meta, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := mc.createSpec() - if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -176,34 +176,34 @@ func (mc *MetaCreate) sqlSave(ctx context.Context) (*Meta, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - mc.mutation.id = &_node.ID - mc.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (mc *MetaCreate) createSpec() (*Meta, *sqlgraph.CreateSpec) { +func (_c *MetaCreate) createSpec() (*Meta, *sqlgraph.CreateSpec) { var ( - _node = &Meta{config: mc.config} + _node = &Meta{config: _c.config} _spec = sqlgraph.NewCreateSpec(meta.Table, sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt)) ) - _spec.OnConflict = mc.conflict - if value, ok := mc.mutation.CreatedAt(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(meta.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value } - if value, ok := mc.mutation.UpdatedAt(); ok { + if value, ok := _c.mutation.UpdatedAt(); ok { _spec.SetField(meta.FieldUpdatedAt, field.TypeTime, value) _node.UpdatedAt = value } - if value, ok := mc.mutation.Key(); ok { + if value, ok := _c.mutation.Key(); ok { _spec.SetField(meta.FieldKey, field.TypeString, value) _node.Key = value } - if value, ok := mc.mutation.Value(); ok { + if value, ok := _c.mutation.Value(); ok { _spec.SetField(meta.FieldValue, field.TypeString, value) _node.Value = value } - if nodes := mc.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _c.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -239,10 +239,10 @@ func (mc *MetaCreate) createSpec() (*Meta, *sqlgraph.CreateSpec) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (mc *MetaCreate) OnConflict(opts ...sql.ConflictOption) *MetaUpsertOne { - mc.conflict = opts +func (_c *MetaCreate) OnConflict(opts ...sql.ConflictOption) *MetaUpsertOne { + _c.conflict = opts return &MetaUpsertOne{ - create: mc, + create: _c, } } @@ -252,10 +252,10 @@ func (mc *MetaCreate) OnConflict(opts ...sql.ConflictOption) *MetaUpsertOne { // client.Meta.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (mc *MetaCreate) OnConflictColumns(columns ...string) *MetaUpsertOne { - mc.conflict = append(mc.conflict, sql.ConflictColumns(columns...)) +func (_c *MetaCreate) OnConflictColumns(columns ...string) *MetaUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &MetaUpsertOne{ - create: mc, + create: _c, } } @@ -430,16 +430,16 @@ type MetaCreateBulk struct { } // Save creates the Meta entities in the database. -func (mcb *MetaCreateBulk) Save(ctx context.Context) ([]*Meta, error) { - if mcb.err != nil { - return nil, mcb.err +func (_c *MetaCreateBulk) Save(ctx context.Context) ([]*Meta, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(mcb.builders)) - nodes := make([]*Meta, len(mcb.builders)) - mutators := make([]Mutator, len(mcb.builders)) - for i := range mcb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Meta, 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.(*MetaMutation) @@ -453,12 +453,12 @@ func (mcb *MetaCreateBulk) Save(ctx context.Context) ([]*Meta, error) { 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} - spec.OnConflict = mcb.conflict + spec.OnConflict = _c.conflict // 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{msg: err.Error(), wrap: err} } @@ -482,7 +482,7 @@ func (mcb *MetaCreateBulk) Save(ctx context.Context) ([]*Meta, 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 } } @@ -490,8 +490,8 @@ func (mcb *MetaCreateBulk) Save(ctx context.Context) ([]*Meta, error) { } // SaveX is like Save, but panics if an error occurs. -func (mcb *MetaCreateBulk) SaveX(ctx context.Context) []*Meta { - v, err := mcb.Save(ctx) +func (_c *MetaCreateBulk) SaveX(ctx context.Context) []*Meta { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -499,14 +499,14 @@ func (mcb *MetaCreateBulk) SaveX(ctx context.Context) []*Meta { } // Exec executes the query. -func (mcb *MetaCreateBulk) Exec(ctx context.Context) error { - _, err := mcb.Save(ctx) +func (_c *MetaCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mcb *MetaCreateBulk) ExecX(ctx context.Context) { - if err := mcb.Exec(ctx); err != nil { +func (_c *MetaCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -526,10 +526,10 @@ func (mcb *MetaCreateBulk) ExecX(ctx context.Context) { // SetCreatedAt(v+v). // }). // Exec(ctx) -func (mcb *MetaCreateBulk) OnConflict(opts ...sql.ConflictOption) *MetaUpsertBulk { - mcb.conflict = opts +func (_c *MetaCreateBulk) OnConflict(opts ...sql.ConflictOption) *MetaUpsertBulk { + _c.conflict = opts return &MetaUpsertBulk{ - create: mcb, + create: _c, } } @@ -539,10 +539,10 @@ func (mcb *MetaCreateBulk) OnConflict(opts ...sql.ConflictOption) *MetaUpsertBul // client.Meta.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (mcb *MetaCreateBulk) OnConflictColumns(columns ...string) *MetaUpsertBulk { - mcb.conflict = append(mcb.conflict, sql.ConflictColumns(columns...)) +func (_c *MetaCreateBulk) OnConflictColumns(columns ...string) *MetaUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &MetaUpsertBulk{ - create: mcb, + create: _c, } } diff --git a/pkg/database/ent/meta_delete.go b/pkg/database/ent/meta_delete.go index ee25dd07e..0146afc55 100644 --- a/pkg/database/ent/meta_delete.go +++ b/pkg/database/ent/meta_delete.go @@ -20,56 +20,56 @@ type MetaDelete struct { } // Where appends a list predicates to the MetaDelete builder. -func (md *MetaDelete) Where(ps ...predicate.Meta) *MetaDelete { - md.mutation.Where(ps...) - return md +func (_d *MetaDelete) Where(ps ...predicate.Meta) *MetaDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (md *MetaDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, md.sqlExec, md.mutation, md.hooks) +func (_d *MetaDelete) 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 *MetaDelete) ExecX(ctx context.Context) int { - n, err := md.Exec(ctx) +func (_d *MetaDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (md *MetaDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *MetaDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(meta.Table, sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt)) - if ps := md.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := 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} } - md.mutation.done = true + _d.mutation.done = true return affected, err } // MetaDeleteOne is the builder for deleting a single Meta entity. type MetaDeleteOne struct { - md *MetaDelete + _d *MetaDelete } // Where appends a list predicates to the MetaDelete builder. -func (mdo *MetaDeleteOne) Where(ps ...predicate.Meta) *MetaDeleteOne { - mdo.md.mutation.Where(ps...) - return mdo +func (_d *MetaDeleteOne) Where(ps ...predicate.Meta) *MetaDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (mdo *MetaDeleteOne) Exec(ctx context.Context) error { - n, err := mdo.md.Exec(ctx) +func (_d *MetaDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (mdo *MetaDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (mdo *MetaDeleteOne) ExecX(ctx context.Context) { - if err := mdo.Exec(ctx); err != nil { +func (_d *MetaDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/meta_query.go b/pkg/database/ent/meta_query.go index 9b8acefaa..f1805e588 100644 --- a/pkg/database/ent/meta_query.go +++ b/pkg/database/ent/meta_query.go @@ -30,44 +30,44 @@ type MetaQuery struct { } // Where adds a new predicate for the MetaQuery builder. -func (mq *MetaQuery) Where(ps ...predicate.Meta) *MetaQuery { - mq.predicates = append(mq.predicates, ps...) - return mq +func (_q *MetaQuery) Where(ps ...predicate.Meta) *MetaQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (mq *MetaQuery) Limit(limit int) *MetaQuery { - mq.ctx.Limit = &limit - return mq +func (_q *MetaQuery) Limit(limit int) *MetaQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (mq *MetaQuery) Offset(offset int) *MetaQuery { - mq.ctx.Offset = &offset - return mq +func (_q *MetaQuery) Offset(offset int) *MetaQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (mq *MetaQuery) Unique(unique bool) *MetaQuery { - mq.ctx.Unique = &unique - return mq +func (_q *MetaQuery) Unique(unique bool) *MetaQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (mq *MetaQuery) Order(o ...meta.OrderOption) *MetaQuery { - mq.order = append(mq.order, o...) - return mq +func (_q *MetaQuery) Order(o ...meta.OrderOption) *MetaQuery { + _q.order = append(_q.order, o...) + return _q } // QueryOwner chains the current query on the "owner" edge. -func (mq *MetaQuery) QueryOwner() *AlertQuery { - query := (&AlertClient{config: mq.config}).Query() +func (_q *MetaQuery) QueryOwner() *AlertQuery { + query := (&AlertClient{config: _q.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := mq.prepareQuery(ctx); err != nil { + if err := _q.prepareQuery(ctx); err != nil { return nil, err } - selector := mq.sqlQuery(ctx) + selector := _q.sqlQuery(ctx) if err := selector.Err(); err != nil { return nil, err } @@ -76,7 +76,7 @@ func (mq *MetaQuery) QueryOwner() *AlertQuery { sqlgraph.To(alert.Table, alert.FieldID), sqlgraph.Edge(sqlgraph.M2O, true, meta.OwnerTable, meta.OwnerColumn), ) - fromU = sqlgraph.SetNeighbors(mq.driver.Dialect(), step) + fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step) return fromU, nil } return query @@ -84,8 +84,8 @@ func (mq *MetaQuery) QueryOwner() *AlertQuery { // First returns the first Meta entity from the query. // Returns a *NotFoundError when no Meta was found. -func (mq *MetaQuery) First(ctx context.Context) (*Meta, error) { - nodes, err := mq.Limit(1).All(setContextOp(ctx, mq.ctx, ent.OpQueryFirst)) +func (_q *MetaQuery) First(ctx context.Context) (*Meta, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -96,8 +96,8 @@ func (mq *MetaQuery) First(ctx context.Context) (*Meta, error) { } // FirstX is like First, but panics if an error occurs. -func (mq *MetaQuery) FirstX(ctx context.Context) *Meta { - node, err := mq.First(ctx) +func (_q *MetaQuery) FirstX(ctx context.Context) *Meta { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -106,9 +106,9 @@ func (mq *MetaQuery) FirstX(ctx context.Context) *Meta { // FirstID returns the first Meta ID from the query. // Returns a *NotFoundError when no Meta ID was found. -func (mq *MetaQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *MetaQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(1).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -119,8 +119,8 @@ func (mq *MetaQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (mq *MetaQuery) FirstIDX(ctx context.Context) int { - id, err := mq.FirstID(ctx) +func (_q *MetaQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -130,8 +130,8 @@ func (mq *MetaQuery) FirstIDX(ctx context.Context) int { // Only returns a single Meta entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Meta entity is found. // Returns a *NotFoundError when no Meta entities are found. -func (mq *MetaQuery) Only(ctx context.Context) (*Meta, error) { - nodes, err := mq.Limit(2).All(setContextOp(ctx, mq.ctx, ent.OpQueryOnly)) +func (_q *MetaQuery) Only(ctx context.Context) (*Meta, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -146,8 +146,8 @@ func (mq *MetaQuery) Only(ctx context.Context) (*Meta, error) { } // OnlyX is like Only, but panics if an error occurs. -func (mq *MetaQuery) OnlyX(ctx context.Context) *Meta { - node, err := mq.Only(ctx) +func (_q *MetaQuery) OnlyX(ctx context.Context) *Meta { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -157,9 +157,9 @@ func (mq *MetaQuery) OnlyX(ctx context.Context) *Meta { // OnlyID is like Only, but returns the only Meta ID in the query. // Returns a *NotSingularError when more than one Meta ID is found. // Returns a *NotFoundError when no entities are found. -func (mq *MetaQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *MetaQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(2).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -174,8 +174,8 @@ func (mq *MetaQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (mq *MetaQuery) OnlyIDX(ctx context.Context) int { - id, err := mq.OnlyID(ctx) +func (_q *MetaQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -183,18 +183,18 @@ func (mq *MetaQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of MetaSlice. -func (mq *MetaQuery) All(ctx context.Context) ([]*Meta, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryAll) - if err := mq.prepareQuery(ctx); err != nil { +func (_q *MetaQuery) All(ctx context.Context) ([]*Meta, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Meta, *MetaQuery]() - return withInterceptors[[]*Meta](ctx, mq, qr, mq.inters) + return withInterceptors[[]*Meta](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (mq *MetaQuery) AllX(ctx context.Context) []*Meta { - nodes, err := mq.All(ctx) +func (_q *MetaQuery) AllX(ctx context.Context) []*Meta { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -202,20 +202,20 @@ func (mq *MetaQuery) AllX(ctx context.Context) []*Meta { } // IDs executes the query and returns a list of Meta IDs. -func (mq *MetaQuery) IDs(ctx context.Context) (ids []int, err error) { - if mq.ctx.Unique == nil && mq.path != nil { - mq.Unique(true) +func (_q *MetaQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryIDs) - if err = mq.Select(meta.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(meta.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (mq *MetaQuery) IDsX(ctx context.Context) []int { - ids, err := mq.IDs(ctx) +func (_q *MetaQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -223,17 +223,17 @@ func (mq *MetaQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (mq *MetaQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryCount) - if err := mq.prepareQuery(ctx); err != nil { +func (_q *MetaQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, mq, querierCount[*MetaQuery](), mq.inters) + return withInterceptors[int](ctx, _q, querierCount[*MetaQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (mq *MetaQuery) CountX(ctx context.Context) int { - count, err := mq.Count(ctx) +func (_q *MetaQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -241,9 +241,9 @@ func (mq *MetaQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (mq *MetaQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryExist) - switch _, err := mq.FirstID(ctx); { +func (_q *MetaQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -254,8 +254,8 @@ func (mq *MetaQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (mq *MetaQuery) ExistX(ctx context.Context) bool { - exist, err := mq.Exist(ctx) +func (_q *MetaQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -264,32 +264,32 @@ func (mq *MetaQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the MetaQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (mq *MetaQuery) Clone() *MetaQuery { - if mq == nil { +func (_q *MetaQuery) Clone() *MetaQuery { + if _q == nil { return nil } return &MetaQuery{ - config: mq.config, - ctx: mq.ctx.Clone(), - order: append([]meta.OrderOption{}, mq.order...), - inters: append([]Interceptor{}, mq.inters...), - predicates: append([]predicate.Meta{}, mq.predicates...), - withOwner: mq.withOwner.Clone(), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]meta.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Meta{}, _q.predicates...), + withOwner: _q.withOwner.Clone(), // clone intermediate query. - sql: mq.sql.Clone(), - path: mq.path, + sql: _q.sql.Clone(), + path: _q.path, } } // WithOwner tells the query-builder to eager-load the nodes that are connected to // the "owner" edge. The optional arguments are used to configure the query builder of the edge. -func (mq *MetaQuery) WithOwner(opts ...func(*AlertQuery)) *MetaQuery { - query := (&AlertClient{config: mq.config}).Query() +func (_q *MetaQuery) WithOwner(opts ...func(*AlertQuery)) *MetaQuery { + query := (&AlertClient{config: _q.config}).Query() for _, opt := range opts { opt(query) } - mq.withOwner = query - return mq + _q.withOwner = query + return _q } // GroupBy is used to group vertices by one or more fields/columns. @@ -306,10 +306,10 @@ func (mq *MetaQuery) WithOwner(opts ...func(*AlertQuery)) *MetaQuery { // GroupBy(meta.FieldCreatedAt). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (mq *MetaQuery) GroupBy(field string, fields ...string) *MetaGroupBy { - mq.ctx.Fields = append([]string{field}, fields...) - grbuild := &MetaGroupBy{build: mq} - grbuild.flds = &mq.ctx.Fields +func (_q *MetaQuery) GroupBy(field string, fields ...string) *MetaGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &MetaGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = meta.Label grbuild.scan = grbuild.Scan return grbuild @@ -327,58 +327,58 @@ func (mq *MetaQuery) GroupBy(field string, fields ...string) *MetaGroupBy { // client.Meta.Query(). // Select(meta.FieldCreatedAt). // Scan(ctx, &v) -func (mq *MetaQuery) Select(fields ...string) *MetaSelect { - mq.ctx.Fields = append(mq.ctx.Fields, fields...) - sbuild := &MetaSelect{MetaQuery: mq} +func (_q *MetaQuery) Select(fields ...string) *MetaSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &MetaSelect{MetaQuery: _q} sbuild.label = meta.Label - sbuild.flds, sbuild.scan = &mq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a MetaSelect configured with the given aggregations. -func (mq *MetaQuery) Aggregate(fns ...AggregateFunc) *MetaSelect { - return mq.Select().Aggregate(fns...) +func (_q *MetaQuery) Aggregate(fns ...AggregateFunc) *MetaSelect { + return _q.Select().Aggregate(fns...) } -func (mq *MetaQuery) prepareQuery(ctx context.Context) error { - for _, inter := range mq.inters { +func (_q *MetaQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, mq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range mq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !meta.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if mq.path != nil { - prev, err := mq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - mq.sql = prev + _q.sql = prev } return nil } -func (mq *MetaQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Meta, error) { +func (_q *MetaQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Meta, error) { var ( nodes = []*Meta{} - _spec = mq.querySpec() + _spec = _q.querySpec() loadedTypes = [1]bool{ - mq.withOwner != nil, + _q.withOwner != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Meta).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Meta{config: mq.config} + node := &Meta{config: _q.config} nodes = append(nodes, node) node.Edges.loadedTypes = loadedTypes return node.assignValues(columns, values) @@ -386,14 +386,14 @@ func (mq *MetaQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Meta, e for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, mq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { return nodes, nil } - if query := mq.withOwner; query != nil { - if err := mq.loadOwner(ctx, query, nodes, nil, + if query := _q.withOwner; query != nil { + if err := _q.loadOwner(ctx, query, nodes, nil, func(n *Meta, e *Alert) { n.Edges.Owner = e }); err != nil { return nil, err } @@ -401,7 +401,7 @@ func (mq *MetaQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Meta, e return nodes, nil } -func (mq *MetaQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []*Meta, init func(*Meta), assign func(*Meta, *Alert)) error { +func (_q *MetaQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []*Meta, init func(*Meta), assign func(*Meta, *Alert)) error { ids := make([]int, 0, len(nodes)) nodeids := make(map[int][]*Meta) for i := range nodes { @@ -431,24 +431,24 @@ func (mq *MetaQuery) loadOwner(ctx context.Context, query *AlertQuery, nodes []* return nil } -func (mq *MetaQuery) sqlCount(ctx context.Context) (int, error) { - _spec := mq.querySpec() - _spec.Node.Columns = mq.ctx.Fields - if len(mq.ctx.Fields) > 0 { - _spec.Unique = mq.ctx.Unique != nil && *mq.ctx.Unique +func (_q *MetaQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, mq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (mq *MetaQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *MetaQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(meta.Table, meta.Columns, sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt)) - _spec.From = mq.sql - if unique := mq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if mq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := mq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, meta.FieldID) for i := range fields { @@ -456,24 +456,24 @@ func (mq *MetaQuery) querySpec() *sqlgraph.QuerySpec { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } - if mq.withOwner != nil { + if _q.withOwner != nil { _spec.Node.AddColumnOnce(meta.FieldAlertMetas) } } - if ps := mq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := mq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := mq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := mq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -483,33 +483,33 @@ func (mq *MetaQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (mq *MetaQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(mq.driver.Dialect()) +func (_q *MetaQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(meta.Table) - columns := mq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = meta.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if mq.sql != nil { - selector = mq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if mq.ctx.Unique != nil && *mq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range mq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range mq.order { + for _, p := range _q.order { p(selector) } - if offset := mq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := mq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -522,41 +522,41 @@ type MetaGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (mgb *MetaGroupBy) Aggregate(fns ...AggregateFunc) *MetaGroupBy { - mgb.fns = append(mgb.fns, fns...) - return mgb +func (_g *MetaGroupBy) Aggregate(fns ...AggregateFunc) *MetaGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (mgb *MetaGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, mgb.build.ctx, ent.OpQueryGroupBy) - if err := mgb.build.prepareQuery(ctx); err != nil { +func (_g *MetaGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MetaQuery, *MetaGroupBy](ctx, mgb.build, mgb, mgb.build.inters, v) + return scanWithInterceptors[*MetaQuery, *MetaGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (mgb *MetaGroupBy) sqlScan(ctx context.Context, root *MetaQuery, v any) error { +func (_g *MetaGroupBy) sqlScan(ctx context.Context, root *MetaQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(mgb.fns)) - for _, fn := range mgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*mgb.flds)+len(mgb.fns)) - for _, f := range *mgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*mgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := mgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -570,27 +570,27 @@ type MetaSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ms *MetaSelect) Aggregate(fns ...AggregateFunc) *MetaSelect { - ms.fns = append(ms.fns, fns...) - return ms +func (_s *MetaSelect) Aggregate(fns ...AggregateFunc) *MetaSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ms *MetaSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ms.ctx, ent.OpQuerySelect) - if err := ms.prepareQuery(ctx); err != nil { +func (_s *MetaSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MetaQuery, *MetaSelect](ctx, ms.MetaQuery, ms, ms.inters, v) + return scanWithInterceptors[*MetaQuery, *MetaSelect](ctx, _s.MetaQuery, _s, _s.inters, v) } -func (ms *MetaSelect) sqlScan(ctx context.Context, root *MetaQuery, v any) error { +func (_s *MetaSelect) sqlScan(ctx context.Context, root *MetaQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ms.fns)) - for _, fn := range ms.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ms.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -598,7 +598,7 @@ func (ms *MetaSelect) sqlScan(ctx context.Context, root *MetaQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ms.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/meta_update.go b/pkg/database/ent/meta_update.go index bdf622eb6..c1deee317 100644 --- a/pkg/database/ent/meta_update.go +++ b/pkg/database/ent/meta_update.go @@ -24,76 +24,76 @@ type MetaUpdate struct { } // Where appends a list predicates to the MetaUpdate builder. -func (mu *MetaUpdate) Where(ps ...predicate.Meta) *MetaUpdate { - mu.mutation.Where(ps...) - return mu +func (_u *MetaUpdate) Where(ps ...predicate.Meta) *MetaUpdate { + _u.mutation.Where(ps...) + return _u } // SetUpdatedAt sets the "updated_at" field. -func (mu *MetaUpdate) SetUpdatedAt(t time.Time) *MetaUpdate { - mu.mutation.SetUpdatedAt(t) - return mu +func (_u *MetaUpdate) SetUpdatedAt(v time.Time) *MetaUpdate { + _u.mutation.SetUpdatedAt(v) + return _u } // SetAlertMetas sets the "alert_metas" field. -func (mu *MetaUpdate) SetAlertMetas(i int) *MetaUpdate { - mu.mutation.SetAlertMetas(i) - return mu +func (_u *MetaUpdate) SetAlertMetas(v int) *MetaUpdate { + _u.mutation.SetAlertMetas(v) + return _u } // SetNillableAlertMetas sets the "alert_metas" field if the given value is not nil. -func (mu *MetaUpdate) SetNillableAlertMetas(i *int) *MetaUpdate { - if i != nil { - mu.SetAlertMetas(*i) +func (_u *MetaUpdate) SetNillableAlertMetas(v *int) *MetaUpdate { + if v != nil { + _u.SetAlertMetas(*v) } - return mu + return _u } // ClearAlertMetas clears the value of the "alert_metas" field. -func (mu *MetaUpdate) ClearAlertMetas() *MetaUpdate { - mu.mutation.ClearAlertMetas() - return mu +func (_u *MetaUpdate) ClearAlertMetas() *MetaUpdate { + _u.mutation.ClearAlertMetas() + return _u } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (mu *MetaUpdate) SetOwnerID(id int) *MetaUpdate { - mu.mutation.SetOwnerID(id) - return mu +func (_u *MetaUpdate) SetOwnerID(id int) *MetaUpdate { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (mu *MetaUpdate) SetNillableOwnerID(id *int) *MetaUpdate { +func (_u *MetaUpdate) SetNillableOwnerID(id *int) *MetaUpdate { if id != nil { - mu = mu.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return mu + return _u } // SetOwner sets the "owner" edge to the Alert entity. -func (mu *MetaUpdate) SetOwner(a *Alert) *MetaUpdate { - return mu.SetOwnerID(a.ID) +func (_u *MetaUpdate) SetOwner(v *Alert) *MetaUpdate { + return _u.SetOwnerID(v.ID) } // Mutation returns the MetaMutation object of the builder. -func (mu *MetaUpdate) Mutation() *MetaMutation { - return mu.mutation +func (_u *MetaUpdate) Mutation() *MetaMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Alert entity. -func (mu *MetaUpdate) ClearOwner() *MetaUpdate { - mu.mutation.ClearOwner() - return mu +func (_u *MetaUpdate) ClearOwner() *MetaUpdate { + _u.mutation.ClearOwner() + return _u } // Save executes the query and returns the number of nodes affected by the update operation. -func (mu *MetaUpdate) Save(ctx context.Context) (int, error) { - mu.defaults() - return withHooks(ctx, mu.sqlSave, mu.mutation, mu.hooks) +func (_u *MetaUpdate) Save(ctx context.Context) (int, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (mu *MetaUpdate) SaveX(ctx context.Context) int { - affected, err := mu.Save(ctx) +func (_u *MetaUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -101,39 +101,39 @@ func (mu *MetaUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (mu *MetaUpdate) Exec(ctx context.Context) error { - _, err := mu.Save(ctx) +func (_u *MetaUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mu *MetaUpdate) ExecX(ctx context.Context) { - if err := mu.Exec(ctx); err != nil { +func (_u *MetaUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (mu *MetaUpdate) defaults() { - if _, ok := mu.mutation.UpdatedAt(); !ok { +func (_u *MetaUpdate) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := meta.UpdateDefaultUpdatedAt() - mu.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (mu *MetaUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *MetaUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(meta.Table, meta.Columns, sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt)) - if ps := mu.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 := mu.mutation.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(meta.FieldUpdatedAt, field.TypeTime, value) } - if mu.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -146,7 +146,7 @@ func (mu *MetaUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := mu.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -162,7 +162,7 @@ func (mu *MetaUpdate) 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 { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{meta.Label} } else if sqlgraph.IsConstraintError(err) { @@ -170,8 +170,8 @@ func (mu *MetaUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - mu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // MetaUpdateOne is the builder for updating a single Meta entity. @@ -183,83 +183,83 @@ type MetaUpdateOne struct { } // SetUpdatedAt sets the "updated_at" field. -func (muo *MetaUpdateOne) SetUpdatedAt(t time.Time) *MetaUpdateOne { - muo.mutation.SetUpdatedAt(t) - return muo +func (_u *MetaUpdateOne) SetUpdatedAt(v time.Time) *MetaUpdateOne { + _u.mutation.SetUpdatedAt(v) + return _u } // SetAlertMetas sets the "alert_metas" field. -func (muo *MetaUpdateOne) SetAlertMetas(i int) *MetaUpdateOne { - muo.mutation.SetAlertMetas(i) - return muo +func (_u *MetaUpdateOne) SetAlertMetas(v int) *MetaUpdateOne { + _u.mutation.SetAlertMetas(v) + return _u } // SetNillableAlertMetas sets the "alert_metas" field if the given value is not nil. -func (muo *MetaUpdateOne) SetNillableAlertMetas(i *int) *MetaUpdateOne { - if i != nil { - muo.SetAlertMetas(*i) +func (_u *MetaUpdateOne) SetNillableAlertMetas(v *int) *MetaUpdateOne { + if v != nil { + _u.SetAlertMetas(*v) } - return muo + return _u } // ClearAlertMetas clears the value of the "alert_metas" field. -func (muo *MetaUpdateOne) ClearAlertMetas() *MetaUpdateOne { - muo.mutation.ClearAlertMetas() - return muo +func (_u *MetaUpdateOne) ClearAlertMetas() *MetaUpdateOne { + _u.mutation.ClearAlertMetas() + return _u } // SetOwnerID sets the "owner" edge to the Alert entity by ID. -func (muo *MetaUpdateOne) SetOwnerID(id int) *MetaUpdateOne { - muo.mutation.SetOwnerID(id) - return muo +func (_u *MetaUpdateOne) SetOwnerID(id int) *MetaUpdateOne { + _u.mutation.SetOwnerID(id) + return _u } // SetNillableOwnerID sets the "owner" edge to the Alert entity by ID if the given value is not nil. -func (muo *MetaUpdateOne) SetNillableOwnerID(id *int) *MetaUpdateOne { +func (_u *MetaUpdateOne) SetNillableOwnerID(id *int) *MetaUpdateOne { if id != nil { - muo = muo.SetOwnerID(*id) + _u = _u.SetOwnerID(*id) } - return muo + return _u } // SetOwner sets the "owner" edge to the Alert entity. -func (muo *MetaUpdateOne) SetOwner(a *Alert) *MetaUpdateOne { - return muo.SetOwnerID(a.ID) +func (_u *MetaUpdateOne) SetOwner(v *Alert) *MetaUpdateOne { + return _u.SetOwnerID(v.ID) } // Mutation returns the MetaMutation object of the builder. -func (muo *MetaUpdateOne) Mutation() *MetaMutation { - return muo.mutation +func (_u *MetaUpdateOne) Mutation() *MetaMutation { + return _u.mutation } // ClearOwner clears the "owner" edge to the Alert entity. -func (muo *MetaUpdateOne) ClearOwner() *MetaUpdateOne { - muo.mutation.ClearOwner() - return muo +func (_u *MetaUpdateOne) ClearOwner() *MetaUpdateOne { + _u.mutation.ClearOwner() + return _u } // Where appends a list predicates to the MetaUpdate builder. -func (muo *MetaUpdateOne) Where(ps ...predicate.Meta) *MetaUpdateOne { - muo.mutation.Where(ps...) - return muo +func (_u *MetaUpdateOne) Where(ps ...predicate.Meta) *MetaUpdateOne { + _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 *MetaUpdateOne) Select(field string, fields ...string) *MetaUpdateOne { - muo.fields = append([]string{field}, fields...) - return muo +func (_u *MetaUpdateOne) Select(field string, fields ...string) *MetaUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Meta entity. -func (muo *MetaUpdateOne) Save(ctx context.Context) (*Meta, error) { - muo.defaults() - return withHooks(ctx, muo.sqlSave, muo.mutation, muo.hooks) +func (_u *MetaUpdateOne) Save(ctx context.Context) (*Meta, error) { + _u.defaults() + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (muo *MetaUpdateOne) SaveX(ctx context.Context) *Meta { - node, err := muo.Save(ctx) +func (_u *MetaUpdateOne) SaveX(ctx context.Context) *Meta { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -267,34 +267,34 @@ func (muo *MetaUpdateOne) SaveX(ctx context.Context) *Meta { } // Exec executes the query on the entity. -func (muo *MetaUpdateOne) Exec(ctx context.Context) error { - _, err := muo.Save(ctx) +func (_u *MetaUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (muo *MetaUpdateOne) ExecX(ctx context.Context) { - if err := muo.Exec(ctx); err != nil { +func (_u *MetaUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } // defaults sets the default values of the builder before save. -func (muo *MetaUpdateOne) defaults() { - if _, ok := muo.mutation.UpdatedAt(); !ok { +func (_u *MetaUpdateOne) defaults() { + if _, ok := _u.mutation.UpdatedAt(); !ok { v := meta.UpdateDefaultUpdatedAt() - muo.mutation.SetUpdatedAt(v) + _u.mutation.SetUpdatedAt(v) } } -func (muo *MetaUpdateOne) sqlSave(ctx context.Context) (_node *Meta, err error) { +func (_u *MetaUpdateOne) sqlSave(ctx context.Context) (_node *Meta, err error) { _spec := sqlgraph.NewUpdateSpec(meta.Table, meta.Columns, sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt)) - id, ok := muo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Meta.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, meta.FieldID) for _, f := range fields { @@ -306,17 +306,17 @@ func (muo *MetaUpdateOne) sqlSave(ctx context.Context) (_node *Meta, err error) } } } - 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.UpdatedAt(); ok { + if value, ok := _u.mutation.UpdatedAt(); ok { _spec.SetField(meta.FieldUpdatedAt, field.TypeTime, value) } - if muo.mutation.OwnerCleared() { + if _u.mutation.OwnerCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -329,7 +329,7 @@ func (muo *MetaUpdateOne) sqlSave(ctx context.Context) (_node *Meta, err error) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := muo.mutation.OwnerIDs(); len(nodes) > 0 { + if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, @@ -345,10 +345,10 @@ func (muo *MetaUpdateOne) sqlSave(ctx context.Context) (_node *Meta, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - _node = &Meta{config: muo.config} + _node = &Meta{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{meta.Label} } else if sqlgraph.IsConstraintError(err) { @@ -356,6 +356,6 @@ func (muo *MetaUpdateOne) sqlSave(ctx context.Context) (_node *Meta, err error) } return nil, err } - muo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/metric.go b/pkg/database/ent/metric.go index 47f3b4df4..a666aed8d 100644 --- a/pkg/database/ent/metric.go +++ b/pkg/database/ent/metric.go @@ -51,7 +51,7 @@ func (*Metric) scanValues(columns []string) ([]any, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Metric fields. -func (m *Metric) assignValues(columns []string, values []any) error { +func (_m *Metric) 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) } @@ -62,40 +62,40 @@ func (m *Metric) assignValues(columns []string, values []any) error { if !ok { return fmt.Errorf("unexpected type %T for field id", value) } - m.ID = int(value.Int64) + _m.ID = int(value.Int64) case metric.FieldGeneratedType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field generated_type", values[i]) } else if value.Valid { - m.GeneratedType = metric.GeneratedType(value.String) + _m.GeneratedType = metric.GeneratedType(value.String) } case metric.FieldGeneratedBy: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field generated_by", values[i]) } else if value.Valid { - m.GeneratedBy = value.String + _m.GeneratedBy = value.String } case metric.FieldReceivedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field received_at", values[i]) } else if value.Valid { - m.ReceivedAt = value.Time + _m.ReceivedAt = value.Time } case metric.FieldPushedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field pushed_at", values[i]) } else if value.Valid { - m.PushedAt = new(time.Time) - *m.PushedAt = value.Time + _m.PushedAt = new(time.Time) + *_m.PushedAt = value.Time } case metric.FieldPayload: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field payload", values[i]) } else if value.Valid { - m.Payload = value.String + _m.Payload = value.String } default: - m.selectValues.Set(columns[i], values[i]) + _m.selectValues.Set(columns[i], values[i]) } } return nil @@ -103,49 +103,49 @@ func (m *Metric) assignValues(columns []string, values []any) error { // Value returns the ent.Value that was dynamically selected and assigned to the Metric. // This includes values selected through modifiers, order, etc. -func (m *Metric) Value(name string) (ent.Value, error) { - return m.selectValues.Get(name) +func (_m *Metric) Value(name string) (ent.Value, error) { + return _m.selectValues.Get(name) } // Update returns a builder for updating this Metric. // Note that you need to call Metric.Unwrap() before calling this method if this Metric // was returned from a transaction, and the transaction was committed or rolled back. -func (m *Metric) Update() *MetricUpdateOne { - return NewMetricClient(m.config).UpdateOne(m) +func (_m *Metric) Update() *MetricUpdateOne { + return NewMetricClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Metric 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 *Metric) Unwrap() *Metric { - _tx, ok := m.config.driver.(*txDriver) +func (_m *Metric) Unwrap() *Metric { + _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Metric 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 *Metric) String() string { +func (_m *Metric) String() string { var builder strings.Builder builder.WriteString("Metric(") - builder.WriteString(fmt.Sprintf("id=%v, ", m.ID)) + builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("generated_type=") - builder.WriteString(fmt.Sprintf("%v", m.GeneratedType)) + builder.WriteString(fmt.Sprintf("%v", _m.GeneratedType)) builder.WriteString(", ") builder.WriteString("generated_by=") - builder.WriteString(m.GeneratedBy) + builder.WriteString(_m.GeneratedBy) builder.WriteString(", ") builder.WriteString("received_at=") - builder.WriteString(m.ReceivedAt.Format(time.ANSIC)) + builder.WriteString(_m.ReceivedAt.Format(time.ANSIC)) builder.WriteString(", ") - if v := m.PushedAt; v != nil { + if v := _m.PushedAt; v != nil { builder.WriteString("pushed_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("payload=") - builder.WriteString(m.Payload) + builder.WriteString(_m.Payload) builder.WriteByte(')') return builder.String() } diff --git a/pkg/database/ent/metric_create.go b/pkg/database/ent/metric_create.go index b8ac55535..ea57b3626 100644 --- a/pkg/database/ent/metric_create.go +++ b/pkg/database/ent/metric_create.go @@ -23,56 +23,56 @@ type MetricCreate struct { } // SetGeneratedType sets the "generated_type" field. -func (mc *MetricCreate) SetGeneratedType(mt metric.GeneratedType) *MetricCreate { - mc.mutation.SetGeneratedType(mt) - return mc +func (_c *MetricCreate) SetGeneratedType(v metric.GeneratedType) *MetricCreate { + _c.mutation.SetGeneratedType(v) + return _c } // SetGeneratedBy sets the "generated_by" field. -func (mc *MetricCreate) SetGeneratedBy(s string) *MetricCreate { - mc.mutation.SetGeneratedBy(s) - return mc +func (_c *MetricCreate) SetGeneratedBy(v string) *MetricCreate { + _c.mutation.SetGeneratedBy(v) + return _c } // SetReceivedAt sets the "received_at" field. -func (mc *MetricCreate) SetReceivedAt(t time.Time) *MetricCreate { - mc.mutation.SetReceivedAt(t) - return mc +func (_c *MetricCreate) SetReceivedAt(v time.Time) *MetricCreate { + _c.mutation.SetReceivedAt(v) + return _c } // SetPushedAt sets the "pushed_at" field. -func (mc *MetricCreate) SetPushedAt(t time.Time) *MetricCreate { - mc.mutation.SetPushedAt(t) - return mc +func (_c *MetricCreate) SetPushedAt(v time.Time) *MetricCreate { + _c.mutation.SetPushedAt(v) + return _c } // SetNillablePushedAt sets the "pushed_at" field if the given value is not nil. -func (mc *MetricCreate) SetNillablePushedAt(t *time.Time) *MetricCreate { - if t != nil { - mc.SetPushedAt(*t) +func (_c *MetricCreate) SetNillablePushedAt(v *time.Time) *MetricCreate { + if v != nil { + _c.SetPushedAt(*v) } - return mc + return _c } // SetPayload sets the "payload" field. -func (mc *MetricCreate) SetPayload(s string) *MetricCreate { - mc.mutation.SetPayload(s) - return mc +func (_c *MetricCreate) SetPayload(v string) *MetricCreate { + _c.mutation.SetPayload(v) + return _c } // Mutation returns the MetricMutation object of the builder. -func (mc *MetricCreate) Mutation() *MetricMutation { - return mc.mutation +func (_c *MetricCreate) Mutation() *MetricMutation { + return _c.mutation } // Save creates the Metric in the database. -func (mc *MetricCreate) Save(ctx context.Context) (*Metric, error) { - return withHooks(ctx, mc.sqlSave, mc.mutation, mc.hooks) +func (_c *MetricCreate) Save(ctx context.Context) (*Metric, error) { + return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) } // SaveX calls Save and panics if Save returns an error. -func (mc *MetricCreate) SaveX(ctx context.Context) *Metric { - v, err := mc.Save(ctx) +func (_c *MetricCreate) SaveX(ctx context.Context) *Metric { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -80,46 +80,46 @@ func (mc *MetricCreate) SaveX(ctx context.Context) *Metric { } // Exec executes the query. -func (mc *MetricCreate) Exec(ctx context.Context) error { - _, err := mc.Save(ctx) +func (_c *MetricCreate) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mc *MetricCreate) ExecX(ctx context.Context) { - if err := mc.Exec(ctx); err != nil { +func (_c *MetricCreate) 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 *MetricCreate) check() error { - if _, ok := mc.mutation.GeneratedType(); !ok { +func (_c *MetricCreate) check() error { + if _, ok := _c.mutation.GeneratedType(); !ok { return &ValidationError{Name: "generated_type", err: errors.New(`ent: missing required field "Metric.generated_type"`)} } - if v, ok := mc.mutation.GeneratedType(); ok { + if v, ok := _c.mutation.GeneratedType(); ok { if err := metric.GeneratedTypeValidator(v); err != nil { return &ValidationError{Name: "generated_type", err: fmt.Errorf(`ent: validator failed for field "Metric.generated_type": %w`, err)} } } - if _, ok := mc.mutation.GeneratedBy(); !ok { + if _, ok := _c.mutation.GeneratedBy(); !ok { return &ValidationError{Name: "generated_by", err: errors.New(`ent: missing required field "Metric.generated_by"`)} } - if _, ok := mc.mutation.ReceivedAt(); !ok { + if _, ok := _c.mutation.ReceivedAt(); !ok { return &ValidationError{Name: "received_at", err: errors.New(`ent: missing required field "Metric.received_at"`)} } - if _, ok := mc.mutation.Payload(); !ok { + if _, ok := _c.mutation.Payload(); !ok { return &ValidationError{Name: "payload", err: errors.New(`ent: missing required field "Metric.payload"`)} } return nil } -func (mc *MetricCreate) sqlSave(ctx context.Context) (*Metric, error) { - if err := mc.check(); err != nil { +func (_c *MetricCreate) sqlSave(ctx context.Context) (*Metric, error) { + if err := _c.check(); err != nil { return nil, err } - _node, _spec := mc.createSpec() - if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil { + _node, _spec := _c.createSpec() + if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } @@ -127,34 +127,34 @@ func (mc *MetricCreate) sqlSave(ctx context.Context) (*Metric, error) { } id := _spec.ID.Value.(int64) _node.ID = int(id) - mc.mutation.id = &_node.ID - mc.mutation.done = true + _c.mutation.id = &_node.ID + _c.mutation.done = true return _node, nil } -func (mc *MetricCreate) createSpec() (*Metric, *sqlgraph.CreateSpec) { +func (_c *MetricCreate) createSpec() (*Metric, *sqlgraph.CreateSpec) { var ( - _node = &Metric{config: mc.config} + _node = &Metric{config: _c.config} _spec = sqlgraph.NewCreateSpec(metric.Table, sqlgraph.NewFieldSpec(metric.FieldID, field.TypeInt)) ) - _spec.OnConflict = mc.conflict - if value, ok := mc.mutation.GeneratedType(); ok { + _spec.OnConflict = _c.conflict + if value, ok := _c.mutation.GeneratedType(); ok { _spec.SetField(metric.FieldGeneratedType, field.TypeEnum, value) _node.GeneratedType = value } - if value, ok := mc.mutation.GeneratedBy(); ok { + if value, ok := _c.mutation.GeneratedBy(); ok { _spec.SetField(metric.FieldGeneratedBy, field.TypeString, value) _node.GeneratedBy = value } - if value, ok := mc.mutation.ReceivedAt(); ok { + if value, ok := _c.mutation.ReceivedAt(); ok { _spec.SetField(metric.FieldReceivedAt, field.TypeTime, value) _node.ReceivedAt = value } - if value, ok := mc.mutation.PushedAt(); ok { + if value, ok := _c.mutation.PushedAt(); ok { _spec.SetField(metric.FieldPushedAt, field.TypeTime, value) _node.PushedAt = &value } - if value, ok := mc.mutation.Payload(); ok { + if value, ok := _c.mutation.Payload(); ok { _spec.SetField(metric.FieldPayload, field.TypeString, value) _node.Payload = value } @@ -177,10 +177,10 @@ func (mc *MetricCreate) createSpec() (*Metric, *sqlgraph.CreateSpec) { // SetGeneratedType(v+v). // }). // Exec(ctx) -func (mc *MetricCreate) OnConflict(opts ...sql.ConflictOption) *MetricUpsertOne { - mc.conflict = opts +func (_c *MetricCreate) OnConflict(opts ...sql.ConflictOption) *MetricUpsertOne { + _c.conflict = opts return &MetricUpsertOne{ - create: mc, + create: _c, } } @@ -190,10 +190,10 @@ func (mc *MetricCreate) OnConflict(opts ...sql.ConflictOption) *MetricUpsertOne // client.Metric.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (mc *MetricCreate) OnConflictColumns(columns ...string) *MetricUpsertOne { - mc.conflict = append(mc.conflict, sql.ConflictColumns(columns...)) +func (_c *MetricCreate) OnConflictColumns(columns ...string) *MetricUpsertOne { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &MetricUpsertOne{ - create: mc, + create: _c, } } @@ -345,16 +345,16 @@ type MetricCreateBulk struct { } // Save creates the Metric entities in the database. -func (mcb *MetricCreateBulk) Save(ctx context.Context) ([]*Metric, error) { - if mcb.err != nil { - return nil, mcb.err +func (_c *MetricCreateBulk) Save(ctx context.Context) ([]*Metric, error) { + if _c.err != nil { + return nil, _c.err } - specs := make([]*sqlgraph.CreateSpec, len(mcb.builders)) - nodes := make([]*Metric, len(mcb.builders)) - mutators := make([]Mutator, len(mcb.builders)) - for i := range mcb.builders { + specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) + nodes := make([]*Metric, 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.(*MetricMutation) if !ok { @@ -367,12 +367,12 @@ func (mcb *MetricCreateBulk) Save(ctx context.Context) ([]*Metric, error) { 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} - spec.OnConflict = mcb.conflict + spec.OnConflict = _c.conflict // 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{msg: err.Error(), wrap: err} } @@ -396,7 +396,7 @@ func (mcb *MetricCreateBulk) Save(ctx context.Context) ([]*Metric, 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 } } @@ -404,8 +404,8 @@ func (mcb *MetricCreateBulk) Save(ctx context.Context) ([]*Metric, error) { } // SaveX is like Save, but panics if an error occurs. -func (mcb *MetricCreateBulk) SaveX(ctx context.Context) []*Metric { - v, err := mcb.Save(ctx) +func (_c *MetricCreateBulk) SaveX(ctx context.Context) []*Metric { + v, err := _c.Save(ctx) if err != nil { panic(err) } @@ -413,14 +413,14 @@ func (mcb *MetricCreateBulk) SaveX(ctx context.Context) []*Metric { } // Exec executes the query. -func (mcb *MetricCreateBulk) Exec(ctx context.Context) error { - _, err := mcb.Save(ctx) +func (_c *MetricCreateBulk) Exec(ctx context.Context) error { + _, err := _c.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mcb *MetricCreateBulk) ExecX(ctx context.Context) { - if err := mcb.Exec(ctx); err != nil { +func (_c *MetricCreateBulk) ExecX(ctx context.Context) { + if err := _c.Exec(ctx); err != nil { panic(err) } } @@ -440,10 +440,10 @@ func (mcb *MetricCreateBulk) ExecX(ctx context.Context) { // SetGeneratedType(v+v). // }). // Exec(ctx) -func (mcb *MetricCreateBulk) OnConflict(opts ...sql.ConflictOption) *MetricUpsertBulk { - mcb.conflict = opts +func (_c *MetricCreateBulk) OnConflict(opts ...sql.ConflictOption) *MetricUpsertBulk { + _c.conflict = opts return &MetricUpsertBulk{ - create: mcb, + create: _c, } } @@ -453,10 +453,10 @@ func (mcb *MetricCreateBulk) OnConflict(opts ...sql.ConflictOption) *MetricUpser // client.Metric.Create(). // OnConflict(sql.ConflictColumns(columns...)). // Exec(ctx) -func (mcb *MetricCreateBulk) OnConflictColumns(columns ...string) *MetricUpsertBulk { - mcb.conflict = append(mcb.conflict, sql.ConflictColumns(columns...)) +func (_c *MetricCreateBulk) OnConflictColumns(columns ...string) *MetricUpsertBulk { + _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...)) return &MetricUpsertBulk{ - create: mcb, + create: _c, } } diff --git a/pkg/database/ent/metric_delete.go b/pkg/database/ent/metric_delete.go index d6606680a..46835c3bc 100644 --- a/pkg/database/ent/metric_delete.go +++ b/pkg/database/ent/metric_delete.go @@ -20,56 +20,56 @@ type MetricDelete struct { } // Where appends a list predicates to the MetricDelete builder. -func (md *MetricDelete) Where(ps ...predicate.Metric) *MetricDelete { - md.mutation.Where(ps...) - return md +func (_d *MetricDelete) Where(ps ...predicate.Metric) *MetricDelete { + _d.mutation.Where(ps...) + return _d } // Exec executes the deletion query and returns how many vertices were deleted. -func (md *MetricDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, md.sqlExec, md.mutation, md.hooks) +func (_d *MetricDelete) 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 *MetricDelete) ExecX(ctx context.Context) int { - n, err := md.Exec(ctx) +func (_d *MetricDelete) ExecX(ctx context.Context) int { + n, err := _d.Exec(ctx) if err != nil { panic(err) } return n } -func (md *MetricDelete) sqlExec(ctx context.Context) (int, error) { +func (_d *MetricDelete) sqlExec(ctx context.Context) (int, error) { _spec := sqlgraph.NewDeleteSpec(metric.Table, sqlgraph.NewFieldSpec(metric.FieldID, field.TypeInt)) - if ps := md.mutation.predicates; len(ps) > 0 { + if ps := _d.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - affected, err := 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} } - md.mutation.done = true + _d.mutation.done = true return affected, err } // MetricDeleteOne is the builder for deleting a single Metric entity. type MetricDeleteOne struct { - md *MetricDelete + _d *MetricDelete } // Where appends a list predicates to the MetricDelete builder. -func (mdo *MetricDeleteOne) Where(ps ...predicate.Metric) *MetricDeleteOne { - mdo.md.mutation.Where(ps...) - return mdo +func (_d *MetricDeleteOne) Where(ps ...predicate.Metric) *MetricDeleteOne { + _d._d.mutation.Where(ps...) + return _d } // Exec executes the deletion query. -func (mdo *MetricDeleteOne) Exec(ctx context.Context) error { - n, err := mdo.md.Exec(ctx) +func (_d *MetricDeleteOne) Exec(ctx context.Context) error { + n, err := _d._d.Exec(ctx) switch { case err != nil: return err @@ -81,8 +81,8 @@ func (mdo *MetricDeleteOne) Exec(ctx context.Context) error { } // ExecX is like Exec, but panics if an error occurs. -func (mdo *MetricDeleteOne) ExecX(ctx context.Context) { - if err := mdo.Exec(ctx); err != nil { +func (_d *MetricDeleteOne) ExecX(ctx context.Context) { + if err := _d.Exec(ctx); err != nil { panic(err) } } diff --git a/pkg/database/ent/metric_query.go b/pkg/database/ent/metric_query.go index d8007eea3..27854a94c 100644 --- a/pkg/database/ent/metric_query.go +++ b/pkg/database/ent/metric_query.go @@ -28,40 +28,40 @@ type MetricQuery struct { } // Where adds a new predicate for the MetricQuery builder. -func (mq *MetricQuery) Where(ps ...predicate.Metric) *MetricQuery { - mq.predicates = append(mq.predicates, ps...) - return mq +func (_q *MetricQuery) Where(ps ...predicate.Metric) *MetricQuery { + _q.predicates = append(_q.predicates, ps...) + return _q } // Limit the number of records to be returned by this query. -func (mq *MetricQuery) Limit(limit int) *MetricQuery { - mq.ctx.Limit = &limit - return mq +func (_q *MetricQuery) Limit(limit int) *MetricQuery { + _q.ctx.Limit = &limit + return _q } // Offset to start from. -func (mq *MetricQuery) Offset(offset int) *MetricQuery { - mq.ctx.Offset = &offset - return mq +func (_q *MetricQuery) Offset(offset int) *MetricQuery { + _q.ctx.Offset = &offset + return _q } // Unique configures the query builder to filter duplicate records on query. // By default, unique is set to true, and can be disabled using this method. -func (mq *MetricQuery) Unique(unique bool) *MetricQuery { - mq.ctx.Unique = &unique - return mq +func (_q *MetricQuery) Unique(unique bool) *MetricQuery { + _q.ctx.Unique = &unique + return _q } // Order specifies how the records should be ordered. -func (mq *MetricQuery) Order(o ...metric.OrderOption) *MetricQuery { - mq.order = append(mq.order, o...) - return mq +func (_q *MetricQuery) Order(o ...metric.OrderOption) *MetricQuery { + _q.order = append(_q.order, o...) + return _q } // First returns the first Metric entity from the query. // Returns a *NotFoundError when no Metric was found. -func (mq *MetricQuery) First(ctx context.Context) (*Metric, error) { - nodes, err := mq.Limit(1).All(setContextOp(ctx, mq.ctx, ent.OpQueryFirst)) +func (_q *MetricQuery) First(ctx context.Context) (*Metric, error) { + nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -72,8 +72,8 @@ func (mq *MetricQuery) First(ctx context.Context) (*Metric, error) { } // FirstX is like First, but panics if an error occurs. -func (mq *MetricQuery) FirstX(ctx context.Context) *Metric { - node, err := mq.First(ctx) +func (_q *MetricQuery) FirstX(ctx context.Context) *Metric { + node, err := _q.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -82,9 +82,9 @@ func (mq *MetricQuery) FirstX(ctx context.Context) *Metric { // FirstID returns the first Metric ID from the query. // Returns a *NotFoundError when no Metric ID was found. -func (mq *MetricQuery) FirstID(ctx context.Context) (id int, err error) { +func (_q *MetricQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(1).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryFirstID)); err != nil { + if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -95,8 +95,8 @@ func (mq *MetricQuery) FirstID(ctx context.Context) (id int, err error) { } // FirstIDX is like FirstID, but panics if an error occurs. -func (mq *MetricQuery) FirstIDX(ctx context.Context) int { - id, err := mq.FirstID(ctx) +func (_q *MetricQuery) FirstIDX(ctx context.Context) int { + id, err := _q.FirstID(ctx) if err != nil && !IsNotFound(err) { panic(err) } @@ -106,8 +106,8 @@ func (mq *MetricQuery) FirstIDX(ctx context.Context) int { // Only returns a single Metric entity found by the query, ensuring it only returns one. // Returns a *NotSingularError when more than one Metric entity is found. // Returns a *NotFoundError when no Metric entities are found. -func (mq *MetricQuery) Only(ctx context.Context) (*Metric, error) { - nodes, err := mq.Limit(2).All(setContextOp(ctx, mq.ctx, ent.OpQueryOnly)) +func (_q *MetricQuery) Only(ctx context.Context) (*Metric, error) { + nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -122,8 +122,8 @@ func (mq *MetricQuery) Only(ctx context.Context) (*Metric, error) { } // OnlyX is like Only, but panics if an error occurs. -func (mq *MetricQuery) OnlyX(ctx context.Context) *Metric { - node, err := mq.Only(ctx) +func (_q *MetricQuery) OnlyX(ctx context.Context) *Metric { + node, err := _q.Only(ctx) if err != nil { panic(err) } @@ -133,9 +133,9 @@ func (mq *MetricQuery) OnlyX(ctx context.Context) *Metric { // OnlyID is like Only, but returns the only Metric ID in the query. // Returns a *NotSingularError when more than one Metric ID is found. // Returns a *NotFoundError when no entities are found. -func (mq *MetricQuery) OnlyID(ctx context.Context) (id int, err error) { +func (_q *MetricQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(2).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryOnlyID)); err != nil { + if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -150,8 +150,8 @@ func (mq *MetricQuery) OnlyID(ctx context.Context) (id int, err error) { } // OnlyIDX is like OnlyID, but panics if an error occurs. -func (mq *MetricQuery) OnlyIDX(ctx context.Context) int { - id, err := mq.OnlyID(ctx) +func (_q *MetricQuery) OnlyIDX(ctx context.Context) int { + id, err := _q.OnlyID(ctx) if err != nil { panic(err) } @@ -159,18 +159,18 @@ func (mq *MetricQuery) OnlyIDX(ctx context.Context) int { } // All executes the query and returns a list of Metrics. -func (mq *MetricQuery) All(ctx context.Context) ([]*Metric, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryAll) - if err := mq.prepareQuery(ctx); err != nil { +func (_q *MetricQuery) All(ctx context.Context) ([]*Metric, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) + if err := _q.prepareQuery(ctx); err != nil { return nil, err } qr := querierAll[[]*Metric, *MetricQuery]() - return withInterceptors[[]*Metric](ctx, mq, qr, mq.inters) + return withInterceptors[[]*Metric](ctx, _q, qr, _q.inters) } // AllX is like All, but panics if an error occurs. -func (mq *MetricQuery) AllX(ctx context.Context) []*Metric { - nodes, err := mq.All(ctx) +func (_q *MetricQuery) AllX(ctx context.Context) []*Metric { + nodes, err := _q.All(ctx) if err != nil { panic(err) } @@ -178,20 +178,20 @@ func (mq *MetricQuery) AllX(ctx context.Context) []*Metric { } // IDs executes the query and returns a list of Metric IDs. -func (mq *MetricQuery) IDs(ctx context.Context) (ids []int, err error) { - if mq.ctx.Unique == nil && mq.path != nil { - mq.Unique(true) +func (_q *MetricQuery) IDs(ctx context.Context) (ids []int, err error) { + if _q.ctx.Unique == nil && _q.path != nil { + _q.Unique(true) } - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryIDs) - if err = mq.Select(metric.FieldID).Scan(ctx, &ids); err != nil { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) + if err = _q.Select(metric.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil } // IDsX is like IDs, but panics if an error occurs. -func (mq *MetricQuery) IDsX(ctx context.Context) []int { - ids, err := mq.IDs(ctx) +func (_q *MetricQuery) IDsX(ctx context.Context) []int { + ids, err := _q.IDs(ctx) if err != nil { panic(err) } @@ -199,17 +199,17 @@ func (mq *MetricQuery) IDsX(ctx context.Context) []int { } // Count returns the count of the given query. -func (mq *MetricQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryCount) - if err := mq.prepareQuery(ctx); err != nil { +func (_q *MetricQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) + if err := _q.prepareQuery(ctx); err != nil { return 0, err } - return withInterceptors[int](ctx, mq, querierCount[*MetricQuery](), mq.inters) + return withInterceptors[int](ctx, _q, querierCount[*MetricQuery](), _q.inters) } // CountX is like Count, but panics if an error occurs. -func (mq *MetricQuery) CountX(ctx context.Context) int { - count, err := mq.Count(ctx) +func (_q *MetricQuery) CountX(ctx context.Context) int { + count, err := _q.Count(ctx) if err != nil { panic(err) } @@ -217,9 +217,9 @@ func (mq *MetricQuery) CountX(ctx context.Context) int { } // Exist returns true if the query has elements in the graph. -func (mq *MetricQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, mq.ctx, ent.OpQueryExist) - switch _, err := mq.FirstID(ctx); { +func (_q *MetricQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) + switch _, err := _q.FirstID(ctx); { case IsNotFound(err): return false, nil case err != nil: @@ -230,8 +230,8 @@ func (mq *MetricQuery) Exist(ctx context.Context) (bool, error) { } // ExistX is like Exist, but panics if an error occurs. -func (mq *MetricQuery) ExistX(ctx context.Context) bool { - exist, err := mq.Exist(ctx) +func (_q *MetricQuery) ExistX(ctx context.Context) bool { + exist, err := _q.Exist(ctx) if err != nil { panic(err) } @@ -240,19 +240,19 @@ func (mq *MetricQuery) ExistX(ctx context.Context) bool { // Clone returns a duplicate of the MetricQuery builder, including all associated steps. It can be // used to prepare common query builders and use them differently after the clone is made. -func (mq *MetricQuery) Clone() *MetricQuery { - if mq == nil { +func (_q *MetricQuery) Clone() *MetricQuery { + if _q == nil { return nil } return &MetricQuery{ - config: mq.config, - ctx: mq.ctx.Clone(), - order: append([]metric.OrderOption{}, mq.order...), - inters: append([]Interceptor{}, mq.inters...), - predicates: append([]predicate.Metric{}, mq.predicates...), + config: _q.config, + ctx: _q.ctx.Clone(), + order: append([]metric.OrderOption{}, _q.order...), + inters: append([]Interceptor{}, _q.inters...), + predicates: append([]predicate.Metric{}, _q.predicates...), // clone intermediate query. - sql: mq.sql.Clone(), - path: mq.path, + sql: _q.sql.Clone(), + path: _q.path, } } @@ -270,10 +270,10 @@ func (mq *MetricQuery) Clone() *MetricQuery { // GroupBy(metric.FieldGeneratedType). // Aggregate(ent.Count()). // Scan(ctx, &v) -func (mq *MetricQuery) GroupBy(field string, fields ...string) *MetricGroupBy { - mq.ctx.Fields = append([]string{field}, fields...) - grbuild := &MetricGroupBy{build: mq} - grbuild.flds = &mq.ctx.Fields +func (_q *MetricQuery) GroupBy(field string, fields ...string) *MetricGroupBy { + _q.ctx.Fields = append([]string{field}, fields...) + grbuild := &MetricGroupBy{build: _q} + grbuild.flds = &_q.ctx.Fields grbuild.label = metric.Label grbuild.scan = grbuild.Scan return grbuild @@ -291,62 +291,62 @@ func (mq *MetricQuery) GroupBy(field string, fields ...string) *MetricGroupBy { // client.Metric.Query(). // Select(metric.FieldGeneratedType). // Scan(ctx, &v) -func (mq *MetricQuery) Select(fields ...string) *MetricSelect { - mq.ctx.Fields = append(mq.ctx.Fields, fields...) - sbuild := &MetricSelect{MetricQuery: mq} +func (_q *MetricQuery) Select(fields ...string) *MetricSelect { + _q.ctx.Fields = append(_q.ctx.Fields, fields...) + sbuild := &MetricSelect{MetricQuery: _q} sbuild.label = metric.Label - sbuild.flds, sbuild.scan = &mq.ctx.Fields, sbuild.Scan + sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan return sbuild } // Aggregate returns a MetricSelect configured with the given aggregations. -func (mq *MetricQuery) Aggregate(fns ...AggregateFunc) *MetricSelect { - return mq.Select().Aggregate(fns...) +func (_q *MetricQuery) Aggregate(fns ...AggregateFunc) *MetricSelect { + return _q.Select().Aggregate(fns...) } -func (mq *MetricQuery) prepareQuery(ctx context.Context) error { - for _, inter := range mq.inters { +func (_q *MetricQuery) prepareQuery(ctx context.Context) error { + for _, inter := range _q.inters { if inter == nil { return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") } if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, mq); err != nil { + if err := trv.Traverse(ctx, _q); err != nil { return err } } } - for _, f := range mq.ctx.Fields { + for _, f := range _q.ctx.Fields { if !metric.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } } - if mq.path != nil { - prev, err := mq.path(ctx) + if _q.path != nil { + prev, err := _q.path(ctx) if err != nil { return err } - mq.sql = prev + _q.sql = prev } return nil } -func (mq *MetricQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Metric, error) { +func (_q *MetricQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Metric, error) { var ( nodes = []*Metric{} - _spec = mq.querySpec() + _spec = _q.querySpec() ) _spec.ScanValues = func(columns []string) ([]any, error) { return (*Metric).scanValues(nil, columns) } _spec.Assign = func(columns []string, values []any) error { - node := &Metric{config: mq.config} + node := &Metric{config: _q.config} nodes = append(nodes, node) return node.assignValues(columns, values) } for i := range hooks { hooks[i](ctx, _spec) } - if err := sqlgraph.QueryNodes(ctx, mq.driver, _spec); err != nil { + if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { return nil, err } if len(nodes) == 0 { @@ -355,24 +355,24 @@ func (mq *MetricQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Metri return nodes, nil } -func (mq *MetricQuery) sqlCount(ctx context.Context) (int, error) { - _spec := mq.querySpec() - _spec.Node.Columns = mq.ctx.Fields - if len(mq.ctx.Fields) > 0 { - _spec.Unique = mq.ctx.Unique != nil && *mq.ctx.Unique +func (_q *MetricQuery) sqlCount(ctx context.Context) (int, error) { + _spec := _q.querySpec() + _spec.Node.Columns = _q.ctx.Fields + if len(_q.ctx.Fields) > 0 { + _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique } - return sqlgraph.CountNodes(ctx, mq.driver, _spec) + return sqlgraph.CountNodes(ctx, _q.driver, _spec) } -func (mq *MetricQuery) querySpec() *sqlgraph.QuerySpec { +func (_q *MetricQuery) querySpec() *sqlgraph.QuerySpec { _spec := sqlgraph.NewQuerySpec(metric.Table, metric.Columns, sqlgraph.NewFieldSpec(metric.FieldID, field.TypeInt)) - _spec.From = mq.sql - if unique := mq.ctx.Unique; unique != nil { + _spec.From = _q.sql + if unique := _q.ctx.Unique; unique != nil { _spec.Unique = *unique - } else if mq.path != nil { + } else if _q.path != nil { _spec.Unique = true } - if fields := mq.ctx.Fields; len(fields) > 0 { + if fields := _q.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, metric.FieldID) for i := range fields { @@ -381,20 +381,20 @@ func (mq *MetricQuery) querySpec() *sqlgraph.QuerySpec { } } } - if ps := mq.predicates; len(ps) > 0 { + if ps := _q.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } - if limit := mq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { _spec.Limit = *limit } - if offset := mq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { _spec.Offset = *offset } - if ps := mq.order; len(ps) > 0 { + if ps := _q.order; len(ps) > 0 { _spec.Order = func(selector *sql.Selector) { for i := range ps { ps[i](selector) @@ -404,33 +404,33 @@ func (mq *MetricQuery) querySpec() *sqlgraph.QuerySpec { return _spec } -func (mq *MetricQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(mq.driver.Dialect()) +func (_q *MetricQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(_q.driver.Dialect()) t1 := builder.Table(metric.Table) - columns := mq.ctx.Fields + columns := _q.ctx.Fields if len(columns) == 0 { columns = metric.Columns } selector := builder.Select(t1.Columns(columns...)...).From(t1) - if mq.sql != nil { - selector = mq.sql + if _q.sql != nil { + selector = _q.sql selector.Select(selector.Columns(columns...)...) } - if mq.ctx.Unique != nil && *mq.ctx.Unique { + if _q.ctx.Unique != nil && *_q.ctx.Unique { selector.Distinct() } - for _, p := range mq.predicates { + for _, p := range _q.predicates { p(selector) } - for _, p := range mq.order { + for _, p := range _q.order { p(selector) } - if offset := mq.ctx.Offset; offset != nil { + if offset := _q.ctx.Offset; offset != nil { // limit is mandatory for offset clause. We start // with default value, and override it below if needed. selector.Offset(*offset).Limit(math.MaxInt32) } - if limit := mq.ctx.Limit; limit != nil { + if limit := _q.ctx.Limit; limit != nil { selector.Limit(*limit) } return selector @@ -443,41 +443,41 @@ type MetricGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (mgb *MetricGroupBy) Aggregate(fns ...AggregateFunc) *MetricGroupBy { - mgb.fns = append(mgb.fns, fns...) - return mgb +func (_g *MetricGroupBy) Aggregate(fns ...AggregateFunc) *MetricGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (mgb *MetricGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, mgb.build.ctx, ent.OpQueryGroupBy) - if err := mgb.build.prepareQuery(ctx); err != nil { +func (_g *MetricGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MetricQuery, *MetricGroupBy](ctx, mgb.build, mgb, mgb.build.inters, v) + return scanWithInterceptors[*MetricQuery, *MetricGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (mgb *MetricGroupBy) sqlScan(ctx context.Context, root *MetricQuery, v any) error { +func (_g *MetricGroupBy) sqlScan(ctx context.Context, root *MetricQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(mgb.fns)) - for _, fn := range mgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*mgb.flds)+len(mgb.fns)) - for _, f := range *mgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*mgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := mgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type MetricSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ms *MetricSelect) Aggregate(fns ...AggregateFunc) *MetricSelect { - ms.fns = append(ms.fns, fns...) - return ms +func (_s *MetricSelect) Aggregate(fns ...AggregateFunc) *MetricSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ms *MetricSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ms.ctx, ent.OpQuerySelect) - if err := ms.prepareQuery(ctx); err != nil { +func (_s *MetricSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MetricQuery, *MetricSelect](ctx, ms.MetricQuery, ms, ms.inters, v) + return scanWithInterceptors[*MetricQuery, *MetricSelect](ctx, _s.MetricQuery, _s, _s.inters, v) } -func (ms *MetricSelect) sqlScan(ctx context.Context, root *MetricQuery, v any) error { +func (_s *MetricSelect) sqlScan(ctx context.Context, root *MetricQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ms.fns)) - for _, fn := range ms.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ms.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (ms *MetricSelect) sqlScan(ctx context.Context, root *MetricQuery, v any) e } rows := &sql.Rows{} query, args := selector.Query() - if err := ms.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/pkg/database/ent/metric_update.go b/pkg/database/ent/metric_update.go index 4da33dd6c..2c3e4bade 100644 --- a/pkg/database/ent/metric_update.go +++ b/pkg/database/ent/metric_update.go @@ -23,44 +23,44 @@ type MetricUpdate struct { } // Where appends a list predicates to the MetricUpdate builder. -func (mu *MetricUpdate) Where(ps ...predicate.Metric) *MetricUpdate { - mu.mutation.Where(ps...) - return mu +func (_u *MetricUpdate) Where(ps ...predicate.Metric) *MetricUpdate { + _u.mutation.Where(ps...) + return _u } // SetPushedAt sets the "pushed_at" field. -func (mu *MetricUpdate) SetPushedAt(t time.Time) *MetricUpdate { - mu.mutation.SetPushedAt(t) - return mu +func (_u *MetricUpdate) SetPushedAt(v time.Time) *MetricUpdate { + _u.mutation.SetPushedAt(v) + return _u } // SetNillablePushedAt sets the "pushed_at" field if the given value is not nil. -func (mu *MetricUpdate) SetNillablePushedAt(t *time.Time) *MetricUpdate { - if t != nil { - mu.SetPushedAt(*t) +func (_u *MetricUpdate) SetNillablePushedAt(v *time.Time) *MetricUpdate { + if v != nil { + _u.SetPushedAt(*v) } - return mu + return _u } // ClearPushedAt clears the value of the "pushed_at" field. -func (mu *MetricUpdate) ClearPushedAt() *MetricUpdate { - mu.mutation.ClearPushedAt() - return mu +func (_u *MetricUpdate) ClearPushedAt() *MetricUpdate { + _u.mutation.ClearPushedAt() + return _u } // Mutation returns the MetricMutation object of the builder. -func (mu *MetricUpdate) Mutation() *MetricMutation { - return mu.mutation +func (_u *MetricUpdate) Mutation() *MetricMutation { + return _u.mutation } // Save executes the query and returns the number of nodes affected by the update operation. -func (mu *MetricUpdate) Save(ctx context.Context) (int, error) { - return withHooks(ctx, mu.sqlSave, mu.mutation, mu.hooks) +func (_u *MetricUpdate) 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 *MetricUpdate) SaveX(ctx context.Context) int { - affected, err := mu.Save(ctx) +func (_u *MetricUpdate) SaveX(ctx context.Context) int { + affected, err := _u.Save(ctx) if err != nil { panic(err) } @@ -68,34 +68,34 @@ func (mu *MetricUpdate) SaveX(ctx context.Context) int { } // Exec executes the query. -func (mu *MetricUpdate) Exec(ctx context.Context) error { - _, err := mu.Save(ctx) +func (_u *MetricUpdate) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (mu *MetricUpdate) ExecX(ctx context.Context) { - if err := mu.Exec(ctx); err != nil { +func (_u *MetricUpdate) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } -func (mu *MetricUpdate) sqlSave(ctx context.Context) (n int, err error) { +func (_u *MetricUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(metric.Table, metric.Columns, sqlgraph.NewFieldSpec(metric.FieldID, field.TypeInt)) - if ps := mu.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 := mu.mutation.PushedAt(); ok { + if value, ok := _u.mutation.PushedAt(); ok { _spec.SetField(metric.FieldPushedAt, field.TypeTime, value) } - if mu.mutation.PushedAtCleared() { + if _u.mutation.PushedAtCleared() { _spec.ClearField(metric.FieldPushedAt, field.TypeTime) } - if n, err = sqlgraph.UpdateNodes(ctx, mu.driver, _spec); err != nil { + if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{metric.Label} } else if sqlgraph.IsConstraintError(err) { @@ -103,8 +103,8 @@ func (mu *MetricUpdate) sqlSave(ctx context.Context) (n int, err error) { } return 0, err } - mu.mutation.done = true - return n, nil + _u.mutation.done = true + return _node, nil } // MetricUpdateOne is the builder for updating a single Metric entity. @@ -116,51 +116,51 @@ type MetricUpdateOne struct { } // SetPushedAt sets the "pushed_at" field. -func (muo *MetricUpdateOne) SetPushedAt(t time.Time) *MetricUpdateOne { - muo.mutation.SetPushedAt(t) - return muo +func (_u *MetricUpdateOne) SetPushedAt(v time.Time) *MetricUpdateOne { + _u.mutation.SetPushedAt(v) + return _u } // SetNillablePushedAt sets the "pushed_at" field if the given value is not nil. -func (muo *MetricUpdateOne) SetNillablePushedAt(t *time.Time) *MetricUpdateOne { - if t != nil { - muo.SetPushedAt(*t) +func (_u *MetricUpdateOne) SetNillablePushedAt(v *time.Time) *MetricUpdateOne { + if v != nil { + _u.SetPushedAt(*v) } - return muo + return _u } // ClearPushedAt clears the value of the "pushed_at" field. -func (muo *MetricUpdateOne) ClearPushedAt() *MetricUpdateOne { - muo.mutation.ClearPushedAt() - return muo +func (_u *MetricUpdateOne) ClearPushedAt() *MetricUpdateOne { + _u.mutation.ClearPushedAt() + return _u } // Mutation returns the MetricMutation object of the builder. -func (muo *MetricUpdateOne) Mutation() *MetricMutation { - return muo.mutation +func (_u *MetricUpdateOne) Mutation() *MetricMutation { + return _u.mutation } // Where appends a list predicates to the MetricUpdate builder. -func (muo *MetricUpdateOne) Where(ps ...predicate.Metric) *MetricUpdateOne { - muo.mutation.Where(ps...) - return muo +func (_u *MetricUpdateOne) Where(ps ...predicate.Metric) *MetricUpdateOne { + _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 *MetricUpdateOne) Select(field string, fields ...string) *MetricUpdateOne { - muo.fields = append([]string{field}, fields...) - return muo +func (_u *MetricUpdateOne) Select(field string, fields ...string) *MetricUpdateOne { + _u.fields = append([]string{field}, fields...) + return _u } // Save executes the query and returns the updated Metric entity. -func (muo *MetricUpdateOne) Save(ctx context.Context) (*Metric, error) { - return withHooks(ctx, muo.sqlSave, muo.mutation, muo.hooks) +func (_u *MetricUpdateOne) Save(ctx context.Context) (*Metric, error) { + return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. -func (muo *MetricUpdateOne) SaveX(ctx context.Context) *Metric { - node, err := muo.Save(ctx) +func (_u *MetricUpdateOne) SaveX(ctx context.Context) *Metric { + node, err := _u.Save(ctx) if err != nil { panic(err) } @@ -168,26 +168,26 @@ func (muo *MetricUpdateOne) SaveX(ctx context.Context) *Metric { } // Exec executes the query on the entity. -func (muo *MetricUpdateOne) Exec(ctx context.Context) error { - _, err := muo.Save(ctx) +func (_u *MetricUpdateOne) Exec(ctx context.Context) error { + _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. -func (muo *MetricUpdateOne) ExecX(ctx context.Context) { - if err := muo.Exec(ctx); err != nil { +func (_u *MetricUpdateOne) ExecX(ctx context.Context) { + if err := _u.Exec(ctx); err != nil { panic(err) } } -func (muo *MetricUpdateOne) sqlSave(ctx context.Context) (_node *Metric, err error) { +func (_u *MetricUpdateOne) sqlSave(ctx context.Context) (_node *Metric, err error) { _spec := sqlgraph.NewUpdateSpec(metric.Table, metric.Columns, sqlgraph.NewFieldSpec(metric.FieldID, field.TypeInt)) - id, ok := muo.mutation.ID() + id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Metric.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, metric.FieldID) for _, f := range fields { @@ -199,23 +199,23 @@ func (muo *MetricUpdateOne) sqlSave(ctx context.Context) (_node *Metric, err 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.PushedAt(); ok { + if value, ok := _u.mutation.PushedAt(); ok { _spec.SetField(metric.FieldPushedAt, field.TypeTime, value) } - if muo.mutation.PushedAtCleared() { + if _u.mutation.PushedAtCleared() { _spec.ClearField(metric.FieldPushedAt, field.TypeTime) } - _node = &Metric{config: muo.config} + _node = &Metric{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{metric.Label} } else if sqlgraph.IsConstraintError(err) { @@ -223,6 +223,6 @@ func (muo *MetricUpdateOne) sqlSave(ctx context.Context) (_node *Metric, err err } return nil, err } - muo.mutation.done = true + _u.mutation.done = true return _node, nil } diff --git a/pkg/database/ent/runtime/runtime.go b/pkg/database/ent/runtime/runtime.go index d96449c42..54983093a 100644 --- a/pkg/database/ent/runtime/runtime.go +++ b/pkg/database/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/crowdsecurity/crowdsec/pkg/database/ent/runtime.go const ( - Version = "v0.14.2" // Version of ent codegen. - Sum = "h1:ywld/j2Rx4EmnIKs8eZ29cbFA1zpB+DA9TLL5l3rlq0=" // Sum of ent codegen. + Version = "v0.14.6" // Version of ent codegen. + Sum = "h1:/f2696BpwuWAEEG6PVGWflg6+Inrpq4pRWuNlWz/Skk=" // Sum of ent codegen. ) diff --git a/pkg/exprhelpers/debugger_test.go b/pkg/exprhelpers/debugger_test.go index 70458c46b..a1f80e5d6 100644 --- a/pkg/exprhelpers/debugger_test.go +++ b/pkg/exprhelpers/debugger_test.go @@ -49,10 +49,6 @@ func UpperN(params ...any) (any, error) { return strings.ToUpper(s) + strings.ToUpper(v) + strings.ToUpper(x) + strings.ToUpper(y), nil } -func boolPtr(b bool) *bool { - return &b -} - type teststruct struct { Foo string } @@ -92,8 +88,8 @@ func TestBaseDbg(t *testing.T) { ExpectedFailRuntime: true, ExpectedOutputs: []OpOutput{ {Code: "Upper('1')", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"1\""}, FuncResults: []string{"\"1\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== '1'", CodeDepth: 0, Comparison: true, Left: "\"1\"", Right: "\"1\"", StrConditionResult: "[true]", ConditionResult: boolPtr(true), Finalized: true}, - {Code: "&&", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== '1'", CodeDepth: 0, Comparison: true, Left: "\"1\"", Right: "\"1\"", StrConditionResult: "[true]", ConditionResult: new(true), Finalized: true}, + {Code: "&&", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "", ConditionResult: new(true), Finalized: true}, }, }, { @@ -102,7 +98,7 @@ func TestBaseDbg(t *testing.T) { Env: defaultEnv, ExpectedOutputs: []OpOutput{ {Code: "UpperTwo('hello', 'world')", CodeDepth: 0, Func: true, FuncName: "UpperTwo", Args: []string{"\"world\"", "\"hello\""}, FuncResults: []string{"\"HELLOWORLD\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'HELLOWORLD'", CodeDepth: 0, Comparison: true, Left: "\"HELLOWORLD\"", Right: "\"HELLOWORLD\"", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 'HELLOWORLD'", CodeDepth: 0, Comparison: true, Left: "\"HELLOWORLD\"", Right: "\"HELLOWORLD\"", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -111,7 +107,7 @@ func TestBaseDbg(t *testing.T) { Env: defaultEnv, ExpectedOutputs: []OpOutput{ {Code: "UpperThree('hello', 'world', 'foo')", CodeDepth: 0, Func: true, FuncName: "UpperThree", Args: []string{"\"foo\"", "\"world\"", "\"hello\""}, FuncResults: []string{"\"HELLOWORLDFOO\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'HELLOWORLDFOO'", CodeDepth: 0, Comparison: true, Left: "\"HELLOWORLDFOO\"", Right: "\"HELLOWORLDFOO\"", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 'HELLOWORLDFOO'", CodeDepth: 0, Comparison: true, Left: "\"HELLOWORLDFOO\"", Right: "\"HELLOWORLDFOO\"", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -121,7 +117,7 @@ func TestBaseDbg(t *testing.T) { ExpectedOutputs: []OpOutput{ {Code: "UpperN('hello', 'world', 'foo', 'lol')", CodeDepth: 0, Func: true, FuncName: "OpCallN", Args: []string{"\"lol\"", "\"foo\"", "\"world\"", "\"hello\""}, FuncResults: []string{"\"HELLOWORLDFOOLOL\""}, ConditionResult: (*bool)(nil), Finalized: true}, {Code: "UpperN('hello', 'world', 'foo', 'lol')", CodeDepth: 0, Func: true, FuncName: "OpCallN", Args: []string{"\"lol\"", "\"foo\"", "\"world\"", "\"hello\""}, FuncResults: []string{"\"HELLOWORLDFOOLOL\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== UpperN('hello', 'world', 'foo', 'lol')", CodeDepth: 0, Comparison: true, Left: "\"HELLOWORLDFOOLOL\"", Right: "\"HELLOWORLDFOOLOL\"", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== UpperN('hello', 'world', 'foo', 'lol')", CodeDepth: 0, Comparison: true, Left: "\"HELLOWORLDFOOLOL\"", Right: "\"HELLOWORLDFOOLOL\"", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -129,7 +125,7 @@ func TestBaseDbg(t *testing.T) { Expr: "base_string == 'hello world'", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "== 'hello world'", CodeDepth: 0, Comparison: true, Left: "\"hello world\"", Right: "\"hello world\"", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 'hello world'", CodeDepth: 0, Comparison: true, Left: "\"hello world\"", Right: "\"hello world\"", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -139,16 +135,16 @@ func TestBaseDbg(t *testing.T) { ExpectedOutputs: []OpOutput{ {Code: "count(base_struct.Myarr, {", CodeDepth: 4, BlockStart: true, ConditionResult: (*bool)(nil), Finalized: false}, {Code: "Upper(#)", CodeDepth: 4, Func: true, FuncName: "Upper", Args: []string{"\"a\""}, FuncResults: []string{"\"A\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"A\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: false}, + {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"A\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: false}, {Code: "Upper(#)", CodeDepth: 4, Func: true, FuncName: "Upper", Args: []string{"\"b\""}, FuncResults: []string{"\"B\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"B\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: false}, + {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"B\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: false}, {Code: "Upper(#)", CodeDepth: 4, Func: true, FuncName: "Upper", Args: []string{"\"c\""}, FuncResults: []string{"\"C\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"C\"", Right: "\"C\"", StrConditionResult: "[true]", ConditionResult: boolPtr(true), Finalized: true}, - {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: false}, + {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"C\"", Right: "\"C\"", StrConditionResult: "[true]", ConditionResult: new(true), Finalized: true}, + {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: false}, {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 0, BlockEnd: true, StrConditionResult: "[1]", ConditionResult: (*bool)(nil), Finalized: false}, - {Code: "== 1", CodeDepth: 0, Comparison: true, Left: "1", Right: "1", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 1", CodeDepth: 0, Comparison: true, Left: "1", Right: "1", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -158,19 +154,19 @@ func TestBaseDbg(t *testing.T) { ExpectedOutputs: []OpOutput{ {Code: "count(base_struct.Myarr, {", CodeDepth: 4, BlockStart: true, ConditionResult: (*bool)(nil), Finalized: false}, {Code: "Upper(#)", CodeDepth: 4, Func: true, FuncName: "Upper", Args: []string{"\"a\""}, FuncResults: []string{"\"A\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"A\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: false}, + {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"A\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: false}, {Code: "Upper(#)", CodeDepth: 4, Func: true, FuncName: "Upper", Args: []string{"\"b\""}, FuncResults: []string{"\"B\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"B\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: false}, + {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"B\"", Right: "\"C\"", StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: false}, {Code: "Upper(#)", CodeDepth: 4, Func: true, FuncName: "Upper", Args: []string{"\"c\""}, FuncResults: []string{"\"C\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"C\"", Right: "\"C\"", StrConditionResult: "[true]", ConditionResult: boolPtr(true), Finalized: true}, - {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: false}, + {Code: "== 'C'})", CodeDepth: 4, Comparison: true, Left: "\"C\"", Right: "\"C\"", StrConditionResult: "[true]", ConditionResult: new(true), Finalized: true}, + {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 4, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: false}, {Code: "count(base_struct.Myarr, {Upper(#) == 'C'})", CodeDepth: 0, BlockEnd: true, StrConditionResult: "[1]", ConditionResult: (*bool)(nil), Finalized: false}, - {Code: "== 1", CodeDepth: 0, Comparison: true, Left: "1", Right: "1", StrConditionResult: "[true]", ConditionResult: boolPtr(true), Finalized: true}, - {Code: "&&", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: false}, + {Code: "== 1", CodeDepth: 0, Comparison: true, Left: "1", Right: "1", StrConditionResult: "[true]", ConditionResult: new(true), Finalized: true}, + {Code: "&&", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: false}, {Code: "Upper(base_struct.Foo)", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"bar\""}, FuncResults: []string{"\"BAR\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "== 'BAR'", CodeDepth: 0, Comparison: true, Left: "\"BAR\"", Right: "\"BAR\"", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 'BAR'", CodeDepth: 0, Comparison: true, Left: "\"BAR\"", Right: "\"BAR\"", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -178,7 +174,7 @@ func TestBaseDbg(t *testing.T) { Expr: "base_int in [1,2,3,4,42]", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "in [1,2,3,4,42]", CodeDepth: 0, Args: []string{"42", "map[1:{} 2:{} 3:{} 4:{} 42:{}]"}, Condition: true, ConditionIn: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "in [1,2,3,4,42]", CodeDepth: 0, Args: []string{"42", "map[1:{} 2:{} 3:{} 4:{} 42:{}]"}, Condition: true, ConditionIn: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -186,7 +182,7 @@ func TestBaseDbg(t *testing.T) { Expr: "base_string == 'hello world'", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "== 'hello world'", CodeDepth: 0, Comparison: true, Left: "\"hello world\"", Right: "\"hello world\"", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 'hello world'", CodeDepth: 0, Comparison: true, Left: "\"hello world\"", Right: "\"hello world\"", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -194,7 +190,7 @@ func TestBaseDbg(t *testing.T) { Expr: "base_int == 42", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "== 42", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 42", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -202,7 +198,7 @@ func TestBaseDbg(t *testing.T) { Expr: "base_int != 43", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "!= 43", CodeDepth: 0, Negated: true, Comparison: true, Left: "42", Right: "43", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "!= 43", CodeDepth: 0, Negated: true, Comparison: true, Left: "42", Right: "43", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -210,9 +206,9 @@ func TestBaseDbg(t *testing.T) { Expr: "base_int == 43 || base_int == 42", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "== 43", CodeDepth: 0, Comparison: true, Left: "42", Right: "43", StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "||", CodeDepth: 0, JumpIf: true, IfTrue: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: false}, - {Code: "== 42", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 43", CodeDepth: 0, Comparison: true, Left: "42", Right: "43", StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "||", CodeDepth: 0, JumpIf: true, IfTrue: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: false}, + {Code: "== 42", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -220,7 +216,7 @@ func TestBaseDbg(t *testing.T) { Expr: "true", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "true", CodeDepth: 0, Condition: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "true", CodeDepth: 0, Condition: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -228,7 +224,7 @@ func TestBaseDbg(t *testing.T) { Expr: "false", Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "false", CodeDepth: 0, Condition: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: true}, + {Code: "false", CodeDepth: 0, Condition: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: true}, }, }, { @@ -238,13 +234,13 @@ func TestBaseDbg(t *testing.T) { (base_struct.Bar == 41 || base_struct.Bar == 42)`, Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "== 42", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "[true]", ConditionResult: boolPtr(true), Finalized: true}, - {Code: "&&", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: false}, - {Code: "== 'hello world'", CodeDepth: 0, Comparison: true, Left: "\"hello world\"", Right: "\"hello world\"", StrConditionResult: "[true]", ConditionResult: boolPtr(true), Finalized: true}, - {Code: "&& (", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: false}, - {Code: "== 41", CodeDepth: 0, Comparison: true, Left: "42", Right: "41", StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "||", CodeDepth: 0, JumpIf: true, IfTrue: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: false}, - {Code: "== 42)", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "== 42", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "[true]", ConditionResult: new(true), Finalized: true}, + {Code: "&&", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: false}, + {Code: "== 'hello world'", CodeDepth: 0, Comparison: true, Left: "\"hello world\"", Right: "\"hello world\"", StrConditionResult: "[true]", ConditionResult: new(true), Finalized: true}, + {Code: "&& (", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: false}, + {Code: "== 41", CodeDepth: 0, Comparison: true, Left: "42", Right: "41", StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "||", CodeDepth: 0, JumpIf: true, IfTrue: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: false}, + {Code: "== 42)", CodeDepth: 0, Comparison: true, Left: "42", Right: "42", StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -254,7 +250,7 @@ func TestBaseDbg(t *testing.T) { ExpectedOutputs: []OpOutput{ {Code: "Upper(base_string)", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"hello world\""}, FuncResults: []string{"\"HELLO WORLD\""}, ConditionResult: (*bool)(nil), Finalized: true}, {Code: "Upper('wOrlD')", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"wOrlD\""}, FuncResults: []string{"\"WORLD\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "contains Upper('wOrlD')", CodeDepth: 0, Args: []string{"\"HELLO WORLD\"", "\"WORLD\""}, Condition: true, ConditionContains: true, StrConditionResult: "true", ConditionResult: boolPtr(true), Finalized: true}, + {Code: "contains Upper('wOrlD')", CodeDepth: 0, Args: []string{"\"HELLO WORLD\"", "\"WORLD\""}, Condition: true, ConditionContains: true, StrConditionResult: "true", ConditionResult: new(true), Finalized: true}, }, }, { @@ -266,12 +262,12 @@ func TestBaseDbg(t *testing.T) { ExpectedOutputs: []OpOutput{ {Code: "Upper(base_string)", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"hello world\""}, FuncResults: []string{"\"HELLO WORLD\""}, ConditionResult: (*bool)(nil), Finalized: true}, {Code: "Upper('/someurl?x=1')", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"/someurl?x=1\""}, FuncResults: []string{"\"/SOMEURL?X=1\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "contains Upper('/someurl?x=1')", CodeDepth: 0, Args: []string{"\"HELLO WORLD\"", "\"/SOMEURL?X=1\""}, Condition: true, ConditionContains: true, StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "||", CodeDepth: 0, JumpIf: true, IfTrue: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: false}, + {Code: "contains Upper('/someurl?x=1')", CodeDepth: 0, Args: []string{"\"HELLO WORLD\"", "\"/SOMEURL?X=1\""}, Condition: true, ConditionContains: true, StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "||", CodeDepth: 0, JumpIf: true, IfTrue: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: false}, {Code: "Upper(base_string)", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"hello world\""}, FuncResults: []string{"\"HELLO WORLD\""}, ConditionResult: (*bool)(nil), Finalized: true}, {Code: "Upper('/someotherurl?account-name=admin&account-status=1&ow=cmd') )", CodeDepth: 0, Func: true, FuncName: "Upper", Args: []string{"\"/someotherurl?account-name=admin&account...\""}, FuncResults: []string{"\"/SOMEOTHERURL?ACCOUNT-NAME=ADMIN&ACCOUNT...\""}, ConditionResult: (*bool)(nil), Finalized: true}, - {Code: "contains Upper('/someotherurl?account-name=admin&account-status=1&ow=cmd') )", CodeDepth: 0, Args: []string{"\"HELLO WORLD\"", "\"/SOMEOTHERURL?ACCOUNT-NAME=ADMIN&ACCOUNT...\""}, Condition: true, ConditionContains: true, StrConditionResult: "[false]", ConditionResult: boolPtr(false), Finalized: true}, - {Code: "and", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: boolPtr(false), Finalized: true}, + {Code: "contains Upper('/someotherurl?account-name=admin&account-status=1&ow=cmd') )", CodeDepth: 0, Args: []string{"\"HELLO WORLD\"", "\"/SOMEOTHERURL?ACCOUNT-NAME=ADMIN&ACCOUNT...\""}, Condition: true, ConditionContains: true, StrConditionResult: "[false]", ConditionResult: new(false), Finalized: true}, + {Code: "and", CodeDepth: 0, JumpIf: true, IfFalse: true, StrConditionResult: "false", ConditionResult: new(false), Finalized: true}, }, }, { @@ -283,9 +279,9 @@ func TestBaseDbg(t *testing.T) { }`, Env: defaultEnv, ExpectedOutputs: []OpOutput{ - {Code: "!= 42 {", CodeDepth: 0, Negated: true, Comparison: true, Left: "42", Right: "42", StrConditionResult: "[true]", ConditionResult: boolPtr(true), Finalized: true}, - {Code: "if base_int != 42 {", CodeDepth: 0, ConditionResult: boolPtr(false), Finalized: false, IfFalse: true, JumpIf: true, StrConditionResult: "false"}, - {Code: "false }", CodeDepth: 0, StrConditionResult: "false", Condition: true, ConditionResult: boolPtr(false), Finalized: true}, + {Code: "!= 42 {", CodeDepth: 0, Negated: true, Comparison: true, Left: "42", Right: "42", StrConditionResult: "[true]", ConditionResult: new(true), Finalized: true}, + {Code: "if base_int != 42 {", CodeDepth: 0, ConditionResult: new(false), Finalized: false, IfFalse: true, JumpIf: true, StrConditionResult: "false"}, + {Code: "false }", CodeDepth: 0, StrConditionResult: "false", Condition: true, ConditionResult: new(false), Finalized: true}, }, }, } diff --git a/pkg/exprhelpers/exprlib_test.go b/pkg/exprhelpers/exprlib_test.go index 13992952d..8fea5e0d3 100644 --- a/pkg/exprhelpers/exprlib_test.go +++ b/pkg/exprhelpers/exprlib_test.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/require" "github.com/crowdsecurity/go-cs-lib/cstest" - "github.com/crowdsecurity/go-cs-lib/ptr" "github.com/crowdsecurity/crowdsec/pkg/csconfig" "github.com/crowdsecurity/crowdsec/pkg/csnet" @@ -276,7 +275,7 @@ func TestRegexpCacheBehavior(t *testing.T) { require.NoError(t, err) // cache with no TTL - err = RegexpCacheInit(filename, enrichment.DataProvider{Type: "regex", Size: ptr.Of(1)}) + err = RegexpCacheInit(filename, enrichment.DataProvider{Type: "regex", Size: new(1)}) require.NoError(t, err) ret, _ := RegexpInFile("crowdsec", filename) @@ -289,7 +288,7 @@ func TestRegexpCacheBehavior(t *testing.T) { // cache with TTL ttl := 500 * time.Millisecond - err = RegexpCacheInit(filename, enrichment.DataProvider{Type: "regex", Size: ptr.Of(2), TTL: &ttl}) + err = RegexpCacheInit(filename, enrichment.DataProvider{Type: "regex", Size: new(2), TTL: &ttl}) require.NoError(t, err) ret, _ = RegexpInFile("crowdsec", filename) diff --git a/test/bats/20_hub_items.bats b/test/bats/20_hub_items.bats index d87d12422..4fca6f3f2 100644 --- a/test/bats/20_hub_items.bats +++ b/test/bats/20_hub_items.bats @@ -80,7 +80,7 @@ teardown() { rune -0 cscli collections install crowdsecurity/sshd rune -1 cscli collections inspect crowdsecurity/sshd --no-metrics # XXX: it would be better to trigger this during parse, not sync - assert_stderr "Error: cscli collections inspect: failed to sync $HUB_DIR: while syncing collections sshd.yaml: 1.2.3.4: Invalid Semantic Version" + assert_stderr "Error: cscli collections inspect: failed to sync $HUB_DIR: while syncing collections sshd.yaml: 1.2.3.4: invalid semantic version" } @test "removing or purging an item already removed by hand" {