add initial application structure with configuration, logging, and health check endpoints
This commit is contained in:
143
db/schema.sql
Normal file
143
db/schema.sql
Normal file
@@ -0,0 +1,143 @@
|
||||
CREATE TABLE IF NOT EXISTS `epic_artifact_info` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`artifact_name` VARCHAR(255) NOT NULL,
|
||||
`artifact_code` VARCHAR(255) NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL,
|
||||
`stats_health` INT NOT NULL,
|
||||
`stats_attack` INT NOT NULL,
|
||||
`stats_defense` INT NOT NULL,
|
||||
`rarity` VARCHAR(255) NOT NULL,
|
||||
`role` VARCHAR(255) NOT NULL,
|
||||
`artifact_name_en` VARCHAR(255) NOT NULL,
|
||||
`image_url` VARCHAR(255) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `epic_gvg_attack_teams` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`attack_heroes` VARCHAR(255) NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `epic_gvg_defense_attack_mapping` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`defense_id` BIGINT NOT NULL,
|
||||
`attack_id` BIGINT NOT NULL,
|
||||
`equipment_info` VARCHAR(255) NOT NULL,
|
||||
`artifacts` VARCHAR(255) NOT NULL,
|
||||
`battle_strategy` VARCHAR(255) NOT NULL,
|
||||
`prerequisites` VARCHAR(255) NOT NULL,
|
||||
`important_notes` VARCHAR(255) NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `epic_gvg_defense_teams` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`defense_heroes` VARCHAR(255) NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `epic_hero_info` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`hero_name` VARCHAR(255) NOT NULL,
|
||||
`hero_code` VARCHAR(255) NOT NULL,
|
||||
`hero_attr_lv60` VARCHAR(255) NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL,
|
||||
`nick_name` VARCHAR(255) NOT NULL,
|
||||
`rarity` VARCHAR(255) NOT NULL,
|
||||
`role` VARCHAR(255) NOT NULL,
|
||||
`zodiac` VARCHAR(255) NOT NULL,
|
||||
`head_img_url` VARCHAR(255) NOT NULL,
|
||||
`attribute` VARCHAR(255) NOT NULL,
|
||||
`remark` VARCHAR(255) NOT NULL,
|
||||
`raw_json` VARCHAR(255) NOT NULL,
|
||||
`set_content_json` VARCHAR(255) NOT NULL,
|
||||
`set_update_time` DATETIME NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `epic_hero_user_build` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`artifact_code` VARCHAR(255) NOT NULL,
|
||||
`hero_code` VARCHAR(255) NOT NULL,
|
||||
`hero_heath_build` DOUBLE NOT NULL,
|
||||
`hero_attack_build` DOUBLE NOT NULL,
|
||||
`hero_def_build` DOUBLE NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `epic_i18n_mappings` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`key_name` VARCHAR(255) NOT NULL,
|
||||
`language` VARCHAR(255) NOT NULL,
|
||||
`value` VARCHAR(255) NOT NULL,
|
||||
`category` VARCHAR(255) NOT NULL,
|
||||
`status` INT NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` INT NOT NULL,
|
||||
`code` VARCHAR(255) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `fribble_hero_set` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`hero_code` VARCHAR(255) NOT NULL,
|
||||
`json_content` VARCHAR(255) NOT NULL,
|
||||
`hero_name` VARCHAR(255) NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL,
|
||||
`success_get` INT NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `gear_set_info` (
|
||||
`id` BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
`level` INT NOT NULL,
|
||||
`gear_id` BIGINT NOT NULL,
|
||||
`enhance` INT NOT NULL,
|
||||
`gear_type` VARCHAR(255) NOT NULL,
|
||||
`gear_set_type` VARCHAR(255) NOT NULL,
|
||||
`main_stat_type` VARCHAR(255) NOT NULL,
|
||||
`main_stat_value` INT NOT NULL,
|
||||
`sub_stat_one_type` VARCHAR(255) NOT NULL,
|
||||
`sub_stat_one_value` INT NOT NULL,
|
||||
`sub_stat_two_type` VARCHAR(255) NOT NULL,
|
||||
`sub_stat_two_value` INT NOT NULL,
|
||||
`sub_stat_three_type` VARCHAR(255) NOT NULL,
|
||||
`sub_stat_three_value` INT NOT NULL,
|
||||
`sub_stat_four_type` VARCHAR(255) NOT NULL,
|
||||
`sub_stat_four_value` INT NOT NULL,
|
||||
`account_code` VARCHAR(255) NOT NULL,
|
||||
`creator` VARCHAR(255) NOT NULL,
|
||||
`create_time` DATETIME NULL,
|
||||
`updater` VARCHAR(255) NOT NULL,
|
||||
`update_time` DATETIME NULL,
|
||||
`deleted` TINYINT(1) NOT NULL,
|
||||
`tenant_id` BIGINT NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
14
go.mod
14
go.mod
@@ -3,6 +3,7 @@ module epic-ent
|
||||
go 1.24.0
|
||||
|
||||
require (
|
||||
entgo.io/ent v0.14.5
|
||||
github.com/go-sql-driver/mysql v1.9.3
|
||||
github.com/labstack/echo/v4 v4.15.0
|
||||
github.com/redis/go-redis/v9 v9.17.2
|
||||
@@ -13,27 +14,38 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/bmatcuk/doublestar v1.3.4 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.18.1 // indirect
|
||||
github.com/labstack/gommon v0.4.2 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/sagikazarmark/locafero v0.12.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
github.com/zclconf/go-cty v1.14.4 // indirect
|
||||
github.com/zclconf/go-cty-yaml v1.1.0 // indirect
|
||||
go.uber.org/dig v1.19.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/crypto v0.47.0 // indirect
|
||||
golang.org/x/mod v0.31.0 // indirect
|
||||
golang.org/x/net v0.49.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
golang.org/x/text v0.33.0 // indirect
|
||||
|
||||
70
go.sum
70
go.sum
@@ -1,17 +1,51 @@
|
||||
ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9 h1:E0wvcUXTkgyN4wy4LGtNzMNGMytJN8afmIWXJVMi4cc=
|
||||
ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9/go.mod h1:Oe1xWPuu5q9LzyrWfbZmEZxFYeu4BHTyzfjeW2aZp/w=
|
||||
entgo.io/ent v0.14.5 h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=
|
||||
entgo.io/ent v0.14.5/go.mod h1:zTzLmWtPvGpmSwtkaayM2cm5m819NdM7z7tYPq3vN0U=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
||||
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||
github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=
|
||||
github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
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/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
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-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-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hashicorp/hcl/v2 v2.18.1 h1:6nxnOJFku1EuSawSD81fuviYUV8DxFr3fp2dUi3ZYSo=
|
||||
github.com/hashicorp/hcl/v2 v2.18.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/labstack/echo/v4 v4.15.0 h1:hoRTKWcnR5STXZFe9BmYun9AMTNeSbjHi2vtDuADJ24=
|
||||
github.com/labstack/echo/v4 v4.15.0/go.mod h1:xmw1clThob0BSVRX1CRQkGQ/vjwcpOMjQZSZa9fKA/c=
|
||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||
@@ -20,46 +54,62 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
|
||||
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
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/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
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/redis/go-redis/v9 v9.5.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/redis/go-redis/v9 v9.17.2 h1:P2EGsA4qVIM3Pp+aPocCJ7DguDHhqrXNhVcEp4ViluI=
|
||||
github.com/redis/go-redis/v9 v9.17.2/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=
|
||||
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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
|
||||
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
|
||||
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/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
|
||||
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
|
||||
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/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
|
||||
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
|
||||
github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
|
||||
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/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||
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=
|
||||
go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4=
|
||||
go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE=
|
||||
go.uber.org/fx v1.22.2/go.mod h1:o/D9n+2mLP6v1EG+qsdT1O8wKopYAsqZasju97SDFCU=
|
||||
go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg=
|
||||
go.uber.org/fx v1.24.0/go.mod h1:AmDeGyS+ZARGKM4tlH4FY2Jr63VjbEDJHtqXTGP5hbo=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
|
||||
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
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/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
||||
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
|
||||
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
|
||||
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -68,3 +118,7 @@ golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
||||
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
"epic-ent/internal/service"
|
||||
)
|
||||
|
||||
type HealthController struct {
|
||||
svc *service.HealthService
|
||||
}
|
||||
|
||||
func NewHealthController(svc *service.HealthService) *HealthController {
|
||||
return &HealthController{svc: svc}
|
||||
}
|
||||
|
||||
func (h *HealthController) Health(c echo.Context) error {
|
||||
status := h.svc.Check()
|
||||
return c.JSON(http.StatusOK, status)
|
||||
}
|
||||
94
internal/controller/hero_controller.go
Normal file
94
internal/controller/hero_controller.go
Normal file
@@ -0,0 +1,94 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
"epic-ent/internal/domain/dto"
|
||||
"epic-ent/internal/domain/vo"
|
||||
"epic-ent/internal/service"
|
||||
)
|
||||
|
||||
type HeroController struct {
|
||||
svc *service.HeroService
|
||||
}
|
||||
|
||||
func NewHeroController(svc *service.HeroService) *HeroController {
|
||||
return &HeroController{svc: svc}
|
||||
}
|
||||
|
||||
func (h *HeroController) Create(c echo.Context) error {
|
||||
var req dto.HeroCreateRequest
|
||||
if err := c.Bind(&req); err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid request")
|
||||
}
|
||||
|
||||
hero, err := h.svc.Create(c.Request().Context(), req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusCreated, vo.OK(hero))
|
||||
}
|
||||
|
||||
func (h *HeroController) GetByID(c echo.Context) error {
|
||||
id, err := parseID(c.Param("id"))
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid id")
|
||||
}
|
||||
|
||||
hero, err := h.svc.GetByID(c.Request().Context(), id)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return echo.NewHTTPError(http.StatusNotFound, "hero not found")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, vo.OK(hero))
|
||||
}
|
||||
|
||||
func (h *HeroController) Update(c echo.Context) error {
|
||||
id, err := parseID(c.Param("id"))
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid id")
|
||||
}
|
||||
|
||||
var req dto.HeroUpdateRequest
|
||||
if err := c.Bind(&req); err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid request")
|
||||
}
|
||||
|
||||
hero, err := h.svc.Update(c.Request().Context(), id, req)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return echo.NewHTTPError(http.StatusNotFound, "hero not found")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, vo.OK(hero))
|
||||
}
|
||||
|
||||
func (h *HeroController) Delete(c echo.Context) error {
|
||||
id, err := parseID(c.Param("id"))
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid id")
|
||||
}
|
||||
|
||||
if err := h.svc.Delete(c.Request().Context(), id); err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return echo.NewHTTPError(http.StatusNotFound, "hero not found")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, vo.OK(nil))
|
||||
}
|
||||
|
||||
func parseID(raw string) (int64, error) {
|
||||
return strconv.ParseInt(raw, 10, 64)
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import "go.uber.org/fx"
|
||||
|
||||
var Module = fx.Options(
|
||||
fx.Provide(
|
||||
NewHealthController,
|
||||
NewHeroController,
|
||||
),
|
||||
fx.Invoke(
|
||||
RegisterRoutes,
|
||||
|
||||
@@ -8,10 +8,13 @@ import (
|
||||
type RouteParams struct {
|
||||
fx.In
|
||||
|
||||
Echo *echo.Echo
|
||||
Health *HealthController
|
||||
Echo *echo.Echo
|
||||
Hero *HeroController
|
||||
}
|
||||
|
||||
func RegisterRoutes(p RouteParams) {
|
||||
p.Echo.GET("/health", p.Health.Health)
|
||||
p.Echo.POST("/heroes", p.Hero.Create)
|
||||
p.Echo.GET("/heroes/:id", p.Hero.GetByID)
|
||||
p.Echo.PUT("/heroes/:id", p.Hero.Update)
|
||||
p.Echo.DELETE("/heroes/:id", p.Hero.Delete)
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
"epic-ent/internal/service"
|
||||
)
|
||||
|
||||
type UserController struct {
|
||||
svc *service.HealthService
|
||||
}
|
||||
|
||||
func NewUserController(svc *service.HealthService) *HealthController {
|
||||
return &HealthController{svc: svc}
|
||||
}
|
||||
|
||||
func (h *UserController) Health(c echo.Context) error {
|
||||
//status := h.svc.Check()
|
||||
return c.JSON(http.StatusOK, "你好")
|
||||
}
|
||||
43
internal/domain/dto/hero.go
Normal file
43
internal/domain/dto/hero.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
type HeroCreateRequest struct {
|
||||
HeroName *string `json:"heroName"`
|
||||
HeroCode *string `json:"heroCode"`
|
||||
HeroAttrLv60 *string `json:"heroAttrLv60"`
|
||||
Creator *string `json:"creator"`
|
||||
CreateTime *time.Time `json:"createTime"`
|
||||
Updater *string `json:"updater"`
|
||||
UpdateTime *time.Time `json:"updateTime"`
|
||||
Deleted *bool `json:"deleted"`
|
||||
NickName *string `json:"nickName"`
|
||||
Rarity *string `json:"rarity"`
|
||||
Role *string `json:"role"`
|
||||
Zodiac *string `json:"zodiac"`
|
||||
HeadImgURL *string `json:"headImgUrl"`
|
||||
Attribute *string `json:"attribute"`
|
||||
Remark *string `json:"remark"`
|
||||
RawJSON *string `json:"rawJson"`
|
||||
SetContentJSON *string `json:"setContentJson"`
|
||||
SetUpdateTime *time.Time `json:"setUpdateTime"`
|
||||
}
|
||||
|
||||
type HeroUpdateRequest struct {
|
||||
HeroName *string `json:"heroName"`
|
||||
HeroCode *string `json:"heroCode"`
|
||||
HeroAttrLv60 *string `json:"heroAttrLv60"`
|
||||
Updater *string `json:"updater"`
|
||||
UpdateTime *time.Time `json:"updateTime"`
|
||||
Deleted *bool `json:"deleted"`
|
||||
NickName *string `json:"nickName"`
|
||||
Rarity *string `json:"rarity"`
|
||||
Role *string `json:"role"`
|
||||
Zodiac *string `json:"zodiac"`
|
||||
HeadImgURL *string `json:"headImgUrl"`
|
||||
Attribute *string `json:"attribute"`
|
||||
Remark *string `json:"remark"`
|
||||
RawJSON *string `json:"rawJson"`
|
||||
SetContentJSON *string `json:"setContentJson"`
|
||||
SetUpdateTime *time.Time `json:"setUpdateTime"`
|
||||
}
|
||||
34
internal/domain/entity/epic_artifact_info.go
Normal file
34
internal/domain/entity/epic_artifact_info.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type EpicArtifactInfo struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EpicArtifactInfo) Table() string {
|
||||
return "epic_artifact_info"
|
||||
}
|
||||
|
||||
func (EpicArtifactInfo) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("artifact_name").MaxLen(255),
|
||||
field.String("artifact_code").MaxLen(255),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
field.Int("stats_health"),
|
||||
field.Int("stats_attack"),
|
||||
field.Int("stats_defense"),
|
||||
field.String("rarity").MaxLen(255),
|
||||
field.String("role").MaxLen(255),
|
||||
field.String("artifact_name_en").MaxLen(255),
|
||||
field.String("image_url").MaxLen(255),
|
||||
}
|
||||
}
|
||||
26
internal/domain/entity/epic_gvg_attack_teams.go
Normal file
26
internal/domain/entity/epic_gvg_attack_teams.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type EpicGvgAttackTeams struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EpicGvgAttackTeams) Table() string {
|
||||
return "epic_gvg_attack_teams"
|
||||
}
|
||||
|
||||
func (EpicGvgAttackTeams) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("attack_heroes").MaxLen(255),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
}
|
||||
}
|
||||
32
internal/domain/entity/epic_gvg_defense_attack_mapping.go
Normal file
32
internal/domain/entity/epic_gvg_defense_attack_mapping.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type EpicGvgDefenseAttackMapping struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EpicGvgDefenseAttackMapping) Table() string {
|
||||
return "epic_gvg_defense_attack_mapping"
|
||||
}
|
||||
|
||||
func (EpicGvgDefenseAttackMapping) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.Int64("defense_id"),
|
||||
field.Int64("attack_id"),
|
||||
field.String("equipment_info").MaxLen(255),
|
||||
field.String("artifacts").MaxLen(255),
|
||||
field.String("battle_strategy").MaxLen(255),
|
||||
field.String("prerequisites").MaxLen(255),
|
||||
field.String("important_notes").MaxLen(255),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
}
|
||||
}
|
||||
26
internal/domain/entity/epic_gvg_defense_teams.go
Normal file
26
internal/domain/entity/epic_gvg_defense_teams.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type EpicGvgDefenseTeams struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EpicGvgDefenseTeams) Table() string {
|
||||
return "epic_gvg_defense_teams"
|
||||
}
|
||||
|
||||
func (EpicGvgDefenseTeams) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("defense_heroes").MaxLen(255),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
}
|
||||
}
|
||||
38
internal/domain/entity/epic_hero_info.go
Normal file
38
internal/domain/entity/epic_hero_info.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type EpicHeroInfo struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EpicHeroInfo) Table() string {
|
||||
return "epic_hero_info"
|
||||
}
|
||||
|
||||
func (EpicHeroInfo) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("hero_name").MaxLen(255),
|
||||
field.String("hero_code").MaxLen(255),
|
||||
field.String("hero_attr_lv60").MaxLen(255),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
field.String("nick_name").MaxLen(255),
|
||||
field.String("rarity").MaxLen(255),
|
||||
field.String("role").MaxLen(255),
|
||||
field.String("zodiac").MaxLen(255),
|
||||
field.String("head_img_url").MaxLen(255),
|
||||
field.String("attribute").MaxLen(255),
|
||||
field.String("remark").MaxLen(255),
|
||||
field.String("raw_json").MaxLen(255),
|
||||
field.String("set_content_json").MaxLen(255),
|
||||
field.Time("set_update_time").Optional().Nillable(),
|
||||
}
|
||||
}
|
||||
30
internal/domain/entity/epic_hero_user_build.go
Normal file
30
internal/domain/entity/epic_hero_user_build.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type EpicHeroUserBuild struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EpicHeroUserBuild) Table() string {
|
||||
return "epic_hero_user_build"
|
||||
}
|
||||
|
||||
func (EpicHeroUserBuild) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("artifact_code").MaxLen(255),
|
||||
field.String("hero_code").MaxLen(255),
|
||||
field.Float("hero_heath_build"),
|
||||
field.Float("hero_attack_build"),
|
||||
field.Float("hero_def_build"),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
}
|
||||
}
|
||||
31
internal/domain/entity/epic_i18n_mappings.go
Normal file
31
internal/domain/entity/epic_i18n_mappings.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type EpicI18NMappings struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EpicI18NMappings) Table() string {
|
||||
return "epic_i18n_mappings"
|
||||
}
|
||||
|
||||
func (EpicI18NMappings) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("key_name").MaxLen(255),
|
||||
field.String("language").MaxLen(255),
|
||||
field.String("value").MaxLen(255),
|
||||
field.String("category").MaxLen(255),
|
||||
field.Int("status"),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Int("deleted"),
|
||||
field.String("code").MaxLen(255),
|
||||
}
|
||||
}
|
||||
29
internal/domain/entity/fribble_hero_set.go
Normal file
29
internal/domain/entity/fribble_hero_set.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type FribbleHeroSet struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (FribbleHeroSet) Table() string {
|
||||
return "fribble_hero_set"
|
||||
}
|
||||
|
||||
func (FribbleHeroSet) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.String("hero_code").MaxLen(255),
|
||||
field.String("json_content").MaxLen(255),
|
||||
field.String("hero_name").MaxLen(255),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
field.Int("success_get"),
|
||||
}
|
||||
}
|
||||
42
internal/domain/entity/gear_set_info.go
Normal file
42
internal/domain/entity/gear_set_info.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
type GearSetInfo struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (GearSetInfo) Table() string {
|
||||
return "gear_set_info"
|
||||
}
|
||||
|
||||
func (GearSetInfo) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Immutable().Unique(),
|
||||
field.Int("level"),
|
||||
field.Int64("gear_id"),
|
||||
field.Int("enhance"),
|
||||
field.String("gear_type").MaxLen(255),
|
||||
field.String("gear_set_type").MaxLen(255),
|
||||
field.String("main_stat_type").MaxLen(255),
|
||||
field.Int("main_stat_value"),
|
||||
field.String("sub_stat_one_type").MaxLen(255),
|
||||
field.Int("sub_stat_one_value"),
|
||||
field.String("sub_stat_two_type").MaxLen(255),
|
||||
field.Int("sub_stat_two_value"),
|
||||
field.String("sub_stat_three_type").MaxLen(255),
|
||||
field.Int("sub_stat_three_value"),
|
||||
field.String("sub_stat_four_type").MaxLen(255),
|
||||
field.Int("sub_stat_four_value"),
|
||||
field.String("account_code").MaxLen(255),
|
||||
field.String("creator").MaxLen(255),
|
||||
field.Time("create_time").Optional().Nillable(),
|
||||
field.String("updater").MaxLen(255),
|
||||
field.Time("update_time").Optional().Nillable(),
|
||||
field.Bool("deleted"),
|
||||
field.Int64("tenant_id"),
|
||||
}
|
||||
}
|
||||
25
internal/domain/vo/hero.go
Normal file
25
internal/domain/vo/hero.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package vo
|
||||
|
||||
import "time"
|
||||
|
||||
type Hero struct {
|
||||
ID int64 `json:"id"`
|
||||
HeroName string `json:"heroName"`
|
||||
HeroCode string `json:"heroCode"`
|
||||
HeroAttrLv60 string `json:"heroAttrLv60"`
|
||||
Creator string `json:"creator"`
|
||||
CreateTime *time.Time `json:"createTime"`
|
||||
Updater string `json:"updater"`
|
||||
UpdateTime *time.Time `json:"updateTime"`
|
||||
Deleted bool `json:"deleted"`
|
||||
NickName string `json:"nickName"`
|
||||
Rarity string `json:"rarity"`
|
||||
Role string `json:"role"`
|
||||
Zodiac string `json:"zodiac"`
|
||||
HeadImgURL string `json:"headImgUrl"`
|
||||
Attribute string `json:"attribute"`
|
||||
Remark string `json:"remark"`
|
||||
RawJSON string `json:"rawJson"`
|
||||
SetContentJSON string `json:"setContentJson"`
|
||||
SetUpdateTime *time.Time `json:"setUpdateTime"`
|
||||
}
|
||||
22
internal/domain/vo/response.go
Normal file
22
internal/domain/vo/response.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package vo
|
||||
|
||||
type Response struct {
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data any `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func OK(data any) Response {
|
||||
return Response{
|
||||
Code: "OK",
|
||||
Message: "success",
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
func Error(message string) Response {
|
||||
return Response{
|
||||
Code: "ERROR",
|
||||
Message: message,
|
||||
}
|
||||
}
|
||||
1485
internal/ent/client.go
Normal file
1485
internal/ent/client.go
Normal file
File diff suppressed because it is too large
Load Diff
1
internal/ent/doc.go
Normal file
1
internal/ent/doc.go
Normal file
@@ -0,0 +1 @@
|
||||
package ent
|
||||
624
internal/ent/ent.go
Normal file
624
internal/ent/ent.go
Normal file
@@ -0,0 +1,624 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"epic-ent/internal/ent/epicgvgattackteams"
|
||||
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
|
||||
"epic-ent/internal/ent/epicgvgdefenseteams"
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
"epic-ent/internal/ent/epicherouserbuild"
|
||||
"epic-ent/internal/ent/epici18nmappings"
|
||||
"epic-ent/internal/ent/fribbleheroset"
|
||||
"epic-ent/internal/ent/gearsetinfo"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
// ent aliases to avoid import conflicts in user's code.
|
||||
type (
|
||||
Op = ent.Op
|
||||
Hook = ent.Hook
|
||||
Value = ent.Value
|
||||
Query = ent.Query
|
||||
QueryContext = ent.QueryContext
|
||||
Querier = ent.Querier
|
||||
QuerierFunc = ent.QuerierFunc
|
||||
Interceptor = ent.Interceptor
|
||||
InterceptFunc = ent.InterceptFunc
|
||||
Traverser = ent.Traverser
|
||||
TraverseFunc = ent.TraverseFunc
|
||||
Policy = ent.Policy
|
||||
Mutator = ent.Mutator
|
||||
Mutation = ent.Mutation
|
||||
MutateFunc = ent.MutateFunc
|
||||
)
|
||||
|
||||
type clientCtxKey struct{}
|
||||
|
||||
// FromContext returns a Client stored inside a context, or nil if there isn't one.
|
||||
func FromContext(ctx context.Context) *Client {
|
||||
c, _ := ctx.Value(clientCtxKey{}).(*Client)
|
||||
return c
|
||||
}
|
||||
|
||||
// NewContext returns a new context with the given Client attached.
|
||||
func NewContext(parent context.Context, c *Client) context.Context {
|
||||
return context.WithValue(parent, clientCtxKey{}, c)
|
||||
}
|
||||
|
||||
type txCtxKey struct{}
|
||||
|
||||
// TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
|
||||
func TxFromContext(ctx context.Context) *Tx {
|
||||
tx, _ := ctx.Value(txCtxKey{}).(*Tx)
|
||||
return tx
|
||||
}
|
||||
|
||||
// NewTxContext returns a new context with the given Tx attached.
|
||||
func NewTxContext(parent context.Context, tx *Tx) context.Context {
|
||||
return context.WithValue(parent, txCtxKey{}, tx)
|
||||
}
|
||||
|
||||
// OrderFunc applies an ordering on the sql selector.
|
||||
// Deprecated: Use Asc/Desc functions or the package builders instead.
|
||||
type OrderFunc func(*sql.Selector)
|
||||
|
||||
var (
|
||||
initCheck sync.Once
|
||||
columnCheck sql.ColumnCheck
|
||||
)
|
||||
|
||||
// checkColumn checks if the column exists in the given table.
|
||||
func checkColumn(t, c string) error {
|
||||
initCheck.Do(func() {
|
||||
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
|
||||
epicartifactinfo.Table: epicartifactinfo.ValidColumn,
|
||||
epicgvgattackteams.Table: epicgvgattackteams.ValidColumn,
|
||||
epicgvgdefenseattackmapping.Table: epicgvgdefenseattackmapping.ValidColumn,
|
||||
epicgvgdefenseteams.Table: epicgvgdefenseteams.ValidColumn,
|
||||
epicheroinfo.Table: epicheroinfo.ValidColumn,
|
||||
epicherouserbuild.Table: epicherouserbuild.ValidColumn,
|
||||
epici18nmappings.Table: epici18nmappings.ValidColumn,
|
||||
fribbleheroset.Table: fribbleheroset.ValidColumn,
|
||||
gearsetinfo.Table: gearsetinfo.ValidColumn,
|
||||
})
|
||||
})
|
||||
return columnCheck(t, c)
|
||||
}
|
||||
|
||||
// Asc applies the given fields in ASC order.
|
||||
func Asc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
for _, f := range fields {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Asc(s.C(f)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Desc applies the given fields in DESC order.
|
||||
func Desc(fields ...string) func(*sql.Selector) {
|
||||
return func(s *sql.Selector) {
|
||||
for _, f := range fields {
|
||||
if err := checkColumn(s.TableName(), f); err != nil {
|
||||
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
|
||||
}
|
||||
s.OrderBy(sql.Desc(s.C(f)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AggregateFunc applies an aggregation step on the group-by traversal/selector.
|
||||
type AggregateFunc func(*sql.Selector) string
|
||||
|
||||
// As is a pseudo aggregation function for renaming another other functions with custom names. For example:
|
||||
//
|
||||
// GroupBy(field1, field2).
|
||||
// Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
|
||||
// Scan(ctx, &v)
|
||||
func As(fn AggregateFunc, end string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
return sql.As(fn(s), end)
|
||||
}
|
||||
}
|
||||
|
||||
// Count applies the "count" aggregation function on each group.
|
||||
func Count() AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
return sql.Count("*")
|
||||
}
|
||||
}
|
||||
|
||||
// Max applies the "max" aggregation function on the given field of each group.
|
||||
func Max(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
return sql.Max(s.C(field))
|
||||
}
|
||||
}
|
||||
|
||||
// Mean applies the "mean" aggregation function on the given field of each group.
|
||||
func Mean(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
return sql.Avg(s.C(field))
|
||||
}
|
||||
}
|
||||
|
||||
// Min applies the "min" aggregation function on the given field of each group.
|
||||
func Min(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
return sql.Min(s.C(field))
|
||||
}
|
||||
}
|
||||
|
||||
// Sum applies the "sum" aggregation function on the given field of each group.
|
||||
func Sum(field string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
if err := checkColumn(s.TableName(), field); err != nil {
|
||||
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
|
||||
return ""
|
||||
}
|
||||
return sql.Sum(s.C(field))
|
||||
}
|
||||
}
|
||||
|
||||
// ValidationError returns when validating a field or edge fails.
|
||||
type ValidationError struct {
|
||||
Name string // Field or edge name.
|
||||
err error
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e *ValidationError) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// Unwrap implements the errors.Wrapper interface.
|
||||
func (e *ValidationError) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// IsValidationError returns a boolean indicating whether the error is a validation error.
|
||||
func IsValidationError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
var e *ValidationError
|
||||
return errors.As(err, &e)
|
||||
}
|
||||
|
||||
// NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
|
||||
type NotFoundError struct {
|
||||
label string
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e *NotFoundError) Error() string {
|
||||
return "ent: " + e.label + " not found"
|
||||
}
|
||||
|
||||
// IsNotFound returns a boolean indicating whether the error is a not found error.
|
||||
func IsNotFound(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
var e *NotFoundError
|
||||
return errors.As(err, &e)
|
||||
}
|
||||
|
||||
// MaskNotFound masks not found error.
|
||||
func MaskNotFound(err error) error {
|
||||
if IsNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
|
||||
type NotSingularError struct {
|
||||
label string
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e *NotSingularError) Error() string {
|
||||
return "ent: " + e.label + " not singular"
|
||||
}
|
||||
|
||||
// IsNotSingular returns a boolean indicating whether the error is a not singular error.
|
||||
func IsNotSingular(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
var e *NotSingularError
|
||||
return errors.As(err, &e)
|
||||
}
|
||||
|
||||
// NotLoadedError returns when trying to get a node that was not loaded by the query.
|
||||
type NotLoadedError struct {
|
||||
edge string
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e *NotLoadedError) Error() string {
|
||||
return "ent: " + e.edge + " edge was not loaded"
|
||||
}
|
||||
|
||||
// IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
|
||||
func IsNotLoaded(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
var e *NotLoadedError
|
||||
return errors.As(err, &e)
|
||||
}
|
||||
|
||||
// ConstraintError returns when trying to create/update one or more entities and
|
||||
// one or more of their constraints failed. For example, violation of edge or
|
||||
// field uniqueness.
|
||||
type ConstraintError struct {
|
||||
msg string
|
||||
wrap error
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e ConstraintError) Error() string {
|
||||
return "ent: constraint failed: " + e.msg
|
||||
}
|
||||
|
||||
// Unwrap implements the errors.Wrapper interface.
|
||||
func (e *ConstraintError) Unwrap() error {
|
||||
return e.wrap
|
||||
}
|
||||
|
||||
// IsConstraintError returns a boolean indicating whether the error is a constraint failure.
|
||||
func IsConstraintError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
var e *ConstraintError
|
||||
return errors.As(err, &e)
|
||||
}
|
||||
|
||||
// selector embedded by the different Select/GroupBy builders.
|
||||
type selector struct {
|
||||
label string
|
||||
flds *[]string
|
||||
fns []AggregateFunc
|
||||
scan func(context.Context, any) error
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (s *selector) ScanX(ctx context.Context, v any) {
|
||||
if err := s.scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Strings(ctx context.Context) ([]string, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Strings is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []string
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// StringsX is like Strings, but panics if an error occurs.
|
||||
func (s *selector) StringsX(ctx context.Context) []string {
|
||||
v, err := s.Strings(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// String returns a single string from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) String(ctx context.Context) (_ string, err error) {
|
||||
var v []string
|
||||
if v, err = s.Strings(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Strings returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StringX is like String, but panics if an error occurs.
|
||||
func (s *selector) StringX(ctx context.Context) string {
|
||||
v, err := s.String(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Ints returns list of ints from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Ints(ctx context.Context) ([]int, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []int
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// IntsX is like Ints, but panics if an error occurs.
|
||||
func (s *selector) IntsX(ctx context.Context) []int {
|
||||
v, err := s.Ints(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Int returns a single int from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Int(ctx context.Context) (_ int, err error) {
|
||||
var v []int
|
||||
if v, err = s.Ints(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// IntX is like Int, but panics if an error occurs.
|
||||
func (s *selector) IntX(ctx context.Context) int {
|
||||
v, err := s.Int(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Float64s(ctx context.Context) ([]float64, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Float64s is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []float64
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Float64sX is like Float64s, but panics if an error occurs.
|
||||
func (s *selector) Float64sX(ctx context.Context) []float64 {
|
||||
v, err := s.Float64s(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Float64(ctx context.Context) (_ float64, err error) {
|
||||
var v []float64
|
||||
if v, err = s.Float64s(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Float64s returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Float64X is like Float64, but panics if an error occurs.
|
||||
func (s *selector) Float64X(ctx context.Context) float64 {
|
||||
v, err := s.Float64(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bools returns list of bools from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Bools(ctx context.Context) ([]bool, error) {
|
||||
if len(*s.flds) > 1 {
|
||||
return nil, errors.New("ent: Bools is not achievable when selecting more than 1 field")
|
||||
}
|
||||
var v []bool
|
||||
if err := s.scan(ctx, &v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoolsX is like Bools, but panics if an error occurs.
|
||||
func (s *selector) BoolsX(ctx context.Context) []bool {
|
||||
v, err := s.Bools(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Bool returns a single bool from a selector. It is only allowed when selecting one field.
|
||||
func (s *selector) Bool(ctx context.Context) (_ bool, err error) {
|
||||
var v []bool
|
||||
if v, err = s.Bools(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(v) {
|
||||
case 1:
|
||||
return v[0], nil
|
||||
case 0:
|
||||
err = &NotFoundError{s.label}
|
||||
default:
|
||||
err = fmt.Errorf("ent: Bools returned %d results when one was expected", len(v))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BoolX is like Bool, but panics if an error occurs.
|
||||
func (s *selector) BoolX(ctx context.Context) bool {
|
||||
v, err := s.Bool(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// withHooks invokes the builder operation with the given hooks, if any.
|
||||
func withHooks[V Value, M any, PM interface {
|
||||
*M
|
||||
Mutation
|
||||
}](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) {
|
||||
if len(hooks) == 0 {
|
||||
return exec(ctx)
|
||||
}
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutationT, ok := any(m).(PM)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
// Set the mutation to the builder.
|
||||
*mutation = *mutationT
|
||||
return exec(ctx)
|
||||
})
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
if hooks[i] == nil {
|
||||
return value, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = hooks[i](mut)
|
||||
}
|
||||
v, err := mut.Mutate(ctx, mutation)
|
||||
if err != nil {
|
||||
return value, err
|
||||
}
|
||||
nv, ok := v.(V)
|
||||
if !ok {
|
||||
return value, fmt.Errorf("unexpected node type %T returned from %T", v, mutation)
|
||||
}
|
||||
return nv, nil
|
||||
}
|
||||
|
||||
// setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist.
|
||||
func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context {
|
||||
if ent.QueryFromContext(ctx) == nil {
|
||||
qc.Op = op
|
||||
ctx = ent.NewQueryContext(ctx, qc)
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
func querierAll[V Value, Q interface {
|
||||
sqlAll(context.Context, ...queryHook) (V, error)
|
||||
}]() Querier {
|
||||
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
return query.sqlAll(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func querierCount[Q interface {
|
||||
sqlCount(context.Context) (int, error)
|
||||
}]() Querier {
|
||||
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
return query.sqlCount(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func withInterceptors[V Value](ctx context.Context, q Query, qr Querier, inters []Interceptor) (v V, err error) {
|
||||
for i := len(inters) - 1; i >= 0; i-- {
|
||||
qr = inters[i].Intercept(qr)
|
||||
}
|
||||
rv, err := qr.Query(ctx, q)
|
||||
if err != nil {
|
||||
return v, err
|
||||
}
|
||||
vt, ok := rv.(V)
|
||||
if !ok {
|
||||
return v, fmt.Errorf("unexpected type %T returned from %T. expected type: %T", vt, q, v)
|
||||
}
|
||||
return vt, nil
|
||||
}
|
||||
|
||||
func scanWithInterceptors[Q1 ent.Query, Q2 interface {
|
||||
sqlScan(context.Context, Q1, any) error
|
||||
}](ctx context.Context, rootQuery Q1, selectOrGroup Q2, inters []Interceptor, v any) error {
|
||||
rv := reflect.ValueOf(v)
|
||||
var qr Querier = QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
|
||||
query, ok := q.(Q1)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected query type %T", q)
|
||||
}
|
||||
if err := selectOrGroup.sqlScan(ctx, query, v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if k := rv.Kind(); k == reflect.Pointer && rv.Elem().CanInterface() {
|
||||
return rv.Elem().Interface(), nil
|
||||
}
|
||||
return v, nil
|
||||
})
|
||||
for i := len(inters) - 1; i >= 0; i-- {
|
||||
qr = inters[i].Intercept(qr)
|
||||
}
|
||||
vv, err := qr.Query(ctx, rootQuery)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch rv2 := reflect.ValueOf(vv); {
|
||||
case rv.IsNil(), rv2.IsNil(), rv.Kind() != reflect.Pointer:
|
||||
case rv.Type() == rv2.Type():
|
||||
rv.Elem().Set(rv2.Elem())
|
||||
case rv.Elem().Type() == rv2.Type():
|
||||
rv.Elem().Set(rv2)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// queryHook describes an internal hook for the different sqlAll methods.
|
||||
type queryHook func(context.Context, *sqlgraph.QuerySpec)
|
||||
85
internal/ent/enttest/enttest.go
Normal file
85
internal/ent/enttest/enttest.go
Normal file
@@ -0,0 +1,85 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package enttest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"epic-ent/internal/ent"
|
||||
// required by schema hooks.
|
||||
_ "epic-ent/internal/ent/runtime"
|
||||
|
||||
"epic-ent/internal/ent/migrate"
|
||||
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
)
|
||||
|
||||
type (
|
||||
// TestingT is the interface that is shared between
|
||||
// testing.T and testing.B and used by enttest.
|
||||
TestingT interface {
|
||||
FailNow()
|
||||
Error(...any)
|
||||
}
|
||||
|
||||
// Option configures client creation.
|
||||
Option func(*options)
|
||||
|
||||
options struct {
|
||||
opts []ent.Option
|
||||
migrateOpts []schema.MigrateOption
|
||||
}
|
||||
)
|
||||
|
||||
// WithOptions forwards options to client creation.
|
||||
func WithOptions(opts ...ent.Option) Option {
|
||||
return func(o *options) {
|
||||
o.opts = append(o.opts, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithMigrateOptions forwards options to auto migration.
|
||||
func WithMigrateOptions(opts ...schema.MigrateOption) Option {
|
||||
return func(o *options) {
|
||||
o.migrateOpts = append(o.migrateOpts, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
func newOptions(opts []Option) *options {
|
||||
o := &options{}
|
||||
for _, opt := range opts {
|
||||
opt(o)
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
// Open calls ent.Open and auto-run migration.
|
||||
func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Client {
|
||||
o := newOptions(opts)
|
||||
c, err := ent.Open(driverName, dataSourceName, o.opts...)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
migrateSchema(t, c, o)
|
||||
return c
|
||||
}
|
||||
|
||||
// NewClient calls ent.NewClient and auto-run migration.
|
||||
func NewClient(t TestingT, opts ...Option) *ent.Client {
|
||||
o := newOptions(opts)
|
||||
c := ent.NewClient(o.opts...)
|
||||
migrateSchema(t, c, o)
|
||||
return c
|
||||
}
|
||||
func migrateSchema(t TestingT, c *ent.Client, o *options) {
|
||||
tables, err := schema.CopyTables(migrate.Tables)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
257
internal/ent/epicartifactinfo.go
Normal file
257
internal/ent/epicartifactinfo.go
Normal file
@@ -0,0 +1,257 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicArtifactInfo is the model entity for the EpicArtifactInfo schema.
|
||||
type EpicArtifactInfo struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// ArtifactName holds the value of the "artifact_name" field.
|
||||
ArtifactName string `json:"artifact_name,omitempty"`
|
||||
// ArtifactCode holds the value of the "artifact_code" field.
|
||||
ArtifactCode string `json:"artifact_code,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
// StatsHealth holds the value of the "stats_health" field.
|
||||
StatsHealth int `json:"stats_health,omitempty"`
|
||||
// StatsAttack holds the value of the "stats_attack" field.
|
||||
StatsAttack int `json:"stats_attack,omitempty"`
|
||||
// StatsDefense holds the value of the "stats_defense" field.
|
||||
StatsDefense int `json:"stats_defense,omitempty"`
|
||||
// Rarity holds the value of the "rarity" field.
|
||||
Rarity string `json:"rarity,omitempty"`
|
||||
// Role holds the value of the "role" field.
|
||||
Role string `json:"role,omitempty"`
|
||||
// ArtifactNameEn holds the value of the "artifact_name_en" field.
|
||||
ArtifactNameEn string `json:"artifact_name_en,omitempty"`
|
||||
// ImageURL holds the value of the "image_url" field.
|
||||
ImageURL string `json:"image_url,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicArtifactInfo) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicartifactinfo.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case epicartifactinfo.FieldID, epicartifactinfo.FieldStatsHealth, epicartifactinfo.FieldStatsAttack, epicartifactinfo.FieldStatsDefense:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epicartifactinfo.FieldArtifactName, epicartifactinfo.FieldArtifactCode, epicartifactinfo.FieldCreator, epicartifactinfo.FieldUpdater, epicartifactinfo.FieldRarity, epicartifactinfo.FieldRole, epicartifactinfo.FieldArtifactNameEn, epicartifactinfo.FieldImageURL:
|
||||
values[i] = new(sql.NullString)
|
||||
case epicartifactinfo.FieldCreateTime, epicartifactinfo.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the EpicArtifactInfo fields.
|
||||
func (_m *EpicArtifactInfo) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicartifactinfo.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epicartifactinfo.FieldArtifactName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifact_name", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ArtifactName = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldArtifactCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifact_code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ArtifactCode = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epicartifactinfo.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epicartifactinfo.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
case epicartifactinfo.FieldStatsHealth:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field stats_health", values[i])
|
||||
} else if value.Valid {
|
||||
_m.StatsHealth = int(value.Int64)
|
||||
}
|
||||
case epicartifactinfo.FieldStatsAttack:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field stats_attack", values[i])
|
||||
} else if value.Valid {
|
||||
_m.StatsAttack = int(value.Int64)
|
||||
}
|
||||
case epicartifactinfo.FieldStatsDefense:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field stats_defense", values[i])
|
||||
} else if value.Valid {
|
||||
_m.StatsDefense = int(value.Int64)
|
||||
}
|
||||
case epicartifactinfo.FieldRarity:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field rarity", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Rarity = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldRole:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field role", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Role = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldArtifactNameEn:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifact_name_en", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ArtifactNameEn = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldImageURL:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field image_url", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ImageURL = value.String
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the EpicArtifactInfo.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicArtifactInfo) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicArtifactInfo.
|
||||
// Note that you need to call EpicArtifactInfo.Unwrap() before calling this method if this EpicArtifactInfo
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicArtifactInfo) Update() *EpicArtifactInfoUpdateOne {
|
||||
return NewEpicArtifactInfoClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicArtifactInfo 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 *EpicArtifactInfo) Unwrap() *EpicArtifactInfo {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicArtifactInfo is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicArtifactInfo) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicArtifactInfo(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("artifact_name=")
|
||||
builder.WriteString(_m.ArtifactName)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("artifact_code=")
|
||||
builder.WriteString(_m.ArtifactCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("stats_health=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.StatsHealth))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("stats_attack=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.StatsAttack))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("stats_defense=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.StatsDefense))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("rarity=")
|
||||
builder.WriteString(_m.Rarity)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("role=")
|
||||
builder.WriteString(_m.Role)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("artifact_name_en=")
|
||||
builder.WriteString(_m.ArtifactNameEn)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("image_url=")
|
||||
builder.WriteString(_m.ImageURL)
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicArtifactInfos is a parsable slice of EpicArtifactInfo.
|
||||
type EpicArtifactInfos []*EpicArtifactInfo
|
||||
170
internal/ent/epicartifactinfo/epicartifactinfo.go
Normal file
170
internal/ent/epicartifactinfo/epicartifactinfo.go
Normal file
@@ -0,0 +1,170 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicartifactinfo
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the epicartifactinfo type in the database.
|
||||
Label = "epic_artifact_info"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldArtifactName holds the string denoting the artifact_name field in the database.
|
||||
FieldArtifactName = "artifact_name"
|
||||
// FieldArtifactCode holds the string denoting the artifact_code field in the database.
|
||||
FieldArtifactCode = "artifact_code"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// FieldStatsHealth holds the string denoting the stats_health field in the database.
|
||||
FieldStatsHealth = "stats_health"
|
||||
// FieldStatsAttack holds the string denoting the stats_attack field in the database.
|
||||
FieldStatsAttack = "stats_attack"
|
||||
// FieldStatsDefense holds the string denoting the stats_defense field in the database.
|
||||
FieldStatsDefense = "stats_defense"
|
||||
// FieldRarity holds the string denoting the rarity field in the database.
|
||||
FieldRarity = "rarity"
|
||||
// FieldRole holds the string denoting the role field in the database.
|
||||
FieldRole = "role"
|
||||
// FieldArtifactNameEn holds the string denoting the artifact_name_en field in the database.
|
||||
FieldArtifactNameEn = "artifact_name_en"
|
||||
// FieldImageURL holds the string denoting the image_url field in the database.
|
||||
FieldImageURL = "image_url"
|
||||
// Table holds the table name of the epicartifactinfo in the database.
|
||||
Table = "epic_artifact_infos"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for epicartifactinfo fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldArtifactName,
|
||||
FieldArtifactCode,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
FieldStatsHealth,
|
||||
FieldStatsAttack,
|
||||
FieldStatsDefense,
|
||||
FieldRarity,
|
||||
FieldRole,
|
||||
FieldArtifactNameEn,
|
||||
FieldImageURL,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// ArtifactNameValidator is a validator for the "artifact_name" field. It is called by the builders before save.
|
||||
ArtifactNameValidator func(string) error
|
||||
// ArtifactCodeValidator is a validator for the "artifact_code" field. It is called by the builders before save.
|
||||
ArtifactCodeValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
// RarityValidator is a validator for the "rarity" field. It is called by the builders before save.
|
||||
RarityValidator func(string) error
|
||||
// RoleValidator is a validator for the "role" field. It is called by the builders before save.
|
||||
RoleValidator func(string) error
|
||||
// ArtifactNameEnValidator is a validator for the "artifact_name_en" field. It is called by the builders before save.
|
||||
ArtifactNameEnValidator func(string) error
|
||||
// ImageURLValidator is a validator for the "image_url" field. It is called by the builders before save.
|
||||
ImageURLValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the EpicArtifactInfo queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByArtifactName orders the results by the artifact_name field.
|
||||
func ByArtifactName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldArtifactName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByArtifactCode orders the results by the artifact_code field.
|
||||
func ByArtifactCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldArtifactCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatsHealth orders the results by the stats_health field.
|
||||
func ByStatsHealth(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatsHealth, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatsAttack orders the results by the stats_attack field.
|
||||
func ByStatsAttack(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatsAttack, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatsDefense orders the results by the stats_defense field.
|
||||
func ByStatsDefense(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatsDefense, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRarity orders the results by the rarity field.
|
||||
func ByRarity(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRarity, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRole orders the results by the role field.
|
||||
func ByRole(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRole, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByArtifactNameEn orders the results by the artifact_name_en field.
|
||||
func ByArtifactNameEn(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldArtifactNameEn, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByImageURL orders the results by the image_url field.
|
||||
func ByImageURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldImageURL, opts...).ToFunc()
|
||||
}
|
||||
890
internal/ent/epicartifactinfo/where.go
Normal file
890
internal/ent/epicartifactinfo/where.go
Normal file
@@ -0,0 +1,890 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicartifactinfo
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// ArtifactName applies equality check predicate on the "artifact_name" field. It's identical to ArtifactNameEQ.
|
||||
func ArtifactName(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactCode applies equality check predicate on the "artifact_code" field. It's identical to ArtifactCodeEQ.
|
||||
func ArtifactCode(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// Creator applies equality check predicate on the "creator" field. It's identical to CreatorEQ.
|
||||
func Creator(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// Updater applies equality check predicate on the "updater" field. It's identical to UpdaterEQ.
|
||||
func Updater(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||
func Deleted(v bool) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// StatsHealth applies equality check predicate on the "stats_health" field. It's identical to StatsHealthEQ.
|
||||
func StatsHealth(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldStatsHealth, v))
|
||||
}
|
||||
|
||||
// StatsAttack applies equality check predicate on the "stats_attack" field. It's identical to StatsAttackEQ.
|
||||
func StatsAttack(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldStatsAttack, v))
|
||||
}
|
||||
|
||||
// StatsDefense applies equality check predicate on the "stats_defense" field. It's identical to StatsDefenseEQ.
|
||||
func StatsDefense(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldStatsDefense, v))
|
||||
}
|
||||
|
||||
// Rarity applies equality check predicate on the "rarity" field. It's identical to RarityEQ.
|
||||
func Rarity(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldRarity, v))
|
||||
}
|
||||
|
||||
// Role applies equality check predicate on the "role" field. It's identical to RoleEQ.
|
||||
func Role(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldRole, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEn applies equality check predicate on the "artifact_name_en" field. It's identical to ArtifactNameEnEQ.
|
||||
func ArtifactNameEn(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ImageURL applies equality check predicate on the "image_url" field. It's identical to ImageURLEQ.
|
||||
func ImageURL(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEQ applies the EQ predicate on the "artifact_name" field.
|
||||
func ArtifactNameEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameNEQ applies the NEQ predicate on the "artifact_name" field.
|
||||
func ArtifactNameNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameIn applies the In predicate on the "artifact_name" field.
|
||||
func ArtifactNameIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldArtifactName, vs...))
|
||||
}
|
||||
|
||||
// ArtifactNameNotIn applies the NotIn predicate on the "artifact_name" field.
|
||||
func ArtifactNameNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldArtifactName, vs...))
|
||||
}
|
||||
|
||||
// ArtifactNameGT applies the GT predicate on the "artifact_name" field.
|
||||
func ArtifactNameGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameGTE applies the GTE predicate on the "artifact_name" field.
|
||||
func ArtifactNameGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameLT applies the LT predicate on the "artifact_name" field.
|
||||
func ArtifactNameLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameLTE applies the LTE predicate on the "artifact_name" field.
|
||||
func ArtifactNameLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameContains applies the Contains predicate on the "artifact_name" field.
|
||||
func ArtifactNameContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameHasPrefix applies the HasPrefix predicate on the "artifact_name" field.
|
||||
func ArtifactNameHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameHasSuffix applies the HasSuffix predicate on the "artifact_name" field.
|
||||
func ArtifactNameHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEqualFold applies the EqualFold predicate on the "artifact_name" field.
|
||||
func ArtifactNameEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactNameContainsFold applies the ContainsFold predicate on the "artifact_name" field.
|
||||
func ArtifactNameContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldArtifactName, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeEQ applies the EQ predicate on the "artifact_code" field.
|
||||
func ArtifactCodeEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeNEQ applies the NEQ predicate on the "artifact_code" field.
|
||||
func ArtifactCodeNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeIn applies the In predicate on the "artifact_code" field.
|
||||
func ArtifactCodeIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldArtifactCode, vs...))
|
||||
}
|
||||
|
||||
// ArtifactCodeNotIn applies the NotIn predicate on the "artifact_code" field.
|
||||
func ArtifactCodeNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldArtifactCode, vs...))
|
||||
}
|
||||
|
||||
// ArtifactCodeGT applies the GT predicate on the "artifact_code" field.
|
||||
func ArtifactCodeGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeGTE applies the GTE predicate on the "artifact_code" field.
|
||||
func ArtifactCodeGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeLT applies the LT predicate on the "artifact_code" field.
|
||||
func ArtifactCodeLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeLTE applies the LTE predicate on the "artifact_code" field.
|
||||
func ArtifactCodeLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeContains applies the Contains predicate on the "artifact_code" field.
|
||||
func ArtifactCodeContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeHasPrefix applies the HasPrefix predicate on the "artifact_code" field.
|
||||
func ArtifactCodeHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeHasSuffix applies the HasSuffix predicate on the "artifact_code" field.
|
||||
func ArtifactCodeHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeEqualFold applies the EqualFold predicate on the "artifact_code" field.
|
||||
func ArtifactCodeEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeContainsFold applies the ContainsFold predicate on the "artifact_code" field.
|
||||
func ArtifactCodeContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// CreatorEQ applies the EQ predicate on the "creator" field.
|
||||
func CreatorEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorNEQ applies the NEQ predicate on the "creator" field.
|
||||
func CreatorNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorIn applies the In predicate on the "creator" field.
|
||||
func CreatorIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorNotIn applies the NotIn predicate on the "creator" field.
|
||||
func CreatorNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorGT applies the GT predicate on the "creator" field.
|
||||
func CreatorGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorGTE applies the GTE predicate on the "creator" field.
|
||||
func CreatorGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLT applies the LT predicate on the "creator" field.
|
||||
func CreatorLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLTE applies the LTE predicate on the "creator" field.
|
||||
func CreatorLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContains applies the Contains predicate on the "creator" field.
|
||||
func CreatorContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasPrefix applies the HasPrefix predicate on the "creator" field.
|
||||
func CreatorHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasSuffix applies the HasSuffix predicate on the "creator" field.
|
||||
func CreatorHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorEqualFold applies the EqualFold predicate on the "creator" field.
|
||||
func CreatorEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContainsFold applies the ContainsFold predicate on the "creator" field.
|
||||
func CreatorContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIsNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// UpdaterEQ applies the EQ predicate on the "updater" field.
|
||||
func UpdaterEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterNEQ applies the NEQ predicate on the "updater" field.
|
||||
func UpdaterNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterIn applies the In predicate on the "updater" field.
|
||||
func UpdaterIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterNotIn applies the NotIn predicate on the "updater" field.
|
||||
func UpdaterNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterGT applies the GT predicate on the "updater" field.
|
||||
func UpdaterGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterGTE applies the GTE predicate on the "updater" field.
|
||||
func UpdaterGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLT applies the LT predicate on the "updater" field.
|
||||
func UpdaterLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLTE applies the LTE predicate on the "updater" field.
|
||||
func UpdaterLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContains applies the Contains predicate on the "updater" field.
|
||||
func UpdaterContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasPrefix applies the HasPrefix predicate on the "updater" field.
|
||||
func UpdaterHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasSuffix applies the HasSuffix predicate on the "updater" field.
|
||||
func UpdaterHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterEqualFold applies the EqualFold predicate on the "updater" field.
|
||||
func UpdaterEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContainsFold applies the ContainsFold predicate on the "updater" field.
|
||||
func UpdaterContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v time.Time) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIsNil applies the IsNil predicate on the "update_time" field.
|
||||
func UpdateTimeIsNil() predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIsNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// UpdateTimeNotNil applies the NotNil predicate on the "update_time" field.
|
||||
func UpdateTimeNotNil() predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||
func DeletedEQ(v bool) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||
func DeletedNEQ(v bool) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// StatsHealthEQ applies the EQ predicate on the "stats_health" field.
|
||||
func StatsHealthEQ(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldStatsHealth, v))
|
||||
}
|
||||
|
||||
// StatsHealthNEQ applies the NEQ predicate on the "stats_health" field.
|
||||
func StatsHealthNEQ(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldStatsHealth, v))
|
||||
}
|
||||
|
||||
// StatsHealthIn applies the In predicate on the "stats_health" field.
|
||||
func StatsHealthIn(vs ...int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldStatsHealth, vs...))
|
||||
}
|
||||
|
||||
// StatsHealthNotIn applies the NotIn predicate on the "stats_health" field.
|
||||
func StatsHealthNotIn(vs ...int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldStatsHealth, vs...))
|
||||
}
|
||||
|
||||
// StatsHealthGT applies the GT predicate on the "stats_health" field.
|
||||
func StatsHealthGT(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldStatsHealth, v))
|
||||
}
|
||||
|
||||
// StatsHealthGTE applies the GTE predicate on the "stats_health" field.
|
||||
func StatsHealthGTE(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldStatsHealth, v))
|
||||
}
|
||||
|
||||
// StatsHealthLT applies the LT predicate on the "stats_health" field.
|
||||
func StatsHealthLT(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldStatsHealth, v))
|
||||
}
|
||||
|
||||
// StatsHealthLTE applies the LTE predicate on the "stats_health" field.
|
||||
func StatsHealthLTE(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldStatsHealth, v))
|
||||
}
|
||||
|
||||
// StatsAttackEQ applies the EQ predicate on the "stats_attack" field.
|
||||
func StatsAttackEQ(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldStatsAttack, v))
|
||||
}
|
||||
|
||||
// StatsAttackNEQ applies the NEQ predicate on the "stats_attack" field.
|
||||
func StatsAttackNEQ(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldStatsAttack, v))
|
||||
}
|
||||
|
||||
// StatsAttackIn applies the In predicate on the "stats_attack" field.
|
||||
func StatsAttackIn(vs ...int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldStatsAttack, vs...))
|
||||
}
|
||||
|
||||
// StatsAttackNotIn applies the NotIn predicate on the "stats_attack" field.
|
||||
func StatsAttackNotIn(vs ...int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldStatsAttack, vs...))
|
||||
}
|
||||
|
||||
// StatsAttackGT applies the GT predicate on the "stats_attack" field.
|
||||
func StatsAttackGT(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldStatsAttack, v))
|
||||
}
|
||||
|
||||
// StatsAttackGTE applies the GTE predicate on the "stats_attack" field.
|
||||
func StatsAttackGTE(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldStatsAttack, v))
|
||||
}
|
||||
|
||||
// StatsAttackLT applies the LT predicate on the "stats_attack" field.
|
||||
func StatsAttackLT(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldStatsAttack, v))
|
||||
}
|
||||
|
||||
// StatsAttackLTE applies the LTE predicate on the "stats_attack" field.
|
||||
func StatsAttackLTE(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldStatsAttack, v))
|
||||
}
|
||||
|
||||
// StatsDefenseEQ applies the EQ predicate on the "stats_defense" field.
|
||||
func StatsDefenseEQ(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldStatsDefense, v))
|
||||
}
|
||||
|
||||
// StatsDefenseNEQ applies the NEQ predicate on the "stats_defense" field.
|
||||
func StatsDefenseNEQ(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldStatsDefense, v))
|
||||
}
|
||||
|
||||
// StatsDefenseIn applies the In predicate on the "stats_defense" field.
|
||||
func StatsDefenseIn(vs ...int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldStatsDefense, vs...))
|
||||
}
|
||||
|
||||
// StatsDefenseNotIn applies the NotIn predicate on the "stats_defense" field.
|
||||
func StatsDefenseNotIn(vs ...int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldStatsDefense, vs...))
|
||||
}
|
||||
|
||||
// StatsDefenseGT applies the GT predicate on the "stats_defense" field.
|
||||
func StatsDefenseGT(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldStatsDefense, v))
|
||||
}
|
||||
|
||||
// StatsDefenseGTE applies the GTE predicate on the "stats_defense" field.
|
||||
func StatsDefenseGTE(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldStatsDefense, v))
|
||||
}
|
||||
|
||||
// StatsDefenseLT applies the LT predicate on the "stats_defense" field.
|
||||
func StatsDefenseLT(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldStatsDefense, v))
|
||||
}
|
||||
|
||||
// StatsDefenseLTE applies the LTE predicate on the "stats_defense" field.
|
||||
func StatsDefenseLTE(v int) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldStatsDefense, v))
|
||||
}
|
||||
|
||||
// RarityEQ applies the EQ predicate on the "rarity" field.
|
||||
func RarityEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityNEQ applies the NEQ predicate on the "rarity" field.
|
||||
func RarityNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityIn applies the In predicate on the "rarity" field.
|
||||
func RarityIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldRarity, vs...))
|
||||
}
|
||||
|
||||
// RarityNotIn applies the NotIn predicate on the "rarity" field.
|
||||
func RarityNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldRarity, vs...))
|
||||
}
|
||||
|
||||
// RarityGT applies the GT predicate on the "rarity" field.
|
||||
func RarityGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityGTE applies the GTE predicate on the "rarity" field.
|
||||
func RarityGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityLT applies the LT predicate on the "rarity" field.
|
||||
func RarityLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityLTE applies the LTE predicate on the "rarity" field.
|
||||
func RarityLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityContains applies the Contains predicate on the "rarity" field.
|
||||
func RarityContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityHasPrefix applies the HasPrefix predicate on the "rarity" field.
|
||||
func RarityHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityHasSuffix applies the HasSuffix predicate on the "rarity" field.
|
||||
func RarityHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityEqualFold applies the EqualFold predicate on the "rarity" field.
|
||||
func RarityEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RarityContainsFold applies the ContainsFold predicate on the "rarity" field.
|
||||
func RarityContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldRarity, v))
|
||||
}
|
||||
|
||||
// RoleEQ applies the EQ predicate on the "role" field.
|
||||
func RoleEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleNEQ applies the NEQ predicate on the "role" field.
|
||||
func RoleNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleIn applies the In predicate on the "role" field.
|
||||
func RoleIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldRole, vs...))
|
||||
}
|
||||
|
||||
// RoleNotIn applies the NotIn predicate on the "role" field.
|
||||
func RoleNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldRole, vs...))
|
||||
}
|
||||
|
||||
// RoleGT applies the GT predicate on the "role" field.
|
||||
func RoleGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleGTE applies the GTE predicate on the "role" field.
|
||||
func RoleGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleLT applies the LT predicate on the "role" field.
|
||||
func RoleLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleLTE applies the LTE predicate on the "role" field.
|
||||
func RoleLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleContains applies the Contains predicate on the "role" field.
|
||||
func RoleContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleHasPrefix applies the HasPrefix predicate on the "role" field.
|
||||
func RoleHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleHasSuffix applies the HasSuffix predicate on the "role" field.
|
||||
func RoleHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleEqualFold applies the EqualFold predicate on the "role" field.
|
||||
func RoleEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldRole, v))
|
||||
}
|
||||
|
||||
// RoleContainsFold applies the ContainsFold predicate on the "role" field.
|
||||
func RoleContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldRole, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnEQ applies the EQ predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnNEQ applies the NEQ predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnIn applies the In predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldArtifactNameEn, vs...))
|
||||
}
|
||||
|
||||
// ArtifactNameEnNotIn applies the NotIn predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldArtifactNameEn, vs...))
|
||||
}
|
||||
|
||||
// ArtifactNameEnGT applies the GT predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnGTE applies the GTE predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnLT applies the LT predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnLTE applies the LTE predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnContains applies the Contains predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnHasPrefix applies the HasPrefix predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnHasSuffix applies the HasSuffix predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnEqualFold applies the EqualFold predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ArtifactNameEnContainsFold applies the ContainsFold predicate on the "artifact_name_en" field.
|
||||
func ArtifactNameEnContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldArtifactNameEn, v))
|
||||
}
|
||||
|
||||
// ImageURLEQ applies the EQ predicate on the "image_url" field.
|
||||
func ImageURLEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEQ(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLNEQ applies the NEQ predicate on the "image_url" field.
|
||||
func ImageURLNEQ(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNEQ(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLIn applies the In predicate on the "image_url" field.
|
||||
func ImageURLIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldIn(FieldImageURL, vs...))
|
||||
}
|
||||
|
||||
// ImageURLNotIn applies the NotIn predicate on the "image_url" field.
|
||||
func ImageURLNotIn(vs ...string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldNotIn(FieldImageURL, vs...))
|
||||
}
|
||||
|
||||
// ImageURLGT applies the GT predicate on the "image_url" field.
|
||||
func ImageURLGT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGT(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLGTE applies the GTE predicate on the "image_url" field.
|
||||
func ImageURLGTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldGTE(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLLT applies the LT predicate on the "image_url" field.
|
||||
func ImageURLLT(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLT(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLLTE applies the LTE predicate on the "image_url" field.
|
||||
func ImageURLLTE(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldLTE(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLContains applies the Contains predicate on the "image_url" field.
|
||||
func ImageURLContains(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContains(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLHasPrefix applies the HasPrefix predicate on the "image_url" field.
|
||||
func ImageURLHasPrefix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasPrefix(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLHasSuffix applies the HasSuffix predicate on the "image_url" field.
|
||||
func ImageURLHasSuffix(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldHasSuffix(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLEqualFold applies the EqualFold predicate on the "image_url" field.
|
||||
func ImageURLEqualFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldEqualFold(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// ImageURLContainsFold applies the ContainsFold predicate on the "image_url" field.
|
||||
func ImageURLContainsFold(v string) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.FieldContainsFold(FieldImageURL, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.EpicArtifactInfo) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.EpicArtifactInfo) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.EpicArtifactInfo) predicate.EpicArtifactInfo {
|
||||
return predicate.EpicArtifactInfo(sql.NotPredicates(p))
|
||||
}
|
||||
415
internal/ent/epicartifactinfo_create.go
Normal file
415
internal/ent/epicartifactinfo_create.go
Normal file
@@ -0,0 +1,415 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicArtifactInfoCreate is the builder for creating a EpicArtifactInfo entity.
|
||||
type EpicArtifactInfoCreate struct {
|
||||
config
|
||||
mutation *EpicArtifactInfoMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetArtifactName sets the "artifact_name" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetArtifactName(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetArtifactName(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetArtifactCode sets the "artifact_code" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetArtifactCode(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetArtifactCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetCreator(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetCreateTime(v time.Time) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *EpicArtifactInfoCreate) SetNillableCreateTime(v *time.Time) *EpicArtifactInfoCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetUpdater(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetUpdateTime(v time.Time) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *EpicArtifactInfoCreate) SetNillableUpdateTime(v *time.Time) *EpicArtifactInfoCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetDeleted(v bool) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetStatsHealth sets the "stats_health" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetStatsHealth(v int) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetStatsHealth(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetStatsAttack sets the "stats_attack" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetStatsAttack(v int) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetStatsAttack(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetStatsDefense sets the "stats_defense" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetStatsDefense(v int) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetStatsDefense(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetRarity sets the "rarity" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetRarity(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetRarity(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetRole sets the "role" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetRole(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetRole(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetArtifactNameEn sets the "artifact_name_en" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetArtifactNameEn(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetArtifactNameEn(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetImageURL sets the "image_url" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetImageURL(v string) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetImageURL(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *EpicArtifactInfoCreate) SetID(v int64) *EpicArtifactInfoCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the EpicArtifactInfoMutation object of the builder.
|
||||
func (_c *EpicArtifactInfoCreate) Mutation() *EpicArtifactInfoMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the EpicArtifactInfo in the database.
|
||||
func (_c *EpicArtifactInfoCreate) Save(ctx context.Context) (*EpicArtifactInfo, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *EpicArtifactInfoCreate) SaveX(ctx context.Context) *EpicArtifactInfo {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicArtifactInfoCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicArtifactInfoCreate) 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 (_c *EpicArtifactInfoCreate) check() error {
|
||||
if _, ok := _c.mutation.ArtifactName(); !ok {
|
||||
return &ValidationError{Name: "artifact_name", err: errors.New(`ent: missing required field "EpicArtifactInfo.artifact_name"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.ArtifactName(); ok {
|
||||
if err := epicartifactinfo.ArtifactNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_name", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.ArtifactCode(); !ok {
|
||||
return &ValidationError{Name: "artifact_code", err: errors.New(`ent: missing required field "EpicArtifactInfo.artifact_code"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.ArtifactCode(); ok {
|
||||
if err := epicartifactinfo.ArtifactCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_code", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "EpicArtifactInfo.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := epicartifactinfo.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "EpicArtifactInfo.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := epicartifactinfo.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "EpicArtifactInfo.deleted"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.StatsHealth(); !ok {
|
||||
return &ValidationError{Name: "stats_health", err: errors.New(`ent: missing required field "EpicArtifactInfo.stats_health"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.StatsAttack(); !ok {
|
||||
return &ValidationError{Name: "stats_attack", err: errors.New(`ent: missing required field "EpicArtifactInfo.stats_attack"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.StatsDefense(); !ok {
|
||||
return &ValidationError{Name: "stats_defense", err: errors.New(`ent: missing required field "EpicArtifactInfo.stats_defense"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Rarity(); !ok {
|
||||
return &ValidationError{Name: "rarity", err: errors.New(`ent: missing required field "EpicArtifactInfo.rarity"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Rarity(); ok {
|
||||
if err := epicartifactinfo.RarityValidator(v); err != nil {
|
||||
return &ValidationError{Name: "rarity", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.rarity": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Role(); !ok {
|
||||
return &ValidationError{Name: "role", err: errors.New(`ent: missing required field "EpicArtifactInfo.role"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Role(); ok {
|
||||
if err := epicartifactinfo.RoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.role": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.ArtifactNameEn(); !ok {
|
||||
return &ValidationError{Name: "artifact_name_en", err: errors.New(`ent: missing required field "EpicArtifactInfo.artifact_name_en"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.ArtifactNameEn(); ok {
|
||||
if err := epicartifactinfo.ArtifactNameEnValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_name_en", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_name_en": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.ImageURL(); !ok {
|
||||
return &ValidationError{Name: "image_url", err: errors.New(`ent: missing required field "EpicArtifactInfo.image_url"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.ImageURL(); ok {
|
||||
if err := epicartifactinfo.ImageURLValidator(v); err != nil {
|
||||
return &ValidationError{Name: "image_url", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.image_url": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *EpicArtifactInfoCreate) sqlSave(ctx context.Context) (*EpicArtifactInfo, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *EpicArtifactInfoCreate) createSpec() (*EpicArtifactInfo, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &EpicArtifactInfo{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(epicartifactinfo.Table, sqlgraph.NewFieldSpec(epicartifactinfo.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.ArtifactName(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactName, field.TypeString, value)
|
||||
_node.ArtifactName = value
|
||||
}
|
||||
if value, ok := _c.mutation.ArtifactCode(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactCode, field.TypeString, value)
|
||||
_node.ArtifactCode = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
if value, ok := _c.mutation.StatsHealth(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsHealth, field.TypeInt, value)
|
||||
_node.StatsHealth = value
|
||||
}
|
||||
if value, ok := _c.mutation.StatsAttack(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsAttack, field.TypeInt, value)
|
||||
_node.StatsAttack = value
|
||||
}
|
||||
if value, ok := _c.mutation.StatsDefense(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsDefense, field.TypeInt, value)
|
||||
_node.StatsDefense = value
|
||||
}
|
||||
if value, ok := _c.mutation.Rarity(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldRarity, field.TypeString, value)
|
||||
_node.Rarity = value
|
||||
}
|
||||
if value, ok := _c.mutation.Role(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldRole, field.TypeString, value)
|
||||
_node.Role = value
|
||||
}
|
||||
if value, ok := _c.mutation.ArtifactNameEn(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactNameEn, field.TypeString, value)
|
||||
_node.ArtifactNameEn = value
|
||||
}
|
||||
if value, ok := _c.mutation.ImageURL(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldImageURL, field.TypeString, value)
|
||||
_node.ImageURL = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// EpicArtifactInfoCreateBulk is the builder for creating many EpicArtifactInfo entities in bulk.
|
||||
type EpicArtifactInfoCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*EpicArtifactInfoCreate
|
||||
}
|
||||
|
||||
// Save creates the EpicArtifactInfo entities in the database.
|
||||
func (_c *EpicArtifactInfoCreateBulk) Save(ctx context.Context) ([]*EpicArtifactInfo, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*EpicArtifactInfo, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*EpicArtifactInfoMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *EpicArtifactInfoCreateBulk) SaveX(ctx context.Context) []*EpicArtifactInfo {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicArtifactInfoCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicArtifactInfoCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/epicartifactinfo_delete.go
Normal file
88
internal/ent/epicartifactinfo_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicArtifactInfoDelete is the builder for deleting a EpicArtifactInfo entity.
|
||||
type EpicArtifactInfoDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicArtifactInfoMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicArtifactInfoDelete builder.
|
||||
func (_d *EpicArtifactInfoDelete) Where(ps ...predicate.EpicArtifactInfo) *EpicArtifactInfoDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *EpicArtifactInfoDelete) 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 (_d *EpicArtifactInfoDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *EpicArtifactInfoDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(epicartifactinfo.Table, sqlgraph.NewFieldSpec(epicartifactinfo.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// EpicArtifactInfoDeleteOne is the builder for deleting a single EpicArtifactInfo entity.
|
||||
type EpicArtifactInfoDeleteOne struct {
|
||||
_d *EpicArtifactInfoDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicArtifactInfoDelete builder.
|
||||
func (_d *EpicArtifactInfoDeleteOne) Where(ps ...predicate.EpicArtifactInfo) *EpicArtifactInfoDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *EpicArtifactInfoDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{epicartifactinfo.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *EpicArtifactInfoDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/epicartifactinfo_query.go
Normal file
527
internal/ent/epicartifactinfo_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicArtifactInfoQuery is the builder for querying EpicArtifactInfo entities.
|
||||
type EpicArtifactInfoQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []epicartifactinfo.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.EpicArtifactInfo
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the EpicArtifactInfoQuery builder.
|
||||
func (_q *EpicArtifactInfoQuery) Where(ps ...predicate.EpicArtifactInfo) *EpicArtifactInfoQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *EpicArtifactInfoQuery) Limit(limit int) *EpicArtifactInfoQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *EpicArtifactInfoQuery) Offset(offset int) *EpicArtifactInfoQuery {
|
||||
_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 (_q *EpicArtifactInfoQuery) Unique(unique bool) *EpicArtifactInfoQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *EpicArtifactInfoQuery) Order(o ...epicartifactinfo.OrderOption) *EpicArtifactInfoQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first EpicArtifactInfo entity from the query.
|
||||
// Returns a *NotFoundError when no EpicArtifactInfo was found.
|
||||
func (_q *EpicArtifactInfoQuery) First(ctx context.Context) (*EpicArtifactInfo, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{epicartifactinfo.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) FirstX(ctx context.Context) *EpicArtifactInfo {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first EpicArtifactInfo ID from the query.
|
||||
// Returns a *NotFoundError when no EpicArtifactInfo ID was found.
|
||||
func (_q *EpicArtifactInfoQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{epicartifactinfo.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single EpicArtifactInfo entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one EpicArtifactInfo entity is found.
|
||||
// Returns a *NotFoundError when no EpicArtifactInfo entities are found.
|
||||
func (_q *EpicArtifactInfoQuery) Only(ctx context.Context) (*EpicArtifactInfo, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{epicartifactinfo.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{epicartifactinfo.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) OnlyX(ctx context.Context) *EpicArtifactInfo {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only EpicArtifactInfo ID in the query.
|
||||
// Returns a *NotSingularError when more than one EpicArtifactInfo ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *EpicArtifactInfoQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{epicartifactinfo.Label}
|
||||
default:
|
||||
err = &NotSingularError{epicartifactinfo.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of EpicArtifactInfos.
|
||||
func (_q *EpicArtifactInfoQuery) All(ctx context.Context) ([]*EpicArtifactInfo, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*EpicArtifactInfo, *EpicArtifactInfoQuery]()
|
||||
return withInterceptors[[]*EpicArtifactInfo](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) AllX(ctx context.Context) []*EpicArtifactInfo {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of EpicArtifactInfo IDs.
|
||||
func (_q *EpicArtifactInfoQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(epicartifactinfo.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *EpicArtifactInfoQuery) 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, _q, querierCount[*EpicArtifactInfoQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *EpicArtifactInfoQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *EpicArtifactInfoQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the EpicArtifactInfoQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *EpicArtifactInfoQuery) Clone() *EpicArtifactInfoQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &EpicArtifactInfoQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]epicartifactinfo.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.EpicArtifactInfo{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// ArtifactName string `json:"artifact_name,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicArtifactInfo.Query().
|
||||
// GroupBy(epicartifactinfo.FieldArtifactName).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicArtifactInfoQuery) GroupBy(field string, fields ...string) *EpicArtifactInfoGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &EpicArtifactInfoGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = epicartifactinfo.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// ArtifactName string `json:"artifact_name,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicArtifactInfo.Query().
|
||||
// Select(epicartifactinfo.FieldArtifactName).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicArtifactInfoQuery) Select(fields ...string) *EpicArtifactInfoSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &EpicArtifactInfoSelect{EpicArtifactInfoQuery: _q}
|
||||
sbuild.label = epicartifactinfo.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a EpicArtifactInfoSelect configured with the given aggregations.
|
||||
func (_q *EpicArtifactInfoQuery) Aggregate(fns ...AggregateFunc) *EpicArtifactInfoSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *EpicArtifactInfoQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !epicartifactinfo.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *EpicArtifactInfoQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EpicArtifactInfo, error) {
|
||||
var (
|
||||
nodes = []*EpicArtifactInfo{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*EpicArtifactInfo).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &EpicArtifactInfo{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *EpicArtifactInfoQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *EpicArtifactInfoQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(epicartifactinfo.Table, epicartifactinfo.Columns, sqlgraph.NewFieldSpec(epicartifactinfo.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicartifactinfo.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != epicartifactinfo.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *EpicArtifactInfoQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(epicartifactinfo.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = epicartifactinfo.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// EpicArtifactInfoGroupBy is the group-by builder for EpicArtifactInfo entities.
|
||||
type EpicArtifactInfoGroupBy struct {
|
||||
selector
|
||||
build *EpicArtifactInfoQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *EpicArtifactInfoGroupBy) Aggregate(fns ...AggregateFunc) *EpicArtifactInfoGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *EpicArtifactInfoGroupBy) 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[*EpicArtifactInfoQuery, *EpicArtifactInfoGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *EpicArtifactInfoGroupBy) sqlScan(ctx context.Context, root *EpicArtifactInfoQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// EpicArtifactInfoSelect is the builder for selecting fields of EpicArtifactInfo entities.
|
||||
type EpicArtifactInfoSelect struct {
|
||||
*EpicArtifactInfoQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *EpicArtifactInfoSelect) Aggregate(fns ...AggregateFunc) *EpicArtifactInfoSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *EpicArtifactInfoSelect) 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[*EpicArtifactInfoQuery, *EpicArtifactInfoSelect](ctx, _s.EpicArtifactInfoQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *EpicArtifactInfoSelect) sqlScan(ctx context.Context, root *EpicArtifactInfoQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
844
internal/ent/epicartifactinfo_update.go
Normal file
844
internal/ent/epicartifactinfo_update.go
Normal file
@@ -0,0 +1,844 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicArtifactInfoUpdate is the builder for updating EpicArtifactInfo entities.
|
||||
type EpicArtifactInfoUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicArtifactInfoMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicArtifactInfoUpdate builder.
|
||||
func (_u *EpicArtifactInfoUpdate) Where(ps ...predicate.EpicArtifactInfo) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifactName sets the "artifact_name" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetArtifactName(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetArtifactName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactName sets the "artifact_name" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableArtifactName(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetArtifactName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifactCode sets the "artifact_code" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetArtifactCode(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetArtifactCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactCode sets the "artifact_code" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableArtifactCode(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetArtifactCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetCreator(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableCreator(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetCreateTime(v time.Time) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableCreateTime(v *time.Time) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicArtifactInfoUpdate) ClearCreateTime() *EpicArtifactInfoUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetUpdater(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableUpdater(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetUpdateTime(v time.Time) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableUpdateTime(v *time.Time) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicArtifactInfoUpdate) ClearUpdateTime() *EpicArtifactInfoUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetDeleted(v bool) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableDeleted(v *bool) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatsHealth sets the "stats_health" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetStatsHealth(v int) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.ResetStatsHealth()
|
||||
_u.mutation.SetStatsHealth(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatsHealth sets the "stats_health" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableStatsHealth(v *int) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetStatsHealth(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatsHealth adds value to the "stats_health" field.
|
||||
func (_u *EpicArtifactInfoUpdate) AddStatsHealth(v int) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.AddStatsHealth(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatsAttack sets the "stats_attack" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetStatsAttack(v int) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.ResetStatsAttack()
|
||||
_u.mutation.SetStatsAttack(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatsAttack sets the "stats_attack" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableStatsAttack(v *int) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetStatsAttack(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatsAttack adds value to the "stats_attack" field.
|
||||
func (_u *EpicArtifactInfoUpdate) AddStatsAttack(v int) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.AddStatsAttack(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatsDefense sets the "stats_defense" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetStatsDefense(v int) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.ResetStatsDefense()
|
||||
_u.mutation.SetStatsDefense(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatsDefense sets the "stats_defense" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableStatsDefense(v *int) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetStatsDefense(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatsDefense adds value to the "stats_defense" field.
|
||||
func (_u *EpicArtifactInfoUpdate) AddStatsDefense(v int) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.AddStatsDefense(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRarity sets the "rarity" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetRarity(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetRarity(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRarity sets the "rarity" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableRarity(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetRarity(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRole sets the "role" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetRole(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetRole(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRole sets the "role" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableRole(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetRole(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifactNameEn sets the "artifact_name_en" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetArtifactNameEn(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetArtifactNameEn(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactNameEn sets the "artifact_name_en" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableArtifactNameEn(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetArtifactNameEn(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetImageURL sets the "image_url" field.
|
||||
func (_u *EpicArtifactInfoUpdate) SetImageURL(v string) *EpicArtifactInfoUpdate {
|
||||
_u.mutation.SetImageURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableImageURL sets the "image_url" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdate) SetNillableImageURL(v *string) *EpicArtifactInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetImageURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicArtifactInfoMutation object of the builder.
|
||||
func (_u *EpicArtifactInfoUpdate) Mutation() *EpicArtifactInfoMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *EpicArtifactInfoUpdate) 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 (_u *EpicArtifactInfoUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *EpicArtifactInfoUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicArtifactInfoUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicArtifactInfoUpdate) check() error {
|
||||
if v, ok := _u.mutation.ArtifactName(); ok {
|
||||
if err := epicartifactinfo.ArtifactNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_name", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ArtifactCode(); ok {
|
||||
if err := epicartifactinfo.ArtifactCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_code", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicartifactinfo.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicartifactinfo.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Rarity(); ok {
|
||||
if err := epicartifactinfo.RarityValidator(v); err != nil {
|
||||
return &ValidationError{Name: "rarity", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.rarity": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Role(); ok {
|
||||
if err := epicartifactinfo.RoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.role": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ArtifactNameEn(); ok {
|
||||
if err := epicartifactinfo.ArtifactNameEnValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_name_en", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_name_en": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ImageURL(); ok {
|
||||
if err := epicartifactinfo.ImageURLValidator(v); err != nil {
|
||||
return &ValidationError{Name: "image_url", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.image_url": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicArtifactInfoUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicartifactinfo.Table, epicartifactinfo.Columns, sqlgraph.NewFieldSpec(epicartifactinfo.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactName(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactCode(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicartifactinfo.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicartifactinfo.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.StatsHealth(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsHealth, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatsHealth(); ok {
|
||||
_spec.AddField(epicartifactinfo.FieldStatsHealth, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.StatsAttack(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsAttack, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatsAttack(); ok {
|
||||
_spec.AddField(epicartifactinfo.FieldStatsAttack, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.StatsDefense(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsDefense, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatsDefense(); ok {
|
||||
_spec.AddField(epicartifactinfo.FieldStatsDefense, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Rarity(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldRarity, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Role(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldRole, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactNameEn(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactNameEn, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ImageURL(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldImageURL, field.TypeString, value)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicartifactinfo.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// EpicArtifactInfoUpdateOne is the builder for updating a single EpicArtifactInfo entity.
|
||||
type EpicArtifactInfoUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *EpicArtifactInfoMutation
|
||||
}
|
||||
|
||||
// SetArtifactName sets the "artifact_name" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetArtifactName(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetArtifactName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactName sets the "artifact_name" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableArtifactName(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetArtifactName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifactCode sets the "artifact_code" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetArtifactCode(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetArtifactCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactCode sets the "artifact_code" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableArtifactCode(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetArtifactCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetCreator(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableCreator(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetCreateTime(v time.Time) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableCreateTime(v *time.Time) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) ClearCreateTime() *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetUpdater(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableUpdater(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetUpdateTime(v time.Time) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableUpdateTime(v *time.Time) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) ClearUpdateTime() *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetDeleted(v bool) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableDeleted(v *bool) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatsHealth sets the "stats_health" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetStatsHealth(v int) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.ResetStatsHealth()
|
||||
_u.mutation.SetStatsHealth(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatsHealth sets the "stats_health" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableStatsHealth(v *int) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetStatsHealth(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatsHealth adds value to the "stats_health" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) AddStatsHealth(v int) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.AddStatsHealth(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatsAttack sets the "stats_attack" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetStatsAttack(v int) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.ResetStatsAttack()
|
||||
_u.mutation.SetStatsAttack(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatsAttack sets the "stats_attack" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableStatsAttack(v *int) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetStatsAttack(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatsAttack adds value to the "stats_attack" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) AddStatsAttack(v int) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.AddStatsAttack(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatsDefense sets the "stats_defense" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetStatsDefense(v int) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.ResetStatsDefense()
|
||||
_u.mutation.SetStatsDefense(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatsDefense sets the "stats_defense" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableStatsDefense(v *int) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetStatsDefense(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatsDefense adds value to the "stats_defense" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) AddStatsDefense(v int) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.AddStatsDefense(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRarity sets the "rarity" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetRarity(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetRarity(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRarity sets the "rarity" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableRarity(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRarity(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRole sets the "role" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetRole(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetRole(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRole sets the "role" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableRole(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRole(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifactNameEn sets the "artifact_name_en" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetArtifactNameEn(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetArtifactNameEn(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactNameEn sets the "artifact_name_en" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableArtifactNameEn(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetArtifactNameEn(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetImageURL sets the "image_url" field.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetImageURL(v string) *EpicArtifactInfoUpdateOne {
|
||||
_u.mutation.SetImageURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableImageURL sets the "image_url" field if the given value is not nil.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SetNillableImageURL(v *string) *EpicArtifactInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetImageURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicArtifactInfoMutation object of the builder.
|
||||
func (_u *EpicArtifactInfoUpdateOne) Mutation() *EpicArtifactInfoMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicArtifactInfoUpdate builder.
|
||||
func (_u *EpicArtifactInfoUpdateOne) Where(ps ...predicate.EpicArtifactInfo) *EpicArtifactInfoUpdateOne {
|
||||
_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 (_u *EpicArtifactInfoUpdateOne) Select(field string, fields ...string) *EpicArtifactInfoUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated EpicArtifactInfo entity.
|
||||
func (_u *EpicArtifactInfoUpdateOne) Save(ctx context.Context) (*EpicArtifactInfo, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *EpicArtifactInfoUpdateOne) SaveX(ctx context.Context) *EpicArtifactInfo {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *EpicArtifactInfoUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicArtifactInfoUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicArtifactInfoUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.ArtifactName(); ok {
|
||||
if err := epicartifactinfo.ArtifactNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_name", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ArtifactCode(); ok {
|
||||
if err := epicartifactinfo.ArtifactCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_code", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicartifactinfo.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicartifactinfo.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Rarity(); ok {
|
||||
if err := epicartifactinfo.RarityValidator(v); err != nil {
|
||||
return &ValidationError{Name: "rarity", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.rarity": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Role(); ok {
|
||||
if err := epicartifactinfo.RoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.role": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ArtifactNameEn(); ok {
|
||||
if err := epicartifactinfo.ArtifactNameEnValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_name_en", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.artifact_name_en": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ImageURL(); ok {
|
||||
if err := epicartifactinfo.ImageURLValidator(v); err != nil {
|
||||
return &ValidationError{Name: "image_url", err: fmt.Errorf(`ent: validator failed for field "EpicArtifactInfo.image_url": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicArtifactInfoUpdateOne) sqlSave(ctx context.Context) (_node *EpicArtifactInfo, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicartifactinfo.Table, epicartifactinfo.Columns, sqlgraph.NewFieldSpec(epicartifactinfo.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EpicArtifactInfo.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicartifactinfo.FieldID)
|
||||
for _, f := range fields {
|
||||
if !epicartifactinfo.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != epicartifactinfo.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactName(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactCode(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicartifactinfo.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicartifactinfo.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.StatsHealth(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsHealth, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatsHealth(); ok {
|
||||
_spec.AddField(epicartifactinfo.FieldStatsHealth, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.StatsAttack(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsAttack, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatsAttack(); ok {
|
||||
_spec.AddField(epicartifactinfo.FieldStatsAttack, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.StatsDefense(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldStatsDefense, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatsDefense(); ok {
|
||||
_spec.AddField(epicartifactinfo.FieldStatsDefense, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Rarity(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldRarity, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Role(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldRole, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactNameEn(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldArtifactNameEn, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ImageURL(); ok {
|
||||
_spec.SetField(epicartifactinfo.FieldImageURL, field.TypeString, value)
|
||||
}
|
||||
_node = &EpicArtifactInfo{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicartifactinfo.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
169
internal/ent/epicgvgattackteams.go
Normal file
169
internal/ent/epicgvgattackteams.go
Normal file
@@ -0,0 +1,169 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epicgvgattackteams"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicGvgAttackTeams is the model entity for the EpicGvgAttackTeams schema.
|
||||
type EpicGvgAttackTeams struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// AttackHeroes holds the value of the "attack_heroes" field.
|
||||
AttackHeroes string `json:"attack_heroes,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicGvgAttackTeams) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicgvgattackteams.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case epicgvgattackteams.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epicgvgattackteams.FieldAttackHeroes, epicgvgattackteams.FieldCreator, epicgvgattackteams.FieldUpdater:
|
||||
values[i] = new(sql.NullString)
|
||||
case epicgvgattackteams.FieldCreateTime, epicgvgattackteams.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the EpicGvgAttackTeams fields.
|
||||
func (_m *EpicGvgAttackTeams) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicgvgattackteams.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epicgvgattackteams.FieldAttackHeroes:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field attack_heroes", values[i])
|
||||
} else if value.Valid {
|
||||
_m.AttackHeroes = value.String
|
||||
}
|
||||
case epicgvgattackteams.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epicgvgattackteams.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epicgvgattackteams.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epicgvgattackteams.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epicgvgattackteams.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the EpicGvgAttackTeams.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicGvgAttackTeams) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicGvgAttackTeams.
|
||||
// Note that you need to call EpicGvgAttackTeams.Unwrap() before calling this method if this EpicGvgAttackTeams
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicGvgAttackTeams) Update() *EpicGvgAttackTeamsUpdateOne {
|
||||
return NewEpicGvgAttackTeamsClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicGvgAttackTeams 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 *EpicGvgAttackTeams) Unwrap() *EpicGvgAttackTeams {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicGvgAttackTeams is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicGvgAttackTeams) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicGvgAttackTeams(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("attack_heroes=")
|
||||
builder.WriteString(_m.AttackHeroes)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicGvgAttackTeamsSlice is a parsable slice of EpicGvgAttackTeams.
|
||||
type EpicGvgAttackTeamsSlice []*EpicGvgAttackTeams
|
||||
96
internal/ent/epicgvgattackteams/epicgvgattackteams.go
Normal file
96
internal/ent/epicgvgattackteams/epicgvgattackteams.go
Normal file
@@ -0,0 +1,96 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicgvgattackteams
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the epicgvgattackteams type in the database.
|
||||
Label = "epic_gvg_attack_teams"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldAttackHeroes holds the string denoting the attack_heroes field in the database.
|
||||
FieldAttackHeroes = "attack_heroes"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// Table holds the table name of the epicgvgattackteams in the database.
|
||||
Table = "epic_gvg_attack_teams"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for epicgvgattackteams fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldAttackHeroes,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// AttackHeroesValidator is a validator for the "attack_heroes" field. It is called by the builders before save.
|
||||
AttackHeroesValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the EpicGvgAttackTeams queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAttackHeroes orders the results by the attack_heroes field.
|
||||
func ByAttackHeroes(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAttackHeroes, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
405
internal/ent/epicgvgattackteams/where.go
Normal file
405
internal/ent/epicgvgattackteams/where.go
Normal file
@@ -0,0 +1,405 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicgvgattackteams
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// AttackHeroes applies equality check predicate on the "attack_heroes" field. It's identical to AttackHeroesEQ.
|
||||
func AttackHeroes(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// Creator applies equality check predicate on the "creator" field. It's identical to CreatorEQ.
|
||||
func Creator(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// Updater applies equality check predicate on the "updater" field. It's identical to UpdaterEQ.
|
||||
func Updater(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||
func Deleted(v bool) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// AttackHeroesEQ applies the EQ predicate on the "attack_heroes" field.
|
||||
func AttackHeroesEQ(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesNEQ applies the NEQ predicate on the "attack_heroes" field.
|
||||
func AttackHeroesNEQ(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNEQ(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesIn applies the In predicate on the "attack_heroes" field.
|
||||
func AttackHeroesIn(vs ...string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIn(FieldAttackHeroes, vs...))
|
||||
}
|
||||
|
||||
// AttackHeroesNotIn applies the NotIn predicate on the "attack_heroes" field.
|
||||
func AttackHeroesNotIn(vs ...string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotIn(FieldAttackHeroes, vs...))
|
||||
}
|
||||
|
||||
// AttackHeroesGT applies the GT predicate on the "attack_heroes" field.
|
||||
func AttackHeroesGT(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGT(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesGTE applies the GTE predicate on the "attack_heroes" field.
|
||||
func AttackHeroesGTE(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGTE(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesLT applies the LT predicate on the "attack_heroes" field.
|
||||
func AttackHeroesLT(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLT(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesLTE applies the LTE predicate on the "attack_heroes" field.
|
||||
func AttackHeroesLTE(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLTE(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesContains applies the Contains predicate on the "attack_heroes" field.
|
||||
func AttackHeroesContains(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldContains(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesHasPrefix applies the HasPrefix predicate on the "attack_heroes" field.
|
||||
func AttackHeroesHasPrefix(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldHasPrefix(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesHasSuffix applies the HasSuffix predicate on the "attack_heroes" field.
|
||||
func AttackHeroesHasSuffix(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldHasSuffix(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesEqualFold applies the EqualFold predicate on the "attack_heroes" field.
|
||||
func AttackHeroesEqualFold(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEqualFold(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// AttackHeroesContainsFold applies the ContainsFold predicate on the "attack_heroes" field.
|
||||
func AttackHeroesContainsFold(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldContainsFold(FieldAttackHeroes, v))
|
||||
}
|
||||
|
||||
// CreatorEQ applies the EQ predicate on the "creator" field.
|
||||
func CreatorEQ(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorNEQ applies the NEQ predicate on the "creator" field.
|
||||
func CreatorNEQ(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorIn applies the In predicate on the "creator" field.
|
||||
func CreatorIn(vs ...string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorNotIn applies the NotIn predicate on the "creator" field.
|
||||
func CreatorNotIn(vs ...string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorGT applies the GT predicate on the "creator" field.
|
||||
func CreatorGT(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorGTE applies the GTE predicate on the "creator" field.
|
||||
func CreatorGTE(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLT applies the LT predicate on the "creator" field.
|
||||
func CreatorLT(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLTE applies the LTE predicate on the "creator" field.
|
||||
func CreatorLTE(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContains applies the Contains predicate on the "creator" field.
|
||||
func CreatorContains(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldContains(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasPrefix applies the HasPrefix predicate on the "creator" field.
|
||||
func CreatorHasPrefix(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldHasPrefix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasSuffix applies the HasSuffix predicate on the "creator" field.
|
||||
func CreatorHasSuffix(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldHasSuffix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorEqualFold applies the EqualFold predicate on the "creator" field.
|
||||
func CreatorEqualFold(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEqualFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContainsFold applies the ContainsFold predicate on the "creator" field.
|
||||
func CreatorContainsFold(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldContainsFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIsNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// UpdaterEQ applies the EQ predicate on the "updater" field.
|
||||
func UpdaterEQ(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterNEQ applies the NEQ predicate on the "updater" field.
|
||||
func UpdaterNEQ(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterIn applies the In predicate on the "updater" field.
|
||||
func UpdaterIn(vs ...string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterNotIn applies the NotIn predicate on the "updater" field.
|
||||
func UpdaterNotIn(vs ...string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterGT applies the GT predicate on the "updater" field.
|
||||
func UpdaterGT(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterGTE applies the GTE predicate on the "updater" field.
|
||||
func UpdaterGTE(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLT applies the LT predicate on the "updater" field.
|
||||
func UpdaterLT(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLTE applies the LTE predicate on the "updater" field.
|
||||
func UpdaterLTE(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContains applies the Contains predicate on the "updater" field.
|
||||
func UpdaterContains(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldContains(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasPrefix applies the HasPrefix predicate on the "updater" field.
|
||||
func UpdaterHasPrefix(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldHasPrefix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasSuffix applies the HasSuffix predicate on the "updater" field.
|
||||
func UpdaterHasSuffix(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldHasSuffix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterEqualFold applies the EqualFold predicate on the "updater" field.
|
||||
func UpdaterEqualFold(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEqualFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContainsFold applies the ContainsFold predicate on the "updater" field.
|
||||
func UpdaterContainsFold(v string) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldContainsFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v time.Time) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIsNil applies the IsNil predicate on the "update_time" field.
|
||||
func UpdateTimeIsNil() predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldIsNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// UpdateTimeNotNil applies the NotNil predicate on the "update_time" field.
|
||||
func UpdateTimeNotNil() predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNotNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||
func DeletedEQ(v bool) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||
func DeletedNEQ(v bool) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.FieldNEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.EpicGvgAttackTeams) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.EpicGvgAttackTeams) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.EpicGvgAttackTeams) predicate.EpicGvgAttackTeams {
|
||||
return predicate.EpicGvgAttackTeams(sql.NotPredicates(p))
|
||||
}
|
||||
286
internal/ent/epicgvgattackteams_create.go
Normal file
286
internal/ent/epicgvgattackteams_create.go
Normal file
@@ -0,0 +1,286 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgattackteams"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgAttackTeamsCreate is the builder for creating a EpicGvgAttackTeams entity.
|
||||
type EpicGvgAttackTeamsCreate struct {
|
||||
config
|
||||
mutation *EpicGvgAttackTeamsMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetAttackHeroes sets the "attack_heroes" field.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetAttackHeroes(v string) *EpicGvgAttackTeamsCreate {
|
||||
_c.mutation.SetAttackHeroes(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetCreator(v string) *EpicGvgAttackTeamsCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetCreateTime(v time.Time) *EpicGvgAttackTeamsCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetNillableCreateTime(v *time.Time) *EpicGvgAttackTeamsCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetUpdater(v string) *EpicGvgAttackTeamsCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetUpdateTime(v time.Time) *EpicGvgAttackTeamsCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetNillableUpdateTime(v *time.Time) *EpicGvgAttackTeamsCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetDeleted(v bool) *EpicGvgAttackTeamsCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SetID(v int64) *EpicGvgAttackTeamsCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgAttackTeamsMutation object of the builder.
|
||||
func (_c *EpicGvgAttackTeamsCreate) Mutation() *EpicGvgAttackTeamsMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the EpicGvgAttackTeams in the database.
|
||||
func (_c *EpicGvgAttackTeamsCreate) Save(ctx context.Context) (*EpicGvgAttackTeams, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *EpicGvgAttackTeamsCreate) SaveX(ctx context.Context) *EpicGvgAttackTeams {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicGvgAttackTeamsCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicGvgAttackTeamsCreate) 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 (_c *EpicGvgAttackTeamsCreate) check() error {
|
||||
if _, ok := _c.mutation.AttackHeroes(); !ok {
|
||||
return &ValidationError{Name: "attack_heroes", err: errors.New(`ent: missing required field "EpicGvgAttackTeams.attack_heroes"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.AttackHeroes(); ok {
|
||||
if err := epicgvgattackteams.AttackHeroesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "attack_heroes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.attack_heroes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "EpicGvgAttackTeams.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := epicgvgattackteams.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "EpicGvgAttackTeams.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := epicgvgattackteams.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "EpicGvgAttackTeams.deleted"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *EpicGvgAttackTeamsCreate) sqlSave(ctx context.Context) (*EpicGvgAttackTeams, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *EpicGvgAttackTeamsCreate) createSpec() (*EpicGvgAttackTeams, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &EpicGvgAttackTeams{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(epicgvgattackteams.Table, sqlgraph.NewFieldSpec(epicgvgattackteams.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.AttackHeroes(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldAttackHeroes, field.TypeString, value)
|
||||
_node.AttackHeroes = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// EpicGvgAttackTeamsCreateBulk is the builder for creating many EpicGvgAttackTeams entities in bulk.
|
||||
type EpicGvgAttackTeamsCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*EpicGvgAttackTeamsCreate
|
||||
}
|
||||
|
||||
// Save creates the EpicGvgAttackTeams entities in the database.
|
||||
func (_c *EpicGvgAttackTeamsCreateBulk) Save(ctx context.Context) ([]*EpicGvgAttackTeams, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*EpicGvgAttackTeams, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*EpicGvgAttackTeamsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *EpicGvgAttackTeamsCreateBulk) SaveX(ctx context.Context) []*EpicGvgAttackTeams {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicGvgAttackTeamsCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicGvgAttackTeamsCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/epicgvgattackteams_delete.go
Normal file
88
internal/ent/epicgvgattackteams_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgattackteams"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgAttackTeamsDelete is the builder for deleting a EpicGvgAttackTeams entity.
|
||||
type EpicGvgAttackTeamsDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicGvgAttackTeamsMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgAttackTeamsDelete builder.
|
||||
func (_d *EpicGvgAttackTeamsDelete) Where(ps ...predicate.EpicGvgAttackTeams) *EpicGvgAttackTeamsDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *EpicGvgAttackTeamsDelete) 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 (_d *EpicGvgAttackTeamsDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *EpicGvgAttackTeamsDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(epicgvgattackteams.Table, sqlgraph.NewFieldSpec(epicgvgattackteams.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// EpicGvgAttackTeamsDeleteOne is the builder for deleting a single EpicGvgAttackTeams entity.
|
||||
type EpicGvgAttackTeamsDeleteOne struct {
|
||||
_d *EpicGvgAttackTeamsDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgAttackTeamsDelete builder.
|
||||
func (_d *EpicGvgAttackTeamsDeleteOne) Where(ps ...predicate.EpicGvgAttackTeams) *EpicGvgAttackTeamsDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *EpicGvgAttackTeamsDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{epicgvgattackteams.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *EpicGvgAttackTeamsDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/epicgvgattackteams_query.go
Normal file
527
internal/ent/epicgvgattackteams_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgattackteams"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgAttackTeamsQuery is the builder for querying EpicGvgAttackTeams entities.
|
||||
type EpicGvgAttackTeamsQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []epicgvgattackteams.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.EpicGvgAttackTeams
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the EpicGvgAttackTeamsQuery builder.
|
||||
func (_q *EpicGvgAttackTeamsQuery) Where(ps ...predicate.EpicGvgAttackTeams) *EpicGvgAttackTeamsQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *EpicGvgAttackTeamsQuery) Limit(limit int) *EpicGvgAttackTeamsQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *EpicGvgAttackTeamsQuery) Offset(offset int) *EpicGvgAttackTeamsQuery {
|
||||
_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 (_q *EpicGvgAttackTeamsQuery) Unique(unique bool) *EpicGvgAttackTeamsQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *EpicGvgAttackTeamsQuery) Order(o ...epicgvgattackteams.OrderOption) *EpicGvgAttackTeamsQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first EpicGvgAttackTeams entity from the query.
|
||||
// Returns a *NotFoundError when no EpicGvgAttackTeams was found.
|
||||
func (_q *EpicGvgAttackTeamsQuery) First(ctx context.Context) (*EpicGvgAttackTeams, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{epicgvgattackteams.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) FirstX(ctx context.Context) *EpicGvgAttackTeams {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first EpicGvgAttackTeams ID from the query.
|
||||
// Returns a *NotFoundError when no EpicGvgAttackTeams ID was found.
|
||||
func (_q *EpicGvgAttackTeamsQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{epicgvgattackteams.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single EpicGvgAttackTeams entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one EpicGvgAttackTeams entity is found.
|
||||
// Returns a *NotFoundError when no EpicGvgAttackTeams entities are found.
|
||||
func (_q *EpicGvgAttackTeamsQuery) Only(ctx context.Context) (*EpicGvgAttackTeams, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{epicgvgattackteams.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{epicgvgattackteams.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) OnlyX(ctx context.Context) *EpicGvgAttackTeams {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only EpicGvgAttackTeams ID in the query.
|
||||
// Returns a *NotSingularError when more than one EpicGvgAttackTeams ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *EpicGvgAttackTeamsQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{epicgvgattackteams.Label}
|
||||
default:
|
||||
err = &NotSingularError{epicgvgattackteams.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of EpicGvgAttackTeamsSlice.
|
||||
func (_q *EpicGvgAttackTeamsQuery) All(ctx context.Context) ([]*EpicGvgAttackTeams, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*EpicGvgAttackTeams, *EpicGvgAttackTeamsQuery]()
|
||||
return withInterceptors[[]*EpicGvgAttackTeams](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) AllX(ctx context.Context) []*EpicGvgAttackTeams {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of EpicGvgAttackTeams IDs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(epicgvgattackteams.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *EpicGvgAttackTeamsQuery) 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, _q, querierCount[*EpicGvgAttackTeamsQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *EpicGvgAttackTeamsQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *EpicGvgAttackTeamsQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the EpicGvgAttackTeamsQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *EpicGvgAttackTeamsQuery) Clone() *EpicGvgAttackTeamsQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &EpicGvgAttackTeamsQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]epicgvgattackteams.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.EpicGvgAttackTeams{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// AttackHeroes string `json:"attack_heroes,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicGvgAttackTeams.Query().
|
||||
// GroupBy(epicgvgattackteams.FieldAttackHeroes).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicGvgAttackTeamsQuery) GroupBy(field string, fields ...string) *EpicGvgAttackTeamsGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &EpicGvgAttackTeamsGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = epicgvgattackteams.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// AttackHeroes string `json:"attack_heroes,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicGvgAttackTeams.Query().
|
||||
// Select(epicgvgattackteams.FieldAttackHeroes).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicGvgAttackTeamsQuery) Select(fields ...string) *EpicGvgAttackTeamsSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &EpicGvgAttackTeamsSelect{EpicGvgAttackTeamsQuery: _q}
|
||||
sbuild.label = epicgvgattackteams.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a EpicGvgAttackTeamsSelect configured with the given aggregations.
|
||||
func (_q *EpicGvgAttackTeamsQuery) Aggregate(fns ...AggregateFunc) *EpicGvgAttackTeamsSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *EpicGvgAttackTeamsQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !epicgvgattackteams.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *EpicGvgAttackTeamsQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EpicGvgAttackTeams, error) {
|
||||
var (
|
||||
nodes = []*EpicGvgAttackTeams{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*EpicGvgAttackTeams).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &EpicGvgAttackTeams{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *EpicGvgAttackTeamsQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *EpicGvgAttackTeamsQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(epicgvgattackteams.Table, epicgvgattackteams.Columns, sqlgraph.NewFieldSpec(epicgvgattackteams.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicgvgattackteams.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != epicgvgattackteams.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *EpicGvgAttackTeamsQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(epicgvgattackteams.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = epicgvgattackteams.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// EpicGvgAttackTeamsGroupBy is the group-by builder for EpicGvgAttackTeams entities.
|
||||
type EpicGvgAttackTeamsGroupBy struct {
|
||||
selector
|
||||
build *EpicGvgAttackTeamsQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *EpicGvgAttackTeamsGroupBy) Aggregate(fns ...AggregateFunc) *EpicGvgAttackTeamsGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *EpicGvgAttackTeamsGroupBy) 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[*EpicGvgAttackTeamsQuery, *EpicGvgAttackTeamsGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *EpicGvgAttackTeamsGroupBy) sqlScan(ctx context.Context, root *EpicGvgAttackTeamsQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// EpicGvgAttackTeamsSelect is the builder for selecting fields of EpicGvgAttackTeams entities.
|
||||
type EpicGvgAttackTeamsSelect struct {
|
||||
*EpicGvgAttackTeamsQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *EpicGvgAttackTeamsSelect) Aggregate(fns ...AggregateFunc) *EpicGvgAttackTeamsSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *EpicGvgAttackTeamsSelect) 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[*EpicGvgAttackTeamsQuery, *EpicGvgAttackTeamsSelect](ctx, _s.EpicGvgAttackTeamsQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *EpicGvgAttackTeamsSelect) sqlScan(ctx context.Context, root *EpicGvgAttackTeamsQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
462
internal/ent/epicgvgattackteams_update.go
Normal file
462
internal/ent/epicgvgattackteams_update.go
Normal file
@@ -0,0 +1,462 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgattackteams"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgAttackTeamsUpdate is the builder for updating EpicGvgAttackTeams entities.
|
||||
type EpicGvgAttackTeamsUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicGvgAttackTeamsMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgAttackTeamsUpdate builder.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) Where(ps ...predicate.EpicGvgAttackTeams) *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAttackHeroes sets the "attack_heroes" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetAttackHeroes(v string) *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.SetAttackHeroes(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAttackHeroes sets the "attack_heroes" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetNillableAttackHeroes(v *string) *EpicGvgAttackTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetAttackHeroes(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetCreator(v string) *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetNillableCreator(v *string) *EpicGvgAttackTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetCreateTime(v time.Time) *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetNillableCreateTime(v *time.Time) *EpicGvgAttackTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) ClearCreateTime() *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetUpdater(v string) *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetNillableUpdater(v *string) *EpicGvgAttackTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetUpdateTime(v time.Time) *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetNillableUpdateTime(v *time.Time) *EpicGvgAttackTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) ClearUpdateTime() *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetDeleted(v bool) *EpicGvgAttackTeamsUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) SetNillableDeleted(v *bool) *EpicGvgAttackTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgAttackTeamsMutation object of the builder.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) Mutation() *EpicGvgAttackTeamsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) 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 (_u *EpicGvgAttackTeamsUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicGvgAttackTeamsUpdate) check() error {
|
||||
if v, ok := _u.mutation.AttackHeroes(); ok {
|
||||
if err := epicgvgattackteams.AttackHeroesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "attack_heroes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.attack_heroes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicgvgattackteams.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicgvgattackteams.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicGvgAttackTeamsUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicgvgattackteams.Table, epicgvgattackteams.Columns, sqlgraph.NewFieldSpec(epicgvgattackteams.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.AttackHeroes(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldAttackHeroes, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicgvgattackteams.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicgvgattackteams.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicgvgattackteams.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// EpicGvgAttackTeamsUpdateOne is the builder for updating a single EpicGvgAttackTeams entity.
|
||||
type EpicGvgAttackTeamsUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *EpicGvgAttackTeamsMutation
|
||||
}
|
||||
|
||||
// SetAttackHeroes sets the "attack_heroes" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetAttackHeroes(v string) *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.SetAttackHeroes(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAttackHeroes sets the "attack_heroes" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetNillableAttackHeroes(v *string) *EpicGvgAttackTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetAttackHeroes(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetCreator(v string) *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetNillableCreator(v *string) *EpicGvgAttackTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetCreateTime(v time.Time) *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetNillableCreateTime(v *time.Time) *EpicGvgAttackTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) ClearCreateTime() *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetUpdater(v string) *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetNillableUpdater(v *string) *EpicGvgAttackTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetUpdateTime(v time.Time) *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetNillableUpdateTime(v *time.Time) *EpicGvgAttackTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) ClearUpdateTime() *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetDeleted(v bool) *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SetNillableDeleted(v *bool) *EpicGvgAttackTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgAttackTeamsMutation object of the builder.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) Mutation() *EpicGvgAttackTeamsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgAttackTeamsUpdate builder.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) Where(ps ...predicate.EpicGvgAttackTeams) *EpicGvgAttackTeamsUpdateOne {
|
||||
_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 (_u *EpicGvgAttackTeamsUpdateOne) Select(field string, fields ...string) *EpicGvgAttackTeamsUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated EpicGvgAttackTeams entity.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) Save(ctx context.Context) (*EpicGvgAttackTeams, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) SaveX(ctx context.Context) *EpicGvgAttackTeams {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.AttackHeroes(); ok {
|
||||
if err := epicgvgattackteams.AttackHeroesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "attack_heroes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.attack_heroes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicgvgattackteams.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicgvgattackteams.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgAttackTeams.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicGvgAttackTeamsUpdateOne) sqlSave(ctx context.Context) (_node *EpicGvgAttackTeams, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicgvgattackteams.Table, epicgvgattackteams.Columns, sqlgraph.NewFieldSpec(epicgvgattackteams.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EpicGvgAttackTeams.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicgvgattackteams.FieldID)
|
||||
for _, f := range fields {
|
||||
if !epicgvgattackteams.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != epicgvgattackteams.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.AttackHeroes(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldAttackHeroes, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicgvgattackteams.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicgvgattackteams.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgattackteams.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
_node = &EpicGvgAttackTeams{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicgvgattackteams.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
235
internal/ent/epicgvgdefenseattackmapping.go
Normal file
235
internal/ent/epicgvgdefenseattackmapping.go
Normal file
@@ -0,0 +1,235 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseAttackMapping is the model entity for the EpicGvgDefenseAttackMapping schema.
|
||||
type EpicGvgDefenseAttackMapping struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// DefenseID holds the value of the "defense_id" field.
|
||||
DefenseID int64 `json:"defense_id,omitempty"`
|
||||
// AttackID holds the value of the "attack_id" field.
|
||||
AttackID int64 `json:"attack_id,omitempty"`
|
||||
// EquipmentInfo holds the value of the "equipment_info" field.
|
||||
EquipmentInfo string `json:"equipment_info,omitempty"`
|
||||
// Artifacts holds the value of the "artifacts" field.
|
||||
Artifacts string `json:"artifacts,omitempty"`
|
||||
// BattleStrategy holds the value of the "battle_strategy" field.
|
||||
BattleStrategy string `json:"battle_strategy,omitempty"`
|
||||
// Prerequisites holds the value of the "prerequisites" field.
|
||||
Prerequisites string `json:"prerequisites,omitempty"`
|
||||
// ImportantNotes holds the value of the "important_notes" field.
|
||||
ImportantNotes string `json:"important_notes,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicGvgDefenseAttackMapping) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicgvgdefenseattackmapping.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case epicgvgdefenseattackmapping.FieldID, epicgvgdefenseattackmapping.FieldDefenseID, epicgvgdefenseattackmapping.FieldAttackID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epicgvgdefenseattackmapping.FieldEquipmentInfo, epicgvgdefenseattackmapping.FieldArtifacts, epicgvgdefenseattackmapping.FieldBattleStrategy, epicgvgdefenseattackmapping.FieldPrerequisites, epicgvgdefenseattackmapping.FieldImportantNotes, epicgvgdefenseattackmapping.FieldCreator, epicgvgdefenseattackmapping.FieldUpdater:
|
||||
values[i] = new(sql.NullString)
|
||||
case epicgvgdefenseattackmapping.FieldCreateTime, epicgvgdefenseattackmapping.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the EpicGvgDefenseAttackMapping fields.
|
||||
func (_m *EpicGvgDefenseAttackMapping) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicgvgdefenseattackmapping.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epicgvgdefenseattackmapping.FieldDefenseID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field defense_id", values[i])
|
||||
} else if value.Valid {
|
||||
_m.DefenseID = value.Int64
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldAttackID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field attack_id", values[i])
|
||||
} else if value.Valid {
|
||||
_m.AttackID = value.Int64
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldEquipmentInfo:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field equipment_info", values[i])
|
||||
} else if value.Valid {
|
||||
_m.EquipmentInfo = value.String
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldArtifacts:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifacts", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Artifacts = value.String
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldBattleStrategy:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field battle_strategy", values[i])
|
||||
} else if value.Valid {
|
||||
_m.BattleStrategy = value.String
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldPrerequisites:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field prerequisites", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Prerequisites = value.String
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldImportantNotes:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field important_notes", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ImportantNotes = value.String
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epicgvgdefenseattackmapping.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the EpicGvgDefenseAttackMapping.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicGvgDefenseAttackMapping) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicGvgDefenseAttackMapping.
|
||||
// Note that you need to call EpicGvgDefenseAttackMapping.Unwrap() before calling this method if this EpicGvgDefenseAttackMapping
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicGvgDefenseAttackMapping) Update() *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
return NewEpicGvgDefenseAttackMappingClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicGvgDefenseAttackMapping 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 *EpicGvgDefenseAttackMapping) Unwrap() *EpicGvgDefenseAttackMapping {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicGvgDefenseAttackMapping is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicGvgDefenseAttackMapping) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicGvgDefenseAttackMapping(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("defense_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.DefenseID))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("attack_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.AttackID))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("equipment_info=")
|
||||
builder.WriteString(_m.EquipmentInfo)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("artifacts=")
|
||||
builder.WriteString(_m.Artifacts)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("battle_strategy=")
|
||||
builder.WriteString(_m.BattleStrategy)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("prerequisites=")
|
||||
builder.WriteString(_m.Prerequisites)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("important_notes=")
|
||||
builder.WriteString(_m.ImportantNotes)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicGvgDefenseAttackMappings is a parsable slice of EpicGvgDefenseAttackMapping.
|
||||
type EpicGvgDefenseAttackMappings []*EpicGvgDefenseAttackMapping
|
||||
@@ -0,0 +1,152 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicgvgdefenseattackmapping
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the epicgvgdefenseattackmapping type in the database.
|
||||
Label = "epic_gvg_defense_attack_mapping"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldDefenseID holds the string denoting the defense_id field in the database.
|
||||
FieldDefenseID = "defense_id"
|
||||
// FieldAttackID holds the string denoting the attack_id field in the database.
|
||||
FieldAttackID = "attack_id"
|
||||
// FieldEquipmentInfo holds the string denoting the equipment_info field in the database.
|
||||
FieldEquipmentInfo = "equipment_info"
|
||||
// FieldArtifacts holds the string denoting the artifacts field in the database.
|
||||
FieldArtifacts = "artifacts"
|
||||
// FieldBattleStrategy holds the string denoting the battle_strategy field in the database.
|
||||
FieldBattleStrategy = "battle_strategy"
|
||||
// FieldPrerequisites holds the string denoting the prerequisites field in the database.
|
||||
FieldPrerequisites = "prerequisites"
|
||||
// FieldImportantNotes holds the string denoting the important_notes field in the database.
|
||||
FieldImportantNotes = "important_notes"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// Table holds the table name of the epicgvgdefenseattackmapping in the database.
|
||||
Table = "epic_gvg_defense_attack_mappings"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for epicgvgdefenseattackmapping fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldDefenseID,
|
||||
FieldAttackID,
|
||||
FieldEquipmentInfo,
|
||||
FieldArtifacts,
|
||||
FieldBattleStrategy,
|
||||
FieldPrerequisites,
|
||||
FieldImportantNotes,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// EquipmentInfoValidator is a validator for the "equipment_info" field. It is called by the builders before save.
|
||||
EquipmentInfoValidator func(string) error
|
||||
// ArtifactsValidator is a validator for the "artifacts" field. It is called by the builders before save.
|
||||
ArtifactsValidator func(string) error
|
||||
// BattleStrategyValidator is a validator for the "battle_strategy" field. It is called by the builders before save.
|
||||
BattleStrategyValidator func(string) error
|
||||
// PrerequisitesValidator is a validator for the "prerequisites" field. It is called by the builders before save.
|
||||
PrerequisitesValidator func(string) error
|
||||
// ImportantNotesValidator is a validator for the "important_notes" field. It is called by the builders before save.
|
||||
ImportantNotesValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the EpicGvgDefenseAttackMapping queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDefenseID orders the results by the defense_id field.
|
||||
func ByDefenseID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDefenseID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAttackID orders the results by the attack_id field.
|
||||
func ByAttackID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAttackID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEquipmentInfo orders the results by the equipment_info field.
|
||||
func ByEquipmentInfo(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEquipmentInfo, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByArtifacts orders the results by the artifacts field.
|
||||
func ByArtifacts(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldArtifacts, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBattleStrategy orders the results by the battle_strategy field.
|
||||
func ByBattleStrategy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBattleStrategy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPrerequisites orders the results by the prerequisites field.
|
||||
func ByPrerequisites(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPrerequisites, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByImportantNotes orders the results by the important_notes field.
|
||||
func ByImportantNotes(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldImportantNotes, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
775
internal/ent/epicgvgdefenseattackmapping/where.go
Normal file
775
internal/ent/epicgvgdefenseattackmapping/where.go
Normal file
@@ -0,0 +1,775 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicgvgdefenseattackmapping
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// DefenseID applies equality check predicate on the "defense_id" field. It's identical to DefenseIDEQ.
|
||||
func DefenseID(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldDefenseID, v))
|
||||
}
|
||||
|
||||
// AttackID applies equality check predicate on the "attack_id" field. It's identical to AttackIDEQ.
|
||||
func AttackID(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldAttackID, v))
|
||||
}
|
||||
|
||||
// EquipmentInfo applies equality check predicate on the "equipment_info" field. It's identical to EquipmentInfoEQ.
|
||||
func EquipmentInfo(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// Artifacts applies equality check predicate on the "artifacts" field. It's identical to ArtifactsEQ.
|
||||
func Artifacts(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// BattleStrategy applies equality check predicate on the "battle_strategy" field. It's identical to BattleStrategyEQ.
|
||||
func BattleStrategy(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// Prerequisites applies equality check predicate on the "prerequisites" field. It's identical to PrerequisitesEQ.
|
||||
func Prerequisites(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// ImportantNotes applies equality check predicate on the "important_notes" field. It's identical to ImportantNotesEQ.
|
||||
func ImportantNotes(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// Creator applies equality check predicate on the "creator" field. It's identical to CreatorEQ.
|
||||
func Creator(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// Updater applies equality check predicate on the "updater" field. It's identical to UpdaterEQ.
|
||||
func Updater(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||
func Deleted(v bool) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DefenseIDEQ applies the EQ predicate on the "defense_id" field.
|
||||
func DefenseIDEQ(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldDefenseID, v))
|
||||
}
|
||||
|
||||
// DefenseIDNEQ applies the NEQ predicate on the "defense_id" field.
|
||||
func DefenseIDNEQ(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldDefenseID, v))
|
||||
}
|
||||
|
||||
// DefenseIDIn applies the In predicate on the "defense_id" field.
|
||||
func DefenseIDIn(vs ...int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldDefenseID, vs...))
|
||||
}
|
||||
|
||||
// DefenseIDNotIn applies the NotIn predicate on the "defense_id" field.
|
||||
func DefenseIDNotIn(vs ...int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldDefenseID, vs...))
|
||||
}
|
||||
|
||||
// DefenseIDGT applies the GT predicate on the "defense_id" field.
|
||||
func DefenseIDGT(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldDefenseID, v))
|
||||
}
|
||||
|
||||
// DefenseIDGTE applies the GTE predicate on the "defense_id" field.
|
||||
func DefenseIDGTE(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldDefenseID, v))
|
||||
}
|
||||
|
||||
// DefenseIDLT applies the LT predicate on the "defense_id" field.
|
||||
func DefenseIDLT(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldDefenseID, v))
|
||||
}
|
||||
|
||||
// DefenseIDLTE applies the LTE predicate on the "defense_id" field.
|
||||
func DefenseIDLTE(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldDefenseID, v))
|
||||
}
|
||||
|
||||
// AttackIDEQ applies the EQ predicate on the "attack_id" field.
|
||||
func AttackIDEQ(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldAttackID, v))
|
||||
}
|
||||
|
||||
// AttackIDNEQ applies the NEQ predicate on the "attack_id" field.
|
||||
func AttackIDNEQ(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldAttackID, v))
|
||||
}
|
||||
|
||||
// AttackIDIn applies the In predicate on the "attack_id" field.
|
||||
func AttackIDIn(vs ...int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldAttackID, vs...))
|
||||
}
|
||||
|
||||
// AttackIDNotIn applies the NotIn predicate on the "attack_id" field.
|
||||
func AttackIDNotIn(vs ...int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldAttackID, vs...))
|
||||
}
|
||||
|
||||
// AttackIDGT applies the GT predicate on the "attack_id" field.
|
||||
func AttackIDGT(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldAttackID, v))
|
||||
}
|
||||
|
||||
// AttackIDGTE applies the GTE predicate on the "attack_id" field.
|
||||
func AttackIDGTE(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldAttackID, v))
|
||||
}
|
||||
|
||||
// AttackIDLT applies the LT predicate on the "attack_id" field.
|
||||
func AttackIDLT(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldAttackID, v))
|
||||
}
|
||||
|
||||
// AttackIDLTE applies the LTE predicate on the "attack_id" field.
|
||||
func AttackIDLTE(v int64) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldAttackID, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoEQ applies the EQ predicate on the "equipment_info" field.
|
||||
func EquipmentInfoEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoNEQ applies the NEQ predicate on the "equipment_info" field.
|
||||
func EquipmentInfoNEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoIn applies the In predicate on the "equipment_info" field.
|
||||
func EquipmentInfoIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldEquipmentInfo, vs...))
|
||||
}
|
||||
|
||||
// EquipmentInfoNotIn applies the NotIn predicate on the "equipment_info" field.
|
||||
func EquipmentInfoNotIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldEquipmentInfo, vs...))
|
||||
}
|
||||
|
||||
// EquipmentInfoGT applies the GT predicate on the "equipment_info" field.
|
||||
func EquipmentInfoGT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoGTE applies the GTE predicate on the "equipment_info" field.
|
||||
func EquipmentInfoGTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoLT applies the LT predicate on the "equipment_info" field.
|
||||
func EquipmentInfoLT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoLTE applies the LTE predicate on the "equipment_info" field.
|
||||
func EquipmentInfoLTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoContains applies the Contains predicate on the "equipment_info" field.
|
||||
func EquipmentInfoContains(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContains(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoHasPrefix applies the HasPrefix predicate on the "equipment_info" field.
|
||||
func EquipmentInfoHasPrefix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasPrefix(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoHasSuffix applies the HasSuffix predicate on the "equipment_info" field.
|
||||
func EquipmentInfoHasSuffix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasSuffix(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoEqualFold applies the EqualFold predicate on the "equipment_info" field.
|
||||
func EquipmentInfoEqualFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEqualFold(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// EquipmentInfoContainsFold applies the ContainsFold predicate on the "equipment_info" field.
|
||||
func EquipmentInfoContainsFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContainsFold(FieldEquipmentInfo, v))
|
||||
}
|
||||
|
||||
// ArtifactsEQ applies the EQ predicate on the "artifacts" field.
|
||||
func ArtifactsEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsNEQ applies the NEQ predicate on the "artifacts" field.
|
||||
func ArtifactsNEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsIn applies the In predicate on the "artifacts" field.
|
||||
func ArtifactsIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldArtifacts, vs...))
|
||||
}
|
||||
|
||||
// ArtifactsNotIn applies the NotIn predicate on the "artifacts" field.
|
||||
func ArtifactsNotIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldArtifacts, vs...))
|
||||
}
|
||||
|
||||
// ArtifactsGT applies the GT predicate on the "artifacts" field.
|
||||
func ArtifactsGT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsGTE applies the GTE predicate on the "artifacts" field.
|
||||
func ArtifactsGTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsLT applies the LT predicate on the "artifacts" field.
|
||||
func ArtifactsLT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsLTE applies the LTE predicate on the "artifacts" field.
|
||||
func ArtifactsLTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsContains applies the Contains predicate on the "artifacts" field.
|
||||
func ArtifactsContains(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContains(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsHasPrefix applies the HasPrefix predicate on the "artifacts" field.
|
||||
func ArtifactsHasPrefix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasPrefix(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsHasSuffix applies the HasSuffix predicate on the "artifacts" field.
|
||||
func ArtifactsHasSuffix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasSuffix(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsEqualFold applies the EqualFold predicate on the "artifacts" field.
|
||||
func ArtifactsEqualFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEqualFold(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// ArtifactsContainsFold applies the ContainsFold predicate on the "artifacts" field.
|
||||
func ArtifactsContainsFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContainsFold(FieldArtifacts, v))
|
||||
}
|
||||
|
||||
// BattleStrategyEQ applies the EQ predicate on the "battle_strategy" field.
|
||||
func BattleStrategyEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyNEQ applies the NEQ predicate on the "battle_strategy" field.
|
||||
func BattleStrategyNEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyIn applies the In predicate on the "battle_strategy" field.
|
||||
func BattleStrategyIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldBattleStrategy, vs...))
|
||||
}
|
||||
|
||||
// BattleStrategyNotIn applies the NotIn predicate on the "battle_strategy" field.
|
||||
func BattleStrategyNotIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldBattleStrategy, vs...))
|
||||
}
|
||||
|
||||
// BattleStrategyGT applies the GT predicate on the "battle_strategy" field.
|
||||
func BattleStrategyGT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyGTE applies the GTE predicate on the "battle_strategy" field.
|
||||
func BattleStrategyGTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyLT applies the LT predicate on the "battle_strategy" field.
|
||||
func BattleStrategyLT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyLTE applies the LTE predicate on the "battle_strategy" field.
|
||||
func BattleStrategyLTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyContains applies the Contains predicate on the "battle_strategy" field.
|
||||
func BattleStrategyContains(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContains(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyHasPrefix applies the HasPrefix predicate on the "battle_strategy" field.
|
||||
func BattleStrategyHasPrefix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasPrefix(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyHasSuffix applies the HasSuffix predicate on the "battle_strategy" field.
|
||||
func BattleStrategyHasSuffix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasSuffix(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyEqualFold applies the EqualFold predicate on the "battle_strategy" field.
|
||||
func BattleStrategyEqualFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEqualFold(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// BattleStrategyContainsFold applies the ContainsFold predicate on the "battle_strategy" field.
|
||||
func BattleStrategyContainsFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContainsFold(FieldBattleStrategy, v))
|
||||
}
|
||||
|
||||
// PrerequisitesEQ applies the EQ predicate on the "prerequisites" field.
|
||||
func PrerequisitesEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesNEQ applies the NEQ predicate on the "prerequisites" field.
|
||||
func PrerequisitesNEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesIn applies the In predicate on the "prerequisites" field.
|
||||
func PrerequisitesIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldPrerequisites, vs...))
|
||||
}
|
||||
|
||||
// PrerequisitesNotIn applies the NotIn predicate on the "prerequisites" field.
|
||||
func PrerequisitesNotIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldPrerequisites, vs...))
|
||||
}
|
||||
|
||||
// PrerequisitesGT applies the GT predicate on the "prerequisites" field.
|
||||
func PrerequisitesGT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesGTE applies the GTE predicate on the "prerequisites" field.
|
||||
func PrerequisitesGTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesLT applies the LT predicate on the "prerequisites" field.
|
||||
func PrerequisitesLT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesLTE applies the LTE predicate on the "prerequisites" field.
|
||||
func PrerequisitesLTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesContains applies the Contains predicate on the "prerequisites" field.
|
||||
func PrerequisitesContains(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContains(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesHasPrefix applies the HasPrefix predicate on the "prerequisites" field.
|
||||
func PrerequisitesHasPrefix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasPrefix(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesHasSuffix applies the HasSuffix predicate on the "prerequisites" field.
|
||||
func PrerequisitesHasSuffix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasSuffix(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesEqualFold applies the EqualFold predicate on the "prerequisites" field.
|
||||
func PrerequisitesEqualFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEqualFold(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// PrerequisitesContainsFold applies the ContainsFold predicate on the "prerequisites" field.
|
||||
func PrerequisitesContainsFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContainsFold(FieldPrerequisites, v))
|
||||
}
|
||||
|
||||
// ImportantNotesEQ applies the EQ predicate on the "important_notes" field.
|
||||
func ImportantNotesEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesNEQ applies the NEQ predicate on the "important_notes" field.
|
||||
func ImportantNotesNEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesIn applies the In predicate on the "important_notes" field.
|
||||
func ImportantNotesIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldImportantNotes, vs...))
|
||||
}
|
||||
|
||||
// ImportantNotesNotIn applies the NotIn predicate on the "important_notes" field.
|
||||
func ImportantNotesNotIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldImportantNotes, vs...))
|
||||
}
|
||||
|
||||
// ImportantNotesGT applies the GT predicate on the "important_notes" field.
|
||||
func ImportantNotesGT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesGTE applies the GTE predicate on the "important_notes" field.
|
||||
func ImportantNotesGTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesLT applies the LT predicate on the "important_notes" field.
|
||||
func ImportantNotesLT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesLTE applies the LTE predicate on the "important_notes" field.
|
||||
func ImportantNotesLTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesContains applies the Contains predicate on the "important_notes" field.
|
||||
func ImportantNotesContains(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContains(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesHasPrefix applies the HasPrefix predicate on the "important_notes" field.
|
||||
func ImportantNotesHasPrefix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasPrefix(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesHasSuffix applies the HasSuffix predicate on the "important_notes" field.
|
||||
func ImportantNotesHasSuffix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasSuffix(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesEqualFold applies the EqualFold predicate on the "important_notes" field.
|
||||
func ImportantNotesEqualFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEqualFold(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// ImportantNotesContainsFold applies the ContainsFold predicate on the "important_notes" field.
|
||||
func ImportantNotesContainsFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContainsFold(FieldImportantNotes, v))
|
||||
}
|
||||
|
||||
// CreatorEQ applies the EQ predicate on the "creator" field.
|
||||
func CreatorEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorNEQ applies the NEQ predicate on the "creator" field.
|
||||
func CreatorNEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorIn applies the In predicate on the "creator" field.
|
||||
func CreatorIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorNotIn applies the NotIn predicate on the "creator" field.
|
||||
func CreatorNotIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorGT applies the GT predicate on the "creator" field.
|
||||
func CreatorGT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorGTE applies the GTE predicate on the "creator" field.
|
||||
func CreatorGTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLT applies the LT predicate on the "creator" field.
|
||||
func CreatorLT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLTE applies the LTE predicate on the "creator" field.
|
||||
func CreatorLTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContains applies the Contains predicate on the "creator" field.
|
||||
func CreatorContains(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContains(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasPrefix applies the HasPrefix predicate on the "creator" field.
|
||||
func CreatorHasPrefix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasPrefix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasSuffix applies the HasSuffix predicate on the "creator" field.
|
||||
func CreatorHasSuffix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasSuffix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorEqualFold applies the EqualFold predicate on the "creator" field.
|
||||
func CreatorEqualFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEqualFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContainsFold applies the ContainsFold predicate on the "creator" field.
|
||||
func CreatorContainsFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContainsFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIsNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// UpdaterEQ applies the EQ predicate on the "updater" field.
|
||||
func UpdaterEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterNEQ applies the NEQ predicate on the "updater" field.
|
||||
func UpdaterNEQ(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterIn applies the In predicate on the "updater" field.
|
||||
func UpdaterIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterNotIn applies the NotIn predicate on the "updater" field.
|
||||
func UpdaterNotIn(vs ...string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterGT applies the GT predicate on the "updater" field.
|
||||
func UpdaterGT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterGTE applies the GTE predicate on the "updater" field.
|
||||
func UpdaterGTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLT applies the LT predicate on the "updater" field.
|
||||
func UpdaterLT(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLTE applies the LTE predicate on the "updater" field.
|
||||
func UpdaterLTE(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContains applies the Contains predicate on the "updater" field.
|
||||
func UpdaterContains(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContains(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasPrefix applies the HasPrefix predicate on the "updater" field.
|
||||
func UpdaterHasPrefix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasPrefix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasSuffix applies the HasSuffix predicate on the "updater" field.
|
||||
func UpdaterHasSuffix(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldHasSuffix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterEqualFold applies the EqualFold predicate on the "updater" field.
|
||||
func UpdaterEqualFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEqualFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContainsFold applies the ContainsFold predicate on the "updater" field.
|
||||
func UpdaterContainsFold(v string) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldContainsFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v time.Time) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIsNil applies the IsNil predicate on the "update_time" field.
|
||||
func UpdateTimeIsNil() predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldIsNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// UpdateTimeNotNil applies the NotNil predicate on the "update_time" field.
|
||||
func UpdateTimeNotNil() predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNotNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||
func DeletedEQ(v bool) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||
func DeletedNEQ(v bool) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.FieldNEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.EpicGvgDefenseAttackMapping) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.EpicGvgDefenseAttackMapping) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.EpicGvgDefenseAttackMapping) predicate.EpicGvgDefenseAttackMapping {
|
||||
return predicate.EpicGvgDefenseAttackMapping(sql.NotPredicates(p))
|
||||
}
|
||||
384
internal/ent/epicgvgdefenseattackmapping_create.go
Normal file
384
internal/ent/epicgvgdefenseattackmapping_create.go
Normal file
@@ -0,0 +1,384 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseAttackMappingCreate is the builder for creating a EpicGvgDefenseAttackMapping entity.
|
||||
type EpicGvgDefenseAttackMappingCreate struct {
|
||||
config
|
||||
mutation *EpicGvgDefenseAttackMappingMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetDefenseID sets the "defense_id" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetDefenseID(v int64) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetDefenseID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAttackID sets the "attack_id" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetAttackID(v int64) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetAttackID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetEquipmentInfo sets the "equipment_info" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetEquipmentInfo(v string) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetEquipmentInfo(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetArtifacts sets the "artifacts" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetArtifacts(v string) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetArtifacts(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetBattleStrategy sets the "battle_strategy" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetBattleStrategy(v string) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetBattleStrategy(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetPrerequisites sets the "prerequisites" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetPrerequisites(v string) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetPrerequisites(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetImportantNotes sets the "important_notes" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetImportantNotes(v string) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetImportantNotes(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetCreator(v string) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetCreateTime(v time.Time) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetNillableCreateTime(v *time.Time) *EpicGvgDefenseAttackMappingCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetUpdater(v string) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetUpdateTime(v time.Time) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetNillableUpdateTime(v *time.Time) *EpicGvgDefenseAttackMappingCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetDeleted(v bool) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SetID(v int64) *EpicGvgDefenseAttackMappingCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgDefenseAttackMappingMutation object of the builder.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) Mutation() *EpicGvgDefenseAttackMappingMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the EpicGvgDefenseAttackMapping in the database.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) Save(ctx context.Context) (*EpicGvgDefenseAttackMapping, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) SaveX(ctx context.Context) *EpicGvgDefenseAttackMapping {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) 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 (_c *EpicGvgDefenseAttackMappingCreate) check() error {
|
||||
if _, ok := _c.mutation.DefenseID(); !ok {
|
||||
return &ValidationError{Name: "defense_id", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.defense_id"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.AttackID(); !ok {
|
||||
return &ValidationError{Name: "attack_id", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.attack_id"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.EquipmentInfo(); !ok {
|
||||
return &ValidationError{Name: "equipment_info", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.equipment_info"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.EquipmentInfo(); ok {
|
||||
if err := epicgvgdefenseattackmapping.EquipmentInfoValidator(v); err != nil {
|
||||
return &ValidationError{Name: "equipment_info", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.equipment_info": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Artifacts(); !ok {
|
||||
return &ValidationError{Name: "artifacts", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.artifacts"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Artifacts(); ok {
|
||||
if err := epicgvgdefenseattackmapping.ArtifactsValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifacts", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.artifacts": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.BattleStrategy(); !ok {
|
||||
return &ValidationError{Name: "battle_strategy", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.battle_strategy"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.BattleStrategy(); ok {
|
||||
if err := epicgvgdefenseattackmapping.BattleStrategyValidator(v); err != nil {
|
||||
return &ValidationError{Name: "battle_strategy", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.battle_strategy": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Prerequisites(); !ok {
|
||||
return &ValidationError{Name: "prerequisites", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.prerequisites"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Prerequisites(); ok {
|
||||
if err := epicgvgdefenseattackmapping.PrerequisitesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "prerequisites", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.prerequisites": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.ImportantNotes(); !ok {
|
||||
return &ValidationError{Name: "important_notes", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.important_notes"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.ImportantNotes(); ok {
|
||||
if err := epicgvgdefenseattackmapping.ImportantNotesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "important_notes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.important_notes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := epicgvgdefenseattackmapping.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := epicgvgdefenseattackmapping.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "EpicGvgDefenseAttackMapping.deleted"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) sqlSave(ctx context.Context) (*EpicGvgDefenseAttackMapping, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *EpicGvgDefenseAttackMappingCreate) createSpec() (*EpicGvgDefenseAttackMapping, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &EpicGvgDefenseAttackMapping{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(epicgvgdefenseattackmapping.Table, sqlgraph.NewFieldSpec(epicgvgdefenseattackmapping.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.DefenseID(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldDefenseID, field.TypeInt64, value)
|
||||
_node.DefenseID = value
|
||||
}
|
||||
if value, ok := _c.mutation.AttackID(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldAttackID, field.TypeInt64, value)
|
||||
_node.AttackID = value
|
||||
}
|
||||
if value, ok := _c.mutation.EquipmentInfo(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldEquipmentInfo, field.TypeString, value)
|
||||
_node.EquipmentInfo = value
|
||||
}
|
||||
if value, ok := _c.mutation.Artifacts(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldArtifacts, field.TypeString, value)
|
||||
_node.Artifacts = value
|
||||
}
|
||||
if value, ok := _c.mutation.BattleStrategy(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldBattleStrategy, field.TypeString, value)
|
||||
_node.BattleStrategy = value
|
||||
}
|
||||
if value, ok := _c.mutation.Prerequisites(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldPrerequisites, field.TypeString, value)
|
||||
_node.Prerequisites = value
|
||||
}
|
||||
if value, ok := _c.mutation.ImportantNotes(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldImportantNotes, field.TypeString, value)
|
||||
_node.ImportantNotes = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// EpicGvgDefenseAttackMappingCreateBulk is the builder for creating many EpicGvgDefenseAttackMapping entities in bulk.
|
||||
type EpicGvgDefenseAttackMappingCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*EpicGvgDefenseAttackMappingCreate
|
||||
}
|
||||
|
||||
// Save creates the EpicGvgDefenseAttackMapping entities in the database.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreateBulk) Save(ctx context.Context) ([]*EpicGvgDefenseAttackMapping, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*EpicGvgDefenseAttackMapping, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*EpicGvgDefenseAttackMappingMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreateBulk) SaveX(ctx context.Context) []*EpicGvgDefenseAttackMapping {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicGvgDefenseAttackMappingCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/epicgvgdefenseattackmapping_delete.go
Normal file
88
internal/ent/epicgvgdefenseattackmapping_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseAttackMappingDelete is the builder for deleting a EpicGvgDefenseAttackMapping entity.
|
||||
type EpicGvgDefenseAttackMappingDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicGvgDefenseAttackMappingMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseAttackMappingDelete builder.
|
||||
func (_d *EpicGvgDefenseAttackMappingDelete) Where(ps ...predicate.EpicGvgDefenseAttackMapping) *EpicGvgDefenseAttackMappingDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *EpicGvgDefenseAttackMappingDelete) 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 (_d *EpicGvgDefenseAttackMappingDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *EpicGvgDefenseAttackMappingDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(epicgvgdefenseattackmapping.Table, sqlgraph.NewFieldSpec(epicgvgdefenseattackmapping.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// EpicGvgDefenseAttackMappingDeleteOne is the builder for deleting a single EpicGvgDefenseAttackMapping entity.
|
||||
type EpicGvgDefenseAttackMappingDeleteOne struct {
|
||||
_d *EpicGvgDefenseAttackMappingDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseAttackMappingDelete builder.
|
||||
func (_d *EpicGvgDefenseAttackMappingDeleteOne) Where(ps ...predicate.EpicGvgDefenseAttackMapping) *EpicGvgDefenseAttackMappingDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *EpicGvgDefenseAttackMappingDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{epicgvgdefenseattackmapping.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *EpicGvgDefenseAttackMappingDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/epicgvgdefenseattackmapping_query.go
Normal file
527
internal/ent/epicgvgdefenseattackmapping_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseAttackMappingQuery is the builder for querying EpicGvgDefenseAttackMapping entities.
|
||||
type EpicGvgDefenseAttackMappingQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []epicgvgdefenseattackmapping.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.EpicGvgDefenseAttackMapping
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the EpicGvgDefenseAttackMappingQuery builder.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Where(ps ...predicate.EpicGvgDefenseAttackMapping) *EpicGvgDefenseAttackMappingQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Limit(limit int) *EpicGvgDefenseAttackMappingQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Offset(offset int) *EpicGvgDefenseAttackMappingQuery {
|
||||
_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 (_q *EpicGvgDefenseAttackMappingQuery) Unique(unique bool) *EpicGvgDefenseAttackMappingQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Order(o ...epicgvgdefenseattackmapping.OrderOption) *EpicGvgDefenseAttackMappingQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first EpicGvgDefenseAttackMapping entity from the query.
|
||||
// Returns a *NotFoundError when no EpicGvgDefenseAttackMapping was found.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) First(ctx context.Context) (*EpicGvgDefenseAttackMapping, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{epicgvgdefenseattackmapping.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) FirstX(ctx context.Context) *EpicGvgDefenseAttackMapping {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first EpicGvgDefenseAttackMapping ID from the query.
|
||||
// Returns a *NotFoundError when no EpicGvgDefenseAttackMapping ID was found.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{epicgvgdefenseattackmapping.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single EpicGvgDefenseAttackMapping entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one EpicGvgDefenseAttackMapping entity is found.
|
||||
// Returns a *NotFoundError when no EpicGvgDefenseAttackMapping entities are found.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Only(ctx context.Context) (*EpicGvgDefenseAttackMapping, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{epicgvgdefenseattackmapping.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{epicgvgdefenseattackmapping.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) OnlyX(ctx context.Context) *EpicGvgDefenseAttackMapping {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only EpicGvgDefenseAttackMapping ID in the query.
|
||||
// Returns a *NotSingularError when more than one EpicGvgDefenseAttackMapping ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{epicgvgdefenseattackmapping.Label}
|
||||
default:
|
||||
err = &NotSingularError{epicgvgdefenseattackmapping.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of EpicGvgDefenseAttackMappings.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) All(ctx context.Context) ([]*EpicGvgDefenseAttackMapping, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*EpicGvgDefenseAttackMapping, *EpicGvgDefenseAttackMappingQuery]()
|
||||
return withInterceptors[[]*EpicGvgDefenseAttackMapping](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) AllX(ctx context.Context) []*EpicGvgDefenseAttackMapping {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of EpicGvgDefenseAttackMapping IDs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(epicgvgdefenseattackmapping.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) 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, _q, querierCount[*EpicGvgDefenseAttackMappingQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the EpicGvgDefenseAttackMappingQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Clone() *EpicGvgDefenseAttackMappingQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &EpicGvgDefenseAttackMappingQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]epicgvgdefenseattackmapping.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.EpicGvgDefenseAttackMapping{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// DefenseID int64 `json:"defense_id,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicGvgDefenseAttackMapping.Query().
|
||||
// GroupBy(epicgvgdefenseattackmapping.FieldDefenseID).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) GroupBy(field string, fields ...string) *EpicGvgDefenseAttackMappingGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &EpicGvgDefenseAttackMappingGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = epicgvgdefenseattackmapping.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// DefenseID int64 `json:"defense_id,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicGvgDefenseAttackMapping.Query().
|
||||
// Select(epicgvgdefenseattackmapping.FieldDefenseID).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Select(fields ...string) *EpicGvgDefenseAttackMappingSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &EpicGvgDefenseAttackMappingSelect{EpicGvgDefenseAttackMappingQuery: _q}
|
||||
sbuild.label = epicgvgdefenseattackmapping.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a EpicGvgDefenseAttackMappingSelect configured with the given aggregations.
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) Aggregate(fns ...AggregateFunc) *EpicGvgDefenseAttackMappingSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !epicgvgdefenseattackmapping.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EpicGvgDefenseAttackMapping, error) {
|
||||
var (
|
||||
nodes = []*EpicGvgDefenseAttackMapping{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*EpicGvgDefenseAttackMapping).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &EpicGvgDefenseAttackMapping{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(epicgvgdefenseattackmapping.Table, epicgvgdefenseattackmapping.Columns, sqlgraph.NewFieldSpec(epicgvgdefenseattackmapping.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicgvgdefenseattackmapping.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != epicgvgdefenseattackmapping.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseAttackMappingQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(epicgvgdefenseattackmapping.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = epicgvgdefenseattackmapping.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// EpicGvgDefenseAttackMappingGroupBy is the group-by builder for EpicGvgDefenseAttackMapping entities.
|
||||
type EpicGvgDefenseAttackMappingGroupBy struct {
|
||||
selector
|
||||
build *EpicGvgDefenseAttackMappingQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *EpicGvgDefenseAttackMappingGroupBy) Aggregate(fns ...AggregateFunc) *EpicGvgDefenseAttackMappingGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *EpicGvgDefenseAttackMappingGroupBy) 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[*EpicGvgDefenseAttackMappingQuery, *EpicGvgDefenseAttackMappingGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *EpicGvgDefenseAttackMappingGroupBy) sqlScan(ctx context.Context, root *EpicGvgDefenseAttackMappingQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// EpicGvgDefenseAttackMappingSelect is the builder for selecting fields of EpicGvgDefenseAttackMapping entities.
|
||||
type EpicGvgDefenseAttackMappingSelect struct {
|
||||
*EpicGvgDefenseAttackMappingQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *EpicGvgDefenseAttackMappingSelect) Aggregate(fns ...AggregateFunc) *EpicGvgDefenseAttackMappingSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *EpicGvgDefenseAttackMappingSelect) 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[*EpicGvgDefenseAttackMappingQuery, *EpicGvgDefenseAttackMappingSelect](ctx, _s.EpicGvgDefenseAttackMappingQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *EpicGvgDefenseAttackMappingSelect) sqlScan(ctx context.Context, root *EpicGvgDefenseAttackMappingQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
746
internal/ent/epicgvgdefenseattackmapping_update.go
Normal file
746
internal/ent/epicgvgdefenseattackmapping_update.go
Normal file
@@ -0,0 +1,746 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseAttackMappingUpdate is the builder for updating EpicGvgDefenseAttackMapping entities.
|
||||
type EpicGvgDefenseAttackMappingUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicGvgDefenseAttackMappingMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseAttackMappingUpdate builder.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) Where(ps ...predicate.EpicGvgDefenseAttackMapping) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDefenseID sets the "defense_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetDefenseID(v int64) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.ResetDefenseID()
|
||||
_u.mutation.SetDefenseID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDefenseID sets the "defense_id" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableDefenseID(v *int64) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetDefenseID(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDefenseID adds value to the "defense_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) AddDefenseID(v int64) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.AddDefenseID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAttackID sets the "attack_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetAttackID(v int64) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.ResetAttackID()
|
||||
_u.mutation.SetAttackID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAttackID sets the "attack_id" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableAttackID(v *int64) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetAttackID(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddAttackID adds value to the "attack_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) AddAttackID(v int64) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.AddAttackID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEquipmentInfo sets the "equipment_info" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetEquipmentInfo(v string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetEquipmentInfo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableEquipmentInfo sets the "equipment_info" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableEquipmentInfo(v *string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetEquipmentInfo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifacts sets the "artifacts" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetArtifacts(v string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetArtifacts(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifacts sets the "artifacts" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableArtifacts(v *string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetArtifacts(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBattleStrategy sets the "battle_strategy" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetBattleStrategy(v string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetBattleStrategy(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableBattleStrategy sets the "battle_strategy" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableBattleStrategy(v *string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetBattleStrategy(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPrerequisites sets the "prerequisites" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetPrerequisites(v string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetPrerequisites(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePrerequisites sets the "prerequisites" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillablePrerequisites(v *string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetPrerequisites(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetImportantNotes sets the "important_notes" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetImportantNotes(v string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetImportantNotes(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableImportantNotes sets the "important_notes" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableImportantNotes(v *string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetImportantNotes(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetCreator(v string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableCreator(v *string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetCreateTime(v time.Time) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableCreateTime(v *time.Time) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) ClearCreateTime() *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetUpdater(v string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableUpdater(v *string) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetUpdateTime(v time.Time) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableUpdateTime(v *time.Time) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) ClearUpdateTime() *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetDeleted(v bool) *EpicGvgDefenseAttackMappingUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) SetNillableDeleted(v *bool) *EpicGvgDefenseAttackMappingUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgDefenseAttackMappingMutation object of the builder.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) Mutation() *EpicGvgDefenseAttackMappingMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) 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 (_u *EpicGvgDefenseAttackMappingUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) check() error {
|
||||
if v, ok := _u.mutation.EquipmentInfo(); ok {
|
||||
if err := epicgvgdefenseattackmapping.EquipmentInfoValidator(v); err != nil {
|
||||
return &ValidationError{Name: "equipment_info", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.equipment_info": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Artifacts(); ok {
|
||||
if err := epicgvgdefenseattackmapping.ArtifactsValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifacts", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.artifacts": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.BattleStrategy(); ok {
|
||||
if err := epicgvgdefenseattackmapping.BattleStrategyValidator(v); err != nil {
|
||||
return &ValidationError{Name: "battle_strategy", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.battle_strategy": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Prerequisites(); ok {
|
||||
if err := epicgvgdefenseattackmapping.PrerequisitesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "prerequisites", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.prerequisites": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ImportantNotes(); ok {
|
||||
if err := epicgvgdefenseattackmapping.ImportantNotesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "important_notes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.important_notes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicgvgdefenseattackmapping.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicgvgdefenseattackmapping.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicgvgdefenseattackmapping.Table, epicgvgdefenseattackmapping.Columns, sqlgraph.NewFieldSpec(epicgvgdefenseattackmapping.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.DefenseID(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldDefenseID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedDefenseID(); ok {
|
||||
_spec.AddField(epicgvgdefenseattackmapping.FieldDefenseID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AttackID(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldAttackID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedAttackID(); ok {
|
||||
_spec.AddField(epicgvgdefenseattackmapping.FieldAttackID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.EquipmentInfo(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldEquipmentInfo, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Artifacts(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldArtifacts, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.BattleStrategy(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldBattleStrategy, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Prerequisites(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldPrerequisites, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ImportantNotes(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldImportantNotes, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseattackmapping.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseattackmapping.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicgvgdefenseattackmapping.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// EpicGvgDefenseAttackMappingUpdateOne is the builder for updating a single EpicGvgDefenseAttackMapping entity.
|
||||
type EpicGvgDefenseAttackMappingUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *EpicGvgDefenseAttackMappingMutation
|
||||
}
|
||||
|
||||
// SetDefenseID sets the "defense_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetDefenseID(v int64) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.ResetDefenseID()
|
||||
_u.mutation.SetDefenseID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDefenseID sets the "defense_id" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableDefenseID(v *int64) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDefenseID(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDefenseID adds value to the "defense_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) AddDefenseID(v int64) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.AddDefenseID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAttackID sets the "attack_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetAttackID(v int64) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.ResetAttackID()
|
||||
_u.mutation.SetAttackID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAttackID sets the "attack_id" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableAttackID(v *int64) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetAttackID(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddAttackID adds value to the "attack_id" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) AddAttackID(v int64) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.AddAttackID(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetEquipmentInfo sets the "equipment_info" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetEquipmentInfo(v string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetEquipmentInfo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableEquipmentInfo sets the "equipment_info" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableEquipmentInfo(v *string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetEquipmentInfo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifacts sets the "artifacts" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetArtifacts(v string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetArtifacts(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifacts sets the "artifacts" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableArtifacts(v *string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetArtifacts(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBattleStrategy sets the "battle_strategy" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetBattleStrategy(v string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetBattleStrategy(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableBattleStrategy sets the "battle_strategy" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableBattleStrategy(v *string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetBattleStrategy(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPrerequisites sets the "prerequisites" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetPrerequisites(v string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetPrerequisites(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePrerequisites sets the "prerequisites" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillablePrerequisites(v *string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetPrerequisites(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetImportantNotes sets the "important_notes" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetImportantNotes(v string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetImportantNotes(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableImportantNotes sets the "important_notes" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableImportantNotes(v *string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetImportantNotes(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetCreator(v string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableCreator(v *string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetCreateTime(v time.Time) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableCreateTime(v *time.Time) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) ClearCreateTime() *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetUpdater(v string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableUpdater(v *string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetUpdateTime(v time.Time) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableUpdateTime(v *time.Time) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) ClearUpdateTime() *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetDeleted(v bool) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SetNillableDeleted(v *bool) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgDefenseAttackMappingMutation object of the builder.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) Mutation() *EpicGvgDefenseAttackMappingMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseAttackMappingUpdate builder.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) Where(ps ...predicate.EpicGvgDefenseAttackMapping) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_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 (_u *EpicGvgDefenseAttackMappingUpdateOne) Select(field string, fields ...string) *EpicGvgDefenseAttackMappingUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated EpicGvgDefenseAttackMapping entity.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) Save(ctx context.Context) (*EpicGvgDefenseAttackMapping, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) SaveX(ctx context.Context) *EpicGvgDefenseAttackMapping {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.EquipmentInfo(); ok {
|
||||
if err := epicgvgdefenseattackmapping.EquipmentInfoValidator(v); err != nil {
|
||||
return &ValidationError{Name: "equipment_info", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.equipment_info": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Artifacts(); ok {
|
||||
if err := epicgvgdefenseattackmapping.ArtifactsValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifacts", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.artifacts": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.BattleStrategy(); ok {
|
||||
if err := epicgvgdefenseattackmapping.BattleStrategyValidator(v); err != nil {
|
||||
return &ValidationError{Name: "battle_strategy", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.battle_strategy": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Prerequisites(); ok {
|
||||
if err := epicgvgdefenseattackmapping.PrerequisitesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "prerequisites", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.prerequisites": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ImportantNotes(); ok {
|
||||
if err := epicgvgdefenseattackmapping.ImportantNotesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "important_notes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.important_notes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicgvgdefenseattackmapping.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicgvgdefenseattackmapping.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseAttackMapping.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicGvgDefenseAttackMappingUpdateOne) sqlSave(ctx context.Context) (_node *EpicGvgDefenseAttackMapping, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicgvgdefenseattackmapping.Table, epicgvgdefenseattackmapping.Columns, sqlgraph.NewFieldSpec(epicgvgdefenseattackmapping.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EpicGvgDefenseAttackMapping.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicgvgdefenseattackmapping.FieldID)
|
||||
for _, f := range fields {
|
||||
if !epicgvgdefenseattackmapping.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != epicgvgdefenseattackmapping.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.DefenseID(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldDefenseID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedDefenseID(); ok {
|
||||
_spec.AddField(epicgvgdefenseattackmapping.FieldDefenseID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AttackID(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldAttackID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedAttackID(); ok {
|
||||
_spec.AddField(epicgvgdefenseattackmapping.FieldAttackID, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.EquipmentInfo(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldEquipmentInfo, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Artifacts(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldArtifacts, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.BattleStrategy(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldBattleStrategy, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Prerequisites(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldPrerequisites, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ImportantNotes(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldImportantNotes, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseattackmapping.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseattackmapping.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgdefenseattackmapping.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
_node = &EpicGvgDefenseAttackMapping{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicgvgdefenseattackmapping.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
169
internal/ent/epicgvgdefenseteams.go
Normal file
169
internal/ent/epicgvgdefenseteams.go
Normal file
@@ -0,0 +1,169 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epicgvgdefenseteams"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseTeams is the model entity for the EpicGvgDefenseTeams schema.
|
||||
type EpicGvgDefenseTeams struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// DefenseHeroes holds the value of the "defense_heroes" field.
|
||||
DefenseHeroes string `json:"defense_heroes,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicGvgDefenseTeams) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicgvgdefenseteams.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case epicgvgdefenseteams.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epicgvgdefenseteams.FieldDefenseHeroes, epicgvgdefenseteams.FieldCreator, epicgvgdefenseteams.FieldUpdater:
|
||||
values[i] = new(sql.NullString)
|
||||
case epicgvgdefenseteams.FieldCreateTime, epicgvgdefenseteams.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the EpicGvgDefenseTeams fields.
|
||||
func (_m *EpicGvgDefenseTeams) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicgvgdefenseteams.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epicgvgdefenseteams.FieldDefenseHeroes:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field defense_heroes", values[i])
|
||||
} else if value.Valid {
|
||||
_m.DefenseHeroes = value.String
|
||||
}
|
||||
case epicgvgdefenseteams.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epicgvgdefenseteams.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epicgvgdefenseteams.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epicgvgdefenseteams.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epicgvgdefenseteams.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the EpicGvgDefenseTeams.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicGvgDefenseTeams) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicGvgDefenseTeams.
|
||||
// Note that you need to call EpicGvgDefenseTeams.Unwrap() before calling this method if this EpicGvgDefenseTeams
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicGvgDefenseTeams) Update() *EpicGvgDefenseTeamsUpdateOne {
|
||||
return NewEpicGvgDefenseTeamsClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicGvgDefenseTeams 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 *EpicGvgDefenseTeams) Unwrap() *EpicGvgDefenseTeams {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicGvgDefenseTeams is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicGvgDefenseTeams) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicGvgDefenseTeams(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("defense_heroes=")
|
||||
builder.WriteString(_m.DefenseHeroes)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicGvgDefenseTeamsSlice is a parsable slice of EpicGvgDefenseTeams.
|
||||
type EpicGvgDefenseTeamsSlice []*EpicGvgDefenseTeams
|
||||
96
internal/ent/epicgvgdefenseteams/epicgvgdefenseteams.go
Normal file
96
internal/ent/epicgvgdefenseteams/epicgvgdefenseteams.go
Normal file
@@ -0,0 +1,96 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicgvgdefenseteams
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the epicgvgdefenseteams type in the database.
|
||||
Label = "epic_gvg_defense_teams"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldDefenseHeroes holds the string denoting the defense_heroes field in the database.
|
||||
FieldDefenseHeroes = "defense_heroes"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// Table holds the table name of the epicgvgdefenseteams in the database.
|
||||
Table = "epic_gvg_defense_teams"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for epicgvgdefenseteams fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldDefenseHeroes,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// DefenseHeroesValidator is a validator for the "defense_heroes" field. It is called by the builders before save.
|
||||
DefenseHeroesValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the EpicGvgDefenseTeams queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDefenseHeroes orders the results by the defense_heroes field.
|
||||
func ByDefenseHeroes(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDefenseHeroes, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
405
internal/ent/epicgvgdefenseteams/where.go
Normal file
405
internal/ent/epicgvgdefenseteams/where.go
Normal file
@@ -0,0 +1,405 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicgvgdefenseteams
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// DefenseHeroes applies equality check predicate on the "defense_heroes" field. It's identical to DefenseHeroesEQ.
|
||||
func DefenseHeroes(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// Creator applies equality check predicate on the "creator" field. It's identical to CreatorEQ.
|
||||
func Creator(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// Updater applies equality check predicate on the "updater" field. It's identical to UpdaterEQ.
|
||||
func Updater(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||
func Deleted(v bool) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesEQ applies the EQ predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesEQ(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesNEQ applies the NEQ predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesNEQ(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNEQ(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesIn applies the In predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesIn(vs ...string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIn(FieldDefenseHeroes, vs...))
|
||||
}
|
||||
|
||||
// DefenseHeroesNotIn applies the NotIn predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesNotIn(vs ...string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotIn(FieldDefenseHeroes, vs...))
|
||||
}
|
||||
|
||||
// DefenseHeroesGT applies the GT predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesGT(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGT(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesGTE applies the GTE predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesGTE(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGTE(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesLT applies the LT predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesLT(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLT(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesLTE applies the LTE predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesLTE(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLTE(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesContains applies the Contains predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesContains(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldContains(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesHasPrefix applies the HasPrefix predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesHasPrefix(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldHasPrefix(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesHasSuffix applies the HasSuffix predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesHasSuffix(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldHasSuffix(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesEqualFold applies the EqualFold predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesEqualFold(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEqualFold(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// DefenseHeroesContainsFold applies the ContainsFold predicate on the "defense_heroes" field.
|
||||
func DefenseHeroesContainsFold(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldContainsFold(FieldDefenseHeroes, v))
|
||||
}
|
||||
|
||||
// CreatorEQ applies the EQ predicate on the "creator" field.
|
||||
func CreatorEQ(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorNEQ applies the NEQ predicate on the "creator" field.
|
||||
func CreatorNEQ(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorIn applies the In predicate on the "creator" field.
|
||||
func CreatorIn(vs ...string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorNotIn applies the NotIn predicate on the "creator" field.
|
||||
func CreatorNotIn(vs ...string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorGT applies the GT predicate on the "creator" field.
|
||||
func CreatorGT(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorGTE applies the GTE predicate on the "creator" field.
|
||||
func CreatorGTE(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLT applies the LT predicate on the "creator" field.
|
||||
func CreatorLT(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLTE applies the LTE predicate on the "creator" field.
|
||||
func CreatorLTE(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContains applies the Contains predicate on the "creator" field.
|
||||
func CreatorContains(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldContains(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasPrefix applies the HasPrefix predicate on the "creator" field.
|
||||
func CreatorHasPrefix(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldHasPrefix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasSuffix applies the HasSuffix predicate on the "creator" field.
|
||||
func CreatorHasSuffix(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldHasSuffix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorEqualFold applies the EqualFold predicate on the "creator" field.
|
||||
func CreatorEqualFold(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEqualFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContainsFold applies the ContainsFold predicate on the "creator" field.
|
||||
func CreatorContainsFold(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldContainsFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIsNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// UpdaterEQ applies the EQ predicate on the "updater" field.
|
||||
func UpdaterEQ(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterNEQ applies the NEQ predicate on the "updater" field.
|
||||
func UpdaterNEQ(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterIn applies the In predicate on the "updater" field.
|
||||
func UpdaterIn(vs ...string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterNotIn applies the NotIn predicate on the "updater" field.
|
||||
func UpdaterNotIn(vs ...string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterGT applies the GT predicate on the "updater" field.
|
||||
func UpdaterGT(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterGTE applies the GTE predicate on the "updater" field.
|
||||
func UpdaterGTE(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLT applies the LT predicate on the "updater" field.
|
||||
func UpdaterLT(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLTE applies the LTE predicate on the "updater" field.
|
||||
func UpdaterLTE(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContains applies the Contains predicate on the "updater" field.
|
||||
func UpdaterContains(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldContains(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasPrefix applies the HasPrefix predicate on the "updater" field.
|
||||
func UpdaterHasPrefix(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldHasPrefix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasSuffix applies the HasSuffix predicate on the "updater" field.
|
||||
func UpdaterHasSuffix(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldHasSuffix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterEqualFold applies the EqualFold predicate on the "updater" field.
|
||||
func UpdaterEqualFold(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEqualFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContainsFold applies the ContainsFold predicate on the "updater" field.
|
||||
func UpdaterContainsFold(v string) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldContainsFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v time.Time) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIsNil applies the IsNil predicate on the "update_time" field.
|
||||
func UpdateTimeIsNil() predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldIsNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// UpdateTimeNotNil applies the NotNil predicate on the "update_time" field.
|
||||
func UpdateTimeNotNil() predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNotNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||
func DeletedEQ(v bool) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||
func DeletedNEQ(v bool) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.FieldNEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.EpicGvgDefenseTeams) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.EpicGvgDefenseTeams) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.EpicGvgDefenseTeams) predicate.EpicGvgDefenseTeams {
|
||||
return predicate.EpicGvgDefenseTeams(sql.NotPredicates(p))
|
||||
}
|
||||
286
internal/ent/epicgvgdefenseteams_create.go
Normal file
286
internal/ent/epicgvgdefenseteams_create.go
Normal file
@@ -0,0 +1,286 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseteams"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseTeamsCreate is the builder for creating a EpicGvgDefenseTeams entity.
|
||||
type EpicGvgDefenseTeamsCreate struct {
|
||||
config
|
||||
mutation *EpicGvgDefenseTeamsMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetDefenseHeroes sets the "defense_heroes" field.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetDefenseHeroes(v string) *EpicGvgDefenseTeamsCreate {
|
||||
_c.mutation.SetDefenseHeroes(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetCreator(v string) *EpicGvgDefenseTeamsCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetCreateTime(v time.Time) *EpicGvgDefenseTeamsCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetNillableCreateTime(v *time.Time) *EpicGvgDefenseTeamsCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetUpdater(v string) *EpicGvgDefenseTeamsCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetUpdateTime(v time.Time) *EpicGvgDefenseTeamsCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetNillableUpdateTime(v *time.Time) *EpicGvgDefenseTeamsCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetDeleted(v bool) *EpicGvgDefenseTeamsCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SetID(v int64) *EpicGvgDefenseTeamsCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgDefenseTeamsMutation object of the builder.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) Mutation() *EpicGvgDefenseTeamsMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the EpicGvgDefenseTeams in the database.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) Save(ctx context.Context) (*EpicGvgDefenseTeams, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) SaveX(ctx context.Context) *EpicGvgDefenseTeams {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicGvgDefenseTeamsCreate) 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 (_c *EpicGvgDefenseTeamsCreate) check() error {
|
||||
if _, ok := _c.mutation.DefenseHeroes(); !ok {
|
||||
return &ValidationError{Name: "defense_heroes", err: errors.New(`ent: missing required field "EpicGvgDefenseTeams.defense_heroes"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.DefenseHeroes(); ok {
|
||||
if err := epicgvgdefenseteams.DefenseHeroesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "defense_heroes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.defense_heroes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "EpicGvgDefenseTeams.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := epicgvgdefenseteams.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "EpicGvgDefenseTeams.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := epicgvgdefenseteams.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "EpicGvgDefenseTeams.deleted"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *EpicGvgDefenseTeamsCreate) sqlSave(ctx context.Context) (*EpicGvgDefenseTeams, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *EpicGvgDefenseTeamsCreate) createSpec() (*EpicGvgDefenseTeams, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &EpicGvgDefenseTeams{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(epicgvgdefenseteams.Table, sqlgraph.NewFieldSpec(epicgvgdefenseteams.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.DefenseHeroes(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldDefenseHeroes, field.TypeString, value)
|
||||
_node.DefenseHeroes = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// EpicGvgDefenseTeamsCreateBulk is the builder for creating many EpicGvgDefenseTeams entities in bulk.
|
||||
type EpicGvgDefenseTeamsCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*EpicGvgDefenseTeamsCreate
|
||||
}
|
||||
|
||||
// Save creates the EpicGvgDefenseTeams entities in the database.
|
||||
func (_c *EpicGvgDefenseTeamsCreateBulk) Save(ctx context.Context) ([]*EpicGvgDefenseTeams, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*EpicGvgDefenseTeams, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*EpicGvgDefenseTeamsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *EpicGvgDefenseTeamsCreateBulk) SaveX(ctx context.Context) []*EpicGvgDefenseTeams {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicGvgDefenseTeamsCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicGvgDefenseTeamsCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/epicgvgdefenseteams_delete.go
Normal file
88
internal/ent/epicgvgdefenseteams_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseteams"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseTeamsDelete is the builder for deleting a EpicGvgDefenseTeams entity.
|
||||
type EpicGvgDefenseTeamsDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicGvgDefenseTeamsMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseTeamsDelete builder.
|
||||
func (_d *EpicGvgDefenseTeamsDelete) Where(ps ...predicate.EpicGvgDefenseTeams) *EpicGvgDefenseTeamsDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *EpicGvgDefenseTeamsDelete) 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 (_d *EpicGvgDefenseTeamsDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *EpicGvgDefenseTeamsDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(epicgvgdefenseteams.Table, sqlgraph.NewFieldSpec(epicgvgdefenseteams.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// EpicGvgDefenseTeamsDeleteOne is the builder for deleting a single EpicGvgDefenseTeams entity.
|
||||
type EpicGvgDefenseTeamsDeleteOne struct {
|
||||
_d *EpicGvgDefenseTeamsDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseTeamsDelete builder.
|
||||
func (_d *EpicGvgDefenseTeamsDeleteOne) Where(ps ...predicate.EpicGvgDefenseTeams) *EpicGvgDefenseTeamsDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *EpicGvgDefenseTeamsDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{epicgvgdefenseteams.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *EpicGvgDefenseTeamsDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/epicgvgdefenseteams_query.go
Normal file
527
internal/ent/epicgvgdefenseteams_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseteams"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseTeamsQuery is the builder for querying EpicGvgDefenseTeams entities.
|
||||
type EpicGvgDefenseTeamsQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []epicgvgdefenseteams.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.EpicGvgDefenseTeams
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the EpicGvgDefenseTeamsQuery builder.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Where(ps ...predicate.EpicGvgDefenseTeams) *EpicGvgDefenseTeamsQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Limit(limit int) *EpicGvgDefenseTeamsQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Offset(offset int) *EpicGvgDefenseTeamsQuery {
|
||||
_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 (_q *EpicGvgDefenseTeamsQuery) Unique(unique bool) *EpicGvgDefenseTeamsQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Order(o ...epicgvgdefenseteams.OrderOption) *EpicGvgDefenseTeamsQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first EpicGvgDefenseTeams entity from the query.
|
||||
// Returns a *NotFoundError when no EpicGvgDefenseTeams was found.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) First(ctx context.Context) (*EpicGvgDefenseTeams, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{epicgvgdefenseteams.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) FirstX(ctx context.Context) *EpicGvgDefenseTeams {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first EpicGvgDefenseTeams ID from the query.
|
||||
// Returns a *NotFoundError when no EpicGvgDefenseTeams ID was found.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{epicgvgdefenseteams.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single EpicGvgDefenseTeams entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one EpicGvgDefenseTeams entity is found.
|
||||
// Returns a *NotFoundError when no EpicGvgDefenseTeams entities are found.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Only(ctx context.Context) (*EpicGvgDefenseTeams, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{epicgvgdefenseteams.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{epicgvgdefenseteams.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) OnlyX(ctx context.Context) *EpicGvgDefenseTeams {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only EpicGvgDefenseTeams ID in the query.
|
||||
// Returns a *NotSingularError when more than one EpicGvgDefenseTeams ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{epicgvgdefenseteams.Label}
|
||||
default:
|
||||
err = &NotSingularError{epicgvgdefenseteams.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of EpicGvgDefenseTeamsSlice.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) All(ctx context.Context) ([]*EpicGvgDefenseTeams, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*EpicGvgDefenseTeams, *EpicGvgDefenseTeamsQuery]()
|
||||
return withInterceptors[[]*EpicGvgDefenseTeams](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) AllX(ctx context.Context) []*EpicGvgDefenseTeams {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of EpicGvgDefenseTeams IDs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(epicgvgdefenseteams.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) 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, _q, querierCount[*EpicGvgDefenseTeamsQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the EpicGvgDefenseTeamsQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Clone() *EpicGvgDefenseTeamsQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &EpicGvgDefenseTeamsQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]epicgvgdefenseteams.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.EpicGvgDefenseTeams{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// DefenseHeroes string `json:"defense_heroes,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicGvgDefenseTeams.Query().
|
||||
// GroupBy(epicgvgdefenseteams.FieldDefenseHeroes).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicGvgDefenseTeamsQuery) GroupBy(field string, fields ...string) *EpicGvgDefenseTeamsGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &EpicGvgDefenseTeamsGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = epicgvgdefenseteams.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// DefenseHeroes string `json:"defense_heroes,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicGvgDefenseTeams.Query().
|
||||
// Select(epicgvgdefenseteams.FieldDefenseHeroes).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Select(fields ...string) *EpicGvgDefenseTeamsSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &EpicGvgDefenseTeamsSelect{EpicGvgDefenseTeamsQuery: _q}
|
||||
sbuild.label = epicgvgdefenseteams.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a EpicGvgDefenseTeamsSelect configured with the given aggregations.
|
||||
func (_q *EpicGvgDefenseTeamsQuery) Aggregate(fns ...AggregateFunc) *EpicGvgDefenseTeamsSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseTeamsQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !epicgvgdefenseteams.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseTeamsQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EpicGvgDefenseTeams, error) {
|
||||
var (
|
||||
nodes = []*EpicGvgDefenseTeams{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*EpicGvgDefenseTeams).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &EpicGvgDefenseTeams{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseTeamsQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseTeamsQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(epicgvgdefenseteams.Table, epicgvgdefenseteams.Columns, sqlgraph.NewFieldSpec(epicgvgdefenseteams.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicgvgdefenseteams.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != epicgvgdefenseteams.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *EpicGvgDefenseTeamsQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(epicgvgdefenseteams.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = epicgvgdefenseteams.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// EpicGvgDefenseTeamsGroupBy is the group-by builder for EpicGvgDefenseTeams entities.
|
||||
type EpicGvgDefenseTeamsGroupBy struct {
|
||||
selector
|
||||
build *EpicGvgDefenseTeamsQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *EpicGvgDefenseTeamsGroupBy) Aggregate(fns ...AggregateFunc) *EpicGvgDefenseTeamsGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *EpicGvgDefenseTeamsGroupBy) 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[*EpicGvgDefenseTeamsQuery, *EpicGvgDefenseTeamsGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *EpicGvgDefenseTeamsGroupBy) sqlScan(ctx context.Context, root *EpicGvgDefenseTeamsQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// EpicGvgDefenseTeamsSelect is the builder for selecting fields of EpicGvgDefenseTeams entities.
|
||||
type EpicGvgDefenseTeamsSelect struct {
|
||||
*EpicGvgDefenseTeamsQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *EpicGvgDefenseTeamsSelect) Aggregate(fns ...AggregateFunc) *EpicGvgDefenseTeamsSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *EpicGvgDefenseTeamsSelect) 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[*EpicGvgDefenseTeamsQuery, *EpicGvgDefenseTeamsSelect](ctx, _s.EpicGvgDefenseTeamsQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *EpicGvgDefenseTeamsSelect) sqlScan(ctx context.Context, root *EpicGvgDefenseTeamsQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
462
internal/ent/epicgvgdefenseteams_update.go
Normal file
462
internal/ent/epicgvgdefenseteams_update.go
Normal file
@@ -0,0 +1,462 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicgvgdefenseteams"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicGvgDefenseTeamsUpdate is the builder for updating EpicGvgDefenseTeams entities.
|
||||
type EpicGvgDefenseTeamsUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicGvgDefenseTeamsMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseTeamsUpdate builder.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) Where(ps ...predicate.EpicGvgDefenseTeams) *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDefenseHeroes sets the "defense_heroes" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetDefenseHeroes(v string) *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.SetDefenseHeroes(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDefenseHeroes sets the "defense_heroes" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetNillableDefenseHeroes(v *string) *EpicGvgDefenseTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetDefenseHeroes(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetCreator(v string) *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetNillableCreator(v *string) *EpicGvgDefenseTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetCreateTime(v time.Time) *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetNillableCreateTime(v *time.Time) *EpicGvgDefenseTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) ClearCreateTime() *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetUpdater(v string) *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetNillableUpdater(v *string) *EpicGvgDefenseTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetUpdateTime(v time.Time) *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetNillableUpdateTime(v *time.Time) *EpicGvgDefenseTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) ClearUpdateTime() *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetDeleted(v bool) *EpicGvgDefenseTeamsUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) SetNillableDeleted(v *bool) *EpicGvgDefenseTeamsUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgDefenseTeamsMutation object of the builder.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) Mutation() *EpicGvgDefenseTeamsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) 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 (_u *EpicGvgDefenseTeamsUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) check() error {
|
||||
if v, ok := _u.mutation.DefenseHeroes(); ok {
|
||||
if err := epicgvgdefenseteams.DefenseHeroesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "defense_heroes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.defense_heroes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicgvgdefenseteams.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicgvgdefenseteams.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicGvgDefenseTeamsUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicgvgdefenseteams.Table, epicgvgdefenseteams.Columns, sqlgraph.NewFieldSpec(epicgvgdefenseteams.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.DefenseHeroes(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldDefenseHeroes, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseteams.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseteams.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicgvgdefenseteams.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// EpicGvgDefenseTeamsUpdateOne is the builder for updating a single EpicGvgDefenseTeams entity.
|
||||
type EpicGvgDefenseTeamsUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *EpicGvgDefenseTeamsMutation
|
||||
}
|
||||
|
||||
// SetDefenseHeroes sets the "defense_heroes" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetDefenseHeroes(v string) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.SetDefenseHeroes(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDefenseHeroes sets the "defense_heroes" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetNillableDefenseHeroes(v *string) *EpicGvgDefenseTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDefenseHeroes(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetCreator(v string) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetNillableCreator(v *string) *EpicGvgDefenseTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetCreateTime(v time.Time) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetNillableCreateTime(v *time.Time) *EpicGvgDefenseTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) ClearCreateTime() *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetUpdater(v string) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetNillableUpdater(v *string) *EpicGvgDefenseTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetUpdateTime(v time.Time) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetNillableUpdateTime(v *time.Time) *EpicGvgDefenseTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) ClearUpdateTime() *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetDeleted(v bool) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SetNillableDeleted(v *bool) *EpicGvgDefenseTeamsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicGvgDefenseTeamsMutation object of the builder.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) Mutation() *EpicGvgDefenseTeamsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicGvgDefenseTeamsUpdate builder.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) Where(ps ...predicate.EpicGvgDefenseTeams) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_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 (_u *EpicGvgDefenseTeamsUpdateOne) Select(field string, fields ...string) *EpicGvgDefenseTeamsUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated EpicGvgDefenseTeams entity.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) Save(ctx context.Context) (*EpicGvgDefenseTeams, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) SaveX(ctx context.Context) *EpicGvgDefenseTeams {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.DefenseHeroes(); ok {
|
||||
if err := epicgvgdefenseteams.DefenseHeroesValidator(v); err != nil {
|
||||
return &ValidationError{Name: "defense_heroes", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.defense_heroes": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicgvgdefenseteams.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicgvgdefenseteams.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicGvgDefenseTeams.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicGvgDefenseTeamsUpdateOne) sqlSave(ctx context.Context) (_node *EpicGvgDefenseTeams, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicgvgdefenseteams.Table, epicgvgdefenseteams.Columns, sqlgraph.NewFieldSpec(epicgvgdefenseteams.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EpicGvgDefenseTeams.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicgvgdefenseteams.FieldID)
|
||||
for _, f := range fields {
|
||||
if !epicgvgdefenseteams.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != epicgvgdefenseteams.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.DefenseHeroes(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldDefenseHeroes, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseteams.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicgvgdefenseteams.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicgvgdefenseteams.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
_node = &EpicGvgDefenseTeams{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicgvgdefenseteams.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
304
internal/ent/epicheroinfo.go
Normal file
304
internal/ent/epicheroinfo.go
Normal file
@@ -0,0 +1,304 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicHeroInfo is the model entity for the EpicHeroInfo schema.
|
||||
type EpicHeroInfo struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// HeroName holds the value of the "hero_name" field.
|
||||
HeroName string `json:"hero_name,omitempty"`
|
||||
// HeroCode holds the value of the "hero_code" field.
|
||||
HeroCode string `json:"hero_code,omitempty"`
|
||||
// HeroAttrLv60 holds the value of the "hero_attr_lv60" field.
|
||||
HeroAttrLv60 string `json:"hero_attr_lv60,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
// NickName holds the value of the "nick_name" field.
|
||||
NickName string `json:"nick_name,omitempty"`
|
||||
// Rarity holds the value of the "rarity" field.
|
||||
Rarity string `json:"rarity,omitempty"`
|
||||
// Role holds the value of the "role" field.
|
||||
Role string `json:"role,omitempty"`
|
||||
// Zodiac holds the value of the "zodiac" field.
|
||||
Zodiac string `json:"zodiac,omitempty"`
|
||||
// HeadImgURL holds the value of the "head_img_url" field.
|
||||
HeadImgURL string `json:"head_img_url,omitempty"`
|
||||
// Attribute holds the value of the "attribute" field.
|
||||
Attribute string `json:"attribute,omitempty"`
|
||||
// Remark holds the value of the "remark" field.
|
||||
Remark string `json:"remark,omitempty"`
|
||||
// RawJSON holds the value of the "raw_json" field.
|
||||
RawJSON string `json:"raw_json,omitempty"`
|
||||
// SetContentJSON holds the value of the "set_content_json" field.
|
||||
SetContentJSON string `json:"set_content_json,omitempty"`
|
||||
// SetUpdateTime holds the value of the "set_update_time" field.
|
||||
SetUpdateTime *time.Time `json:"set_update_time,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicHeroInfo) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicheroinfo.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case epicheroinfo.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epicheroinfo.FieldHeroName, epicheroinfo.FieldHeroCode, epicheroinfo.FieldHeroAttrLv60, epicheroinfo.FieldCreator, epicheroinfo.FieldUpdater, epicheroinfo.FieldNickName, epicheroinfo.FieldRarity, epicheroinfo.FieldRole, epicheroinfo.FieldZodiac, epicheroinfo.FieldHeadImgURL, epicheroinfo.FieldAttribute, epicheroinfo.FieldRemark, epicheroinfo.FieldRawJSON, epicheroinfo.FieldSetContentJSON:
|
||||
values[i] = new(sql.NullString)
|
||||
case epicheroinfo.FieldCreateTime, epicheroinfo.FieldUpdateTime, epicheroinfo.FieldSetUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the EpicHeroInfo fields.
|
||||
func (_m *EpicHeroInfo) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicheroinfo.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epicheroinfo.FieldHeroName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_name", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroName = value.String
|
||||
}
|
||||
case epicheroinfo.FieldHeroCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroCode = value.String
|
||||
}
|
||||
case epicheroinfo.FieldHeroAttrLv60:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_attr_lv60", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroAttrLv60 = value.String
|
||||
}
|
||||
case epicheroinfo.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epicheroinfo.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epicheroinfo.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epicheroinfo.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epicheroinfo.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
case epicheroinfo.FieldNickName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field nick_name", values[i])
|
||||
} else if value.Valid {
|
||||
_m.NickName = value.String
|
||||
}
|
||||
case epicheroinfo.FieldRarity:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field rarity", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Rarity = value.String
|
||||
}
|
||||
case epicheroinfo.FieldRole:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field role", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Role = value.String
|
||||
}
|
||||
case epicheroinfo.FieldZodiac:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field zodiac", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Zodiac = value.String
|
||||
}
|
||||
case epicheroinfo.FieldHeadImgURL:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field head_img_url", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeadImgURL = value.String
|
||||
}
|
||||
case epicheroinfo.FieldAttribute:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field attribute", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Attribute = value.String
|
||||
}
|
||||
case epicheroinfo.FieldRemark:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field remark", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Remark = value.String
|
||||
}
|
||||
case epicheroinfo.FieldRawJSON:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field raw_json", values[i])
|
||||
} else if value.Valid {
|
||||
_m.RawJSON = value.String
|
||||
}
|
||||
case epicheroinfo.FieldSetContentJSON:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field set_content_json", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SetContentJSON = value.String
|
||||
}
|
||||
case epicheroinfo.FieldSetUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field set_update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SetUpdateTime = new(time.Time)
|
||||
*_m.SetUpdateTime = value.Time
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the EpicHeroInfo.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicHeroInfo) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicHeroInfo.
|
||||
// Note that you need to call EpicHeroInfo.Unwrap() before calling this method if this EpicHeroInfo
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicHeroInfo) Update() *EpicHeroInfoUpdateOne {
|
||||
return NewEpicHeroInfoClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicHeroInfo 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 *EpicHeroInfo) Unwrap() *EpicHeroInfo {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicHeroInfo is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicHeroInfo) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicHeroInfo(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("hero_name=")
|
||||
builder.WriteString(_m.HeroName)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hero_code=")
|
||||
builder.WriteString(_m.HeroCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hero_attr_lv60=")
|
||||
builder.WriteString(_m.HeroAttrLv60)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("nick_name=")
|
||||
builder.WriteString(_m.NickName)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("rarity=")
|
||||
builder.WriteString(_m.Rarity)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("role=")
|
||||
builder.WriteString(_m.Role)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("zodiac=")
|
||||
builder.WriteString(_m.Zodiac)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("head_img_url=")
|
||||
builder.WriteString(_m.HeadImgURL)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("attribute=")
|
||||
builder.WriteString(_m.Attribute)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("remark=")
|
||||
builder.WriteString(_m.Remark)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("raw_json=")
|
||||
builder.WriteString(_m.RawJSON)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("set_content_json=")
|
||||
builder.WriteString(_m.SetContentJSON)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.SetUpdateTime; v != nil {
|
||||
builder.WriteString("set_update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicHeroInfos is a parsable slice of EpicHeroInfo.
|
||||
type EpicHeroInfos []*EpicHeroInfo
|
||||
214
internal/ent/epicheroinfo/epicheroinfo.go
Normal file
214
internal/ent/epicheroinfo/epicheroinfo.go
Normal file
@@ -0,0 +1,214 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicheroinfo
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the epicheroinfo type in the database.
|
||||
Label = "epic_hero_info"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldHeroName holds the string denoting the hero_name field in the database.
|
||||
FieldHeroName = "hero_name"
|
||||
// FieldHeroCode holds the string denoting the hero_code field in the database.
|
||||
FieldHeroCode = "hero_code"
|
||||
// FieldHeroAttrLv60 holds the string denoting the hero_attr_lv60 field in the database.
|
||||
FieldHeroAttrLv60 = "hero_attr_lv60"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// FieldNickName holds the string denoting the nick_name field in the database.
|
||||
FieldNickName = "nick_name"
|
||||
// FieldRarity holds the string denoting the rarity field in the database.
|
||||
FieldRarity = "rarity"
|
||||
// FieldRole holds the string denoting the role field in the database.
|
||||
FieldRole = "role"
|
||||
// FieldZodiac holds the string denoting the zodiac field in the database.
|
||||
FieldZodiac = "zodiac"
|
||||
// FieldHeadImgURL holds the string denoting the head_img_url field in the database.
|
||||
FieldHeadImgURL = "head_img_url"
|
||||
// FieldAttribute holds the string denoting the attribute field in the database.
|
||||
FieldAttribute = "attribute"
|
||||
// FieldRemark holds the string denoting the remark field in the database.
|
||||
FieldRemark = "remark"
|
||||
// FieldRawJSON holds the string denoting the raw_json field in the database.
|
||||
FieldRawJSON = "raw_json"
|
||||
// FieldSetContentJSON holds the string denoting the set_content_json field in the database.
|
||||
FieldSetContentJSON = "set_content_json"
|
||||
// FieldSetUpdateTime holds the string denoting the set_update_time field in the database.
|
||||
FieldSetUpdateTime = "set_update_time"
|
||||
// Table holds the table name of the epicheroinfo in the database.
|
||||
Table = "epic_hero_infos"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for epicheroinfo fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldHeroName,
|
||||
FieldHeroCode,
|
||||
FieldHeroAttrLv60,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
FieldNickName,
|
||||
FieldRarity,
|
||||
FieldRole,
|
||||
FieldZodiac,
|
||||
FieldHeadImgURL,
|
||||
FieldAttribute,
|
||||
FieldRemark,
|
||||
FieldRawJSON,
|
||||
FieldSetContentJSON,
|
||||
FieldSetUpdateTime,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// HeroNameValidator is a validator for the "hero_name" field. It is called by the builders before save.
|
||||
HeroNameValidator func(string) error
|
||||
// HeroCodeValidator is a validator for the "hero_code" field. It is called by the builders before save.
|
||||
HeroCodeValidator func(string) error
|
||||
// HeroAttrLv60Validator is a validator for the "hero_attr_lv60" field. It is called by the builders before save.
|
||||
HeroAttrLv60Validator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
// NickNameValidator is a validator for the "nick_name" field. It is called by the builders before save.
|
||||
NickNameValidator func(string) error
|
||||
// RarityValidator is a validator for the "rarity" field. It is called by the builders before save.
|
||||
RarityValidator func(string) error
|
||||
// RoleValidator is a validator for the "role" field. It is called by the builders before save.
|
||||
RoleValidator func(string) error
|
||||
// ZodiacValidator is a validator for the "zodiac" field. It is called by the builders before save.
|
||||
ZodiacValidator func(string) error
|
||||
// HeadImgURLValidator is a validator for the "head_img_url" field. It is called by the builders before save.
|
||||
HeadImgURLValidator func(string) error
|
||||
// AttributeValidator is a validator for the "attribute" field. It is called by the builders before save.
|
||||
AttributeValidator func(string) error
|
||||
// RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
|
||||
RemarkValidator func(string) error
|
||||
// RawJSONValidator is a validator for the "raw_json" field. It is called by the builders before save.
|
||||
RawJSONValidator func(string) error
|
||||
// SetContentJSONValidator is a validator for the "set_content_json" field. It is called by the builders before save.
|
||||
SetContentJSONValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the EpicHeroInfo queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroName orders the results by the hero_name field.
|
||||
func ByHeroName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroCode orders the results by the hero_code field.
|
||||
func ByHeroCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroAttrLv60 orders the results by the hero_attr_lv60 field.
|
||||
func ByHeroAttrLv60(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroAttrLv60, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByNickName orders the results by the nick_name field.
|
||||
func ByNickName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldNickName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRarity orders the results by the rarity field.
|
||||
func ByRarity(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRarity, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRole orders the results by the role field.
|
||||
func ByRole(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRole, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByZodiac orders the results by the zodiac field.
|
||||
func ByZodiac(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldZodiac, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeadImgURL orders the results by the head_img_url field.
|
||||
func ByHeadImgURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeadImgURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAttribute orders the results by the attribute field.
|
||||
func ByAttribute(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAttribute, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRemark orders the results by the remark field.
|
||||
func ByRemark(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRemark, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRawJSON orders the results by the raw_json field.
|
||||
func ByRawJSON(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRawJSON, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySetContentJSON orders the results by the set_content_json field.
|
||||
func BySetContentJSON(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSetContentJSON, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySetUpdateTime orders the results by the set_update_time field.
|
||||
func BySetUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSetUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
1230
internal/ent/epicheroinfo/where.go
Normal file
1230
internal/ent/epicheroinfo/where.go
Normal file
File diff suppressed because it is too large
Load Diff
502
internal/ent/epicheroinfo_create.go
Normal file
502
internal/ent/epicheroinfo_create.go
Normal file
@@ -0,0 +1,502 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroInfoCreate is the builder for creating a EpicHeroInfo entity.
|
||||
type EpicHeroInfoCreate struct {
|
||||
config
|
||||
mutation *EpicHeroInfoMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetHeroName sets the "hero_name" field.
|
||||
func (_c *EpicHeroInfoCreate) SetHeroName(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetHeroName(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_c *EpicHeroInfoCreate) SetHeroCode(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetHeroCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeroAttrLv60 sets the "hero_attr_lv60" field.
|
||||
func (_c *EpicHeroInfoCreate) SetHeroAttrLv60(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetHeroAttrLv60(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *EpicHeroInfoCreate) SetCreator(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *EpicHeroInfoCreate) SetCreateTime(v time.Time) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *EpicHeroInfoCreate) SetNillableCreateTime(v *time.Time) *EpicHeroInfoCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *EpicHeroInfoCreate) SetUpdater(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *EpicHeroInfoCreate) SetUpdateTime(v time.Time) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *EpicHeroInfoCreate) SetNillableUpdateTime(v *time.Time) *EpicHeroInfoCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *EpicHeroInfoCreate) SetDeleted(v bool) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNickName sets the "nick_name" field.
|
||||
func (_c *EpicHeroInfoCreate) SetNickName(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetNickName(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetRarity sets the "rarity" field.
|
||||
func (_c *EpicHeroInfoCreate) SetRarity(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetRarity(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetRole sets the "role" field.
|
||||
func (_c *EpicHeroInfoCreate) SetRole(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetRole(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetZodiac sets the "zodiac" field.
|
||||
func (_c *EpicHeroInfoCreate) SetZodiac(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetZodiac(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeadImgURL sets the "head_img_url" field.
|
||||
func (_c *EpicHeroInfoCreate) SetHeadImgURL(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetHeadImgURL(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAttribute sets the "attribute" field.
|
||||
func (_c *EpicHeroInfoCreate) SetAttribute(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetAttribute(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetRemark sets the "remark" field.
|
||||
func (_c *EpicHeroInfoCreate) SetRemark(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetRemark(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetRawJSON sets the "raw_json" field.
|
||||
func (_c *EpicHeroInfoCreate) SetRawJSON(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetRawJSON(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSetContentJSON sets the "set_content_json" field.
|
||||
func (_c *EpicHeroInfoCreate) SetSetContentJSON(v string) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetSetContentJSON(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSetUpdateTime sets the "set_update_time" field.
|
||||
func (_c *EpicHeroInfoCreate) SetSetUpdateTime(v time.Time) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetSetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableSetUpdateTime sets the "set_update_time" field if the given value is not nil.
|
||||
func (_c *EpicHeroInfoCreate) SetNillableSetUpdateTime(v *time.Time) *EpicHeroInfoCreate {
|
||||
if v != nil {
|
||||
_c.SetSetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *EpicHeroInfoCreate) SetID(v int64) *EpicHeroInfoCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the EpicHeroInfoMutation object of the builder.
|
||||
func (_c *EpicHeroInfoCreate) Mutation() *EpicHeroInfoMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the EpicHeroInfo in the database.
|
||||
func (_c *EpicHeroInfoCreate) Save(ctx context.Context) (*EpicHeroInfo, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *EpicHeroInfoCreate) SaveX(ctx context.Context) *EpicHeroInfo {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicHeroInfoCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicHeroInfoCreate) 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 (_c *EpicHeroInfoCreate) check() error {
|
||||
if _, ok := _c.mutation.HeroName(); !ok {
|
||||
return &ValidationError{Name: "hero_name", err: errors.New(`ent: missing required field "EpicHeroInfo.hero_name"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.HeroName(); ok {
|
||||
if err := epicheroinfo.HeroNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_name", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.HeroCode(); !ok {
|
||||
return &ValidationError{Name: "hero_code", err: errors.New(`ent: missing required field "EpicHeroInfo.hero_code"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.HeroCode(); ok {
|
||||
if err := epicheroinfo.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.HeroAttrLv60(); !ok {
|
||||
return &ValidationError{Name: "hero_attr_lv60", err: errors.New(`ent: missing required field "EpicHeroInfo.hero_attr_lv60"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.HeroAttrLv60(); ok {
|
||||
if err := epicheroinfo.HeroAttrLv60Validator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_attr_lv60", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_attr_lv60": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "EpicHeroInfo.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := epicheroinfo.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "EpicHeroInfo.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := epicheroinfo.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "EpicHeroInfo.deleted"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.NickName(); !ok {
|
||||
return &ValidationError{Name: "nick_name", err: errors.New(`ent: missing required field "EpicHeroInfo.nick_name"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.NickName(); ok {
|
||||
if err := epicheroinfo.NickNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.nick_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Rarity(); !ok {
|
||||
return &ValidationError{Name: "rarity", err: errors.New(`ent: missing required field "EpicHeroInfo.rarity"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Rarity(); ok {
|
||||
if err := epicheroinfo.RarityValidator(v); err != nil {
|
||||
return &ValidationError{Name: "rarity", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.rarity": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Role(); !ok {
|
||||
return &ValidationError{Name: "role", err: errors.New(`ent: missing required field "EpicHeroInfo.role"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Role(); ok {
|
||||
if err := epicheroinfo.RoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.role": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Zodiac(); !ok {
|
||||
return &ValidationError{Name: "zodiac", err: errors.New(`ent: missing required field "EpicHeroInfo.zodiac"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Zodiac(); ok {
|
||||
if err := epicheroinfo.ZodiacValidator(v); err != nil {
|
||||
return &ValidationError{Name: "zodiac", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.zodiac": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.HeadImgURL(); !ok {
|
||||
return &ValidationError{Name: "head_img_url", err: errors.New(`ent: missing required field "EpicHeroInfo.head_img_url"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.HeadImgURL(); ok {
|
||||
if err := epicheroinfo.HeadImgURLValidator(v); err != nil {
|
||||
return &ValidationError{Name: "head_img_url", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.head_img_url": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Attribute(); !ok {
|
||||
return &ValidationError{Name: "attribute", err: errors.New(`ent: missing required field "EpicHeroInfo.attribute"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Attribute(); ok {
|
||||
if err := epicheroinfo.AttributeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "attribute", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.attribute": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Remark(); !ok {
|
||||
return &ValidationError{Name: "remark", err: errors.New(`ent: missing required field "EpicHeroInfo.remark"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Remark(); ok {
|
||||
if err := epicheroinfo.RemarkValidator(v); err != nil {
|
||||
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.remark": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.RawJSON(); !ok {
|
||||
return &ValidationError{Name: "raw_json", err: errors.New(`ent: missing required field "EpicHeroInfo.raw_json"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.RawJSON(); ok {
|
||||
if err := epicheroinfo.RawJSONValidator(v); err != nil {
|
||||
return &ValidationError{Name: "raw_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.raw_json": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.SetContentJSON(); !ok {
|
||||
return &ValidationError{Name: "set_content_json", err: errors.New(`ent: missing required field "EpicHeroInfo.set_content_json"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.SetContentJSON(); ok {
|
||||
if err := epicheroinfo.SetContentJSONValidator(v); err != nil {
|
||||
return &ValidationError{Name: "set_content_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.set_content_json": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *EpicHeroInfoCreate) sqlSave(ctx context.Context) (*EpicHeroInfo, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *EpicHeroInfoCreate) createSpec() (*EpicHeroInfo, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &EpicHeroInfo{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(epicheroinfo.Table, sqlgraph.NewFieldSpec(epicheroinfo.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.HeroName(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroName, field.TypeString, value)
|
||||
_node.HeroName = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeroCode(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroCode, field.TypeString, value)
|
||||
_node.HeroCode = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeroAttrLv60(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroAttrLv60, field.TypeString, value)
|
||||
_node.HeroAttrLv60 = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
if value, ok := _c.mutation.NickName(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldNickName, field.TypeString, value)
|
||||
_node.NickName = value
|
||||
}
|
||||
if value, ok := _c.mutation.Rarity(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRarity, field.TypeString, value)
|
||||
_node.Rarity = value
|
||||
}
|
||||
if value, ok := _c.mutation.Role(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRole, field.TypeString, value)
|
||||
_node.Role = value
|
||||
}
|
||||
if value, ok := _c.mutation.Zodiac(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldZodiac, field.TypeString, value)
|
||||
_node.Zodiac = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeadImgURL(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeadImgURL, field.TypeString, value)
|
||||
_node.HeadImgURL = value
|
||||
}
|
||||
if value, ok := _c.mutation.Attribute(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldAttribute, field.TypeString, value)
|
||||
_node.Attribute = value
|
||||
}
|
||||
if value, ok := _c.mutation.Remark(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRemark, field.TypeString, value)
|
||||
_node.Remark = value
|
||||
}
|
||||
if value, ok := _c.mutation.RawJSON(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRawJSON, field.TypeString, value)
|
||||
_node.RawJSON = value
|
||||
}
|
||||
if value, ok := _c.mutation.SetContentJSON(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldSetContentJSON, field.TypeString, value)
|
||||
_node.SetContentJSON = value
|
||||
}
|
||||
if value, ok := _c.mutation.SetUpdateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value)
|
||||
_node.SetUpdateTime = &value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// EpicHeroInfoCreateBulk is the builder for creating many EpicHeroInfo entities in bulk.
|
||||
type EpicHeroInfoCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*EpicHeroInfoCreate
|
||||
}
|
||||
|
||||
// Save creates the EpicHeroInfo entities in the database.
|
||||
func (_c *EpicHeroInfoCreateBulk) Save(ctx context.Context) ([]*EpicHeroInfo, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*EpicHeroInfo, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*EpicHeroInfoMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *EpicHeroInfoCreateBulk) SaveX(ctx context.Context) []*EpicHeroInfo {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicHeroInfoCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicHeroInfoCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/epicheroinfo_delete.go
Normal file
88
internal/ent/epicheroinfo_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroInfoDelete is the builder for deleting a EpicHeroInfo entity.
|
||||
type EpicHeroInfoDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicHeroInfoMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroInfoDelete builder.
|
||||
func (_d *EpicHeroInfoDelete) Where(ps ...predicate.EpicHeroInfo) *EpicHeroInfoDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *EpicHeroInfoDelete) 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 (_d *EpicHeroInfoDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *EpicHeroInfoDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(epicheroinfo.Table, sqlgraph.NewFieldSpec(epicheroinfo.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// EpicHeroInfoDeleteOne is the builder for deleting a single EpicHeroInfo entity.
|
||||
type EpicHeroInfoDeleteOne struct {
|
||||
_d *EpicHeroInfoDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroInfoDelete builder.
|
||||
func (_d *EpicHeroInfoDeleteOne) Where(ps ...predicate.EpicHeroInfo) *EpicHeroInfoDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *EpicHeroInfoDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{epicheroinfo.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *EpicHeroInfoDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/epicheroinfo_query.go
Normal file
527
internal/ent/epicheroinfo_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroInfoQuery is the builder for querying EpicHeroInfo entities.
|
||||
type EpicHeroInfoQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []epicheroinfo.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.EpicHeroInfo
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the EpicHeroInfoQuery builder.
|
||||
func (_q *EpicHeroInfoQuery) Where(ps ...predicate.EpicHeroInfo) *EpicHeroInfoQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *EpicHeroInfoQuery) Limit(limit int) *EpicHeroInfoQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *EpicHeroInfoQuery) Offset(offset int) *EpicHeroInfoQuery {
|
||||
_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 (_q *EpicHeroInfoQuery) Unique(unique bool) *EpicHeroInfoQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *EpicHeroInfoQuery) Order(o ...epicheroinfo.OrderOption) *EpicHeroInfoQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first EpicHeroInfo entity from the query.
|
||||
// Returns a *NotFoundError when no EpicHeroInfo was found.
|
||||
func (_q *EpicHeroInfoQuery) First(ctx context.Context) (*EpicHeroInfo, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{epicheroinfo.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) FirstX(ctx context.Context) *EpicHeroInfo {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first EpicHeroInfo ID from the query.
|
||||
// Returns a *NotFoundError when no EpicHeroInfo ID was found.
|
||||
func (_q *EpicHeroInfoQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{epicheroinfo.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single EpicHeroInfo entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one EpicHeroInfo entity is found.
|
||||
// Returns a *NotFoundError when no EpicHeroInfo entities are found.
|
||||
func (_q *EpicHeroInfoQuery) Only(ctx context.Context) (*EpicHeroInfo, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{epicheroinfo.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{epicheroinfo.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) OnlyX(ctx context.Context) *EpicHeroInfo {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only EpicHeroInfo ID in the query.
|
||||
// Returns a *NotSingularError when more than one EpicHeroInfo ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *EpicHeroInfoQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{epicheroinfo.Label}
|
||||
default:
|
||||
err = &NotSingularError{epicheroinfo.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of EpicHeroInfos.
|
||||
func (_q *EpicHeroInfoQuery) All(ctx context.Context) ([]*EpicHeroInfo, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*EpicHeroInfo, *EpicHeroInfoQuery]()
|
||||
return withInterceptors[[]*EpicHeroInfo](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) AllX(ctx context.Context) []*EpicHeroInfo {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of EpicHeroInfo IDs.
|
||||
func (_q *EpicHeroInfoQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(epicheroinfo.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *EpicHeroInfoQuery) 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, _q, querierCount[*EpicHeroInfoQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *EpicHeroInfoQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *EpicHeroInfoQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the EpicHeroInfoQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *EpicHeroInfoQuery) Clone() *EpicHeroInfoQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &EpicHeroInfoQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]epicheroinfo.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.EpicHeroInfo{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// HeroName string `json:"hero_name,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicHeroInfo.Query().
|
||||
// GroupBy(epicheroinfo.FieldHeroName).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicHeroInfoQuery) GroupBy(field string, fields ...string) *EpicHeroInfoGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &EpicHeroInfoGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = epicheroinfo.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// HeroName string `json:"hero_name,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicHeroInfo.Query().
|
||||
// Select(epicheroinfo.FieldHeroName).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicHeroInfoQuery) Select(fields ...string) *EpicHeroInfoSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &EpicHeroInfoSelect{EpicHeroInfoQuery: _q}
|
||||
sbuild.label = epicheroinfo.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a EpicHeroInfoSelect configured with the given aggregations.
|
||||
func (_q *EpicHeroInfoQuery) Aggregate(fns ...AggregateFunc) *EpicHeroInfoSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *EpicHeroInfoQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !epicheroinfo.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *EpicHeroInfoQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EpicHeroInfo, error) {
|
||||
var (
|
||||
nodes = []*EpicHeroInfo{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*EpicHeroInfo).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &EpicHeroInfo{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *EpicHeroInfoQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *EpicHeroInfoQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(epicheroinfo.Table, epicheroinfo.Columns, sqlgraph.NewFieldSpec(epicheroinfo.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicheroinfo.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != epicheroinfo.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *EpicHeroInfoQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(epicheroinfo.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = epicheroinfo.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// EpicHeroInfoGroupBy is the group-by builder for EpicHeroInfo entities.
|
||||
type EpicHeroInfoGroupBy struct {
|
||||
selector
|
||||
build *EpicHeroInfoQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *EpicHeroInfoGroupBy) Aggregate(fns ...AggregateFunc) *EpicHeroInfoGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *EpicHeroInfoGroupBy) 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[*EpicHeroInfoQuery, *EpicHeroInfoGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *EpicHeroInfoGroupBy) sqlScan(ctx context.Context, root *EpicHeroInfoQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// EpicHeroInfoSelect is the builder for selecting fields of EpicHeroInfo entities.
|
||||
type EpicHeroInfoSelect struct {
|
||||
*EpicHeroInfoQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *EpicHeroInfoSelect) Aggregate(fns ...AggregateFunc) *EpicHeroInfoSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *EpicHeroInfoSelect) 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[*EpicHeroInfoQuery, *EpicHeroInfoSelect](ctx, _s.EpicHeroInfoQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *EpicHeroInfoSelect) sqlScan(ctx context.Context, root *EpicHeroInfoQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
998
internal/ent/epicheroinfo_update.go
Normal file
998
internal/ent/epicheroinfo_update.go
Normal file
@@ -0,0 +1,998 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroInfoUpdate is the builder for updating EpicHeroInfo entities.
|
||||
type EpicHeroInfoUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicHeroInfoMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroInfoUpdate builder.
|
||||
func (_u *EpicHeroInfoUpdate) Where(ps ...predicate.EpicHeroInfo) *EpicHeroInfoUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroName sets the "hero_name" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetHeroName(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetHeroName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroName sets the "hero_name" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableHeroName(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetHeroCode(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetHeroCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroCode sets the "hero_code" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableHeroCode(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroAttrLv60 sets the "hero_attr_lv60" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetHeroAttrLv60(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetHeroAttrLv60(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroAttrLv60 sets the "hero_attr_lv60" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableHeroAttrLv60(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroAttrLv60(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetCreator(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableCreator(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetCreateTime(v time.Time) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableCreateTime(v *time.Time) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicHeroInfoUpdate) ClearCreateTime() *EpicHeroInfoUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetUpdater(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableUpdater(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetUpdateTime(v time.Time) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableUpdateTime(v *time.Time) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicHeroInfoUpdate) ClearUpdateTime() *EpicHeroInfoUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetDeleted(v bool) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableDeleted(v *bool) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNickName sets the "nick_name" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetNickName(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetNickName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableNickName sets the "nick_name" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableNickName(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetNickName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRarity sets the "rarity" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetRarity(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetRarity(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRarity sets the "rarity" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableRarity(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetRarity(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRole sets the "role" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetRole(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetRole(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRole sets the "role" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableRole(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetRole(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetZodiac sets the "zodiac" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetZodiac(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetZodiac(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableZodiac sets the "zodiac" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableZodiac(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetZodiac(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeadImgURL sets the "head_img_url" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetHeadImgURL(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetHeadImgURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeadImgURL sets the "head_img_url" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableHeadImgURL(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeadImgURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAttribute sets the "attribute" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetAttribute(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetAttribute(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAttribute sets the "attribute" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableAttribute(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetAttribute(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRemark sets the "remark" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetRemark(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetRemark(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRemark sets the "remark" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableRemark(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetRemark(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRawJSON sets the "raw_json" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetRawJSON(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetRawJSON(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRawJSON sets the "raw_json" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableRawJSON(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetRawJSON(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSetContentJSON sets the "set_content_json" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetSetContentJSON(v string) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetSetContentJSON(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSetContentJSON sets the "set_content_json" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableSetContentJSON(v *string) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetSetContentJSON(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSetUpdateTime sets the "set_update_time" field.
|
||||
func (_u *EpicHeroInfoUpdate) SetSetUpdateTime(v time.Time) *EpicHeroInfoUpdate {
|
||||
_u.mutation.SetSetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSetUpdateTime sets the "set_update_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdate) SetNillableSetUpdateTime(v *time.Time) *EpicHeroInfoUpdate {
|
||||
if v != nil {
|
||||
_u.SetSetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearSetUpdateTime clears the value of the "set_update_time" field.
|
||||
func (_u *EpicHeroInfoUpdate) ClearSetUpdateTime() *EpicHeroInfoUpdate {
|
||||
_u.mutation.ClearSetUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicHeroInfoMutation object of the builder.
|
||||
func (_u *EpicHeroInfoUpdate) Mutation() *EpicHeroInfoMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *EpicHeroInfoUpdate) 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 (_u *EpicHeroInfoUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *EpicHeroInfoUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicHeroInfoUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicHeroInfoUpdate) check() error {
|
||||
if v, ok := _u.mutation.HeroName(); ok {
|
||||
if err := epicheroinfo.HeroNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_name", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroCode(); ok {
|
||||
if err := epicheroinfo.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroAttrLv60(); ok {
|
||||
if err := epicheroinfo.HeroAttrLv60Validator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_attr_lv60", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_attr_lv60": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicheroinfo.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicheroinfo.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.NickName(); ok {
|
||||
if err := epicheroinfo.NickNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.nick_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Rarity(); ok {
|
||||
if err := epicheroinfo.RarityValidator(v); err != nil {
|
||||
return &ValidationError{Name: "rarity", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.rarity": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Role(); ok {
|
||||
if err := epicheroinfo.RoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.role": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Zodiac(); ok {
|
||||
if err := epicheroinfo.ZodiacValidator(v); err != nil {
|
||||
return &ValidationError{Name: "zodiac", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.zodiac": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeadImgURL(); ok {
|
||||
if err := epicheroinfo.HeadImgURLValidator(v); err != nil {
|
||||
return &ValidationError{Name: "head_img_url", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.head_img_url": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Attribute(); ok {
|
||||
if err := epicheroinfo.AttributeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "attribute", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.attribute": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Remark(); ok {
|
||||
if err := epicheroinfo.RemarkValidator(v); err != nil {
|
||||
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.remark": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.RawJSON(); ok {
|
||||
if err := epicheroinfo.RawJSONValidator(v); err != nil {
|
||||
return &ValidationError{Name: "raw_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.raw_json": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.SetContentJSON(); ok {
|
||||
if err := epicheroinfo.SetContentJSONValidator(v); err != nil {
|
||||
return &ValidationError{Name: "set_content_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.set_content_json": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicHeroInfoUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicheroinfo.Table, epicheroinfo.Columns, sqlgraph.NewFieldSpec(epicheroinfo.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.HeroName(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroCode(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroAttrLv60(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroAttrLv60, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicheroinfo.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicheroinfo.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.NickName(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldNickName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Rarity(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRarity, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Role(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRole, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Zodiac(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldZodiac, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeadImgURL(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeadImgURL, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Attribute(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldAttribute, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Remark(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRemark, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.RawJSON(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRawJSON, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SetContentJSON(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldSetContentJSON, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SetUpdateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.SetUpdateTimeCleared() {
|
||||
_spec.ClearField(epicheroinfo.FieldSetUpdateTime, field.TypeTime)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicheroinfo.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// EpicHeroInfoUpdateOne is the builder for updating a single EpicHeroInfo entity.
|
||||
type EpicHeroInfoUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *EpicHeroInfoMutation
|
||||
}
|
||||
|
||||
// SetHeroName sets the "hero_name" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetHeroName(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetHeroName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroName sets the "hero_name" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableHeroName(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetHeroCode(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetHeroCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroCode sets the "hero_code" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableHeroCode(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroAttrLv60 sets the "hero_attr_lv60" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetHeroAttrLv60(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetHeroAttrLv60(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroAttrLv60 sets the "hero_attr_lv60" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableHeroAttrLv60(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroAttrLv60(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetCreator(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableCreator(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetCreateTime(v time.Time) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableCreateTime(v *time.Time) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) ClearCreateTime() *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetUpdater(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableUpdater(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetUpdateTime(v time.Time) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableUpdateTime(v *time.Time) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) ClearUpdateTime() *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetDeleted(v bool) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableDeleted(v *bool) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNickName sets the "nick_name" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNickName(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetNickName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableNickName sets the "nick_name" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableNickName(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetNickName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRarity sets the "rarity" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetRarity(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetRarity(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRarity sets the "rarity" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableRarity(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRarity(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRole sets the "role" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetRole(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetRole(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRole sets the "role" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableRole(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRole(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetZodiac sets the "zodiac" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetZodiac(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetZodiac(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableZodiac sets the "zodiac" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableZodiac(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetZodiac(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeadImgURL sets the "head_img_url" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetHeadImgURL(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetHeadImgURL(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeadImgURL sets the "head_img_url" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableHeadImgURL(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeadImgURL(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAttribute sets the "attribute" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetAttribute(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetAttribute(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAttribute sets the "attribute" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableAttribute(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetAttribute(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRemark sets the "remark" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetRemark(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetRemark(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRemark sets the "remark" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableRemark(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRemark(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetRawJSON sets the "raw_json" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetRawJSON(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetRawJSON(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableRawJSON sets the "raw_json" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableRawJSON(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetRawJSON(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSetContentJSON sets the "set_content_json" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetSetContentJSON(v string) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetSetContentJSON(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSetContentJSON sets the "set_content_json" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableSetContentJSON(v *string) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSetContentJSON(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSetUpdateTime sets the "set_update_time" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetSetUpdateTime(v time.Time) *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.SetSetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSetUpdateTime sets the "set_update_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroInfoUpdateOne) SetNillableSetUpdateTime(v *time.Time) *EpicHeroInfoUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearSetUpdateTime clears the value of the "set_update_time" field.
|
||||
func (_u *EpicHeroInfoUpdateOne) ClearSetUpdateTime() *EpicHeroInfoUpdateOne {
|
||||
_u.mutation.ClearSetUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicHeroInfoMutation object of the builder.
|
||||
func (_u *EpicHeroInfoUpdateOne) Mutation() *EpicHeroInfoMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroInfoUpdate builder.
|
||||
func (_u *EpicHeroInfoUpdateOne) Where(ps ...predicate.EpicHeroInfo) *EpicHeroInfoUpdateOne {
|
||||
_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 (_u *EpicHeroInfoUpdateOne) Select(field string, fields ...string) *EpicHeroInfoUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated EpicHeroInfo entity.
|
||||
func (_u *EpicHeroInfoUpdateOne) Save(ctx context.Context) (*EpicHeroInfo, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *EpicHeroInfoUpdateOne) SaveX(ctx context.Context) *EpicHeroInfo {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *EpicHeroInfoUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicHeroInfoUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicHeroInfoUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.HeroName(); ok {
|
||||
if err := epicheroinfo.HeroNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_name", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroCode(); ok {
|
||||
if err := epicheroinfo.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroAttrLv60(); ok {
|
||||
if err := epicheroinfo.HeroAttrLv60Validator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_attr_lv60", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.hero_attr_lv60": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicheroinfo.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicheroinfo.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.NickName(); ok {
|
||||
if err := epicheroinfo.NickNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.nick_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Rarity(); ok {
|
||||
if err := epicheroinfo.RarityValidator(v); err != nil {
|
||||
return &ValidationError{Name: "rarity", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.rarity": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Role(); ok {
|
||||
if err := epicheroinfo.RoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "role", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.role": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Zodiac(); ok {
|
||||
if err := epicheroinfo.ZodiacValidator(v); err != nil {
|
||||
return &ValidationError{Name: "zodiac", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.zodiac": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeadImgURL(); ok {
|
||||
if err := epicheroinfo.HeadImgURLValidator(v); err != nil {
|
||||
return &ValidationError{Name: "head_img_url", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.head_img_url": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Attribute(); ok {
|
||||
if err := epicheroinfo.AttributeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "attribute", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.attribute": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Remark(); ok {
|
||||
if err := epicheroinfo.RemarkValidator(v); err != nil {
|
||||
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.remark": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.RawJSON(); ok {
|
||||
if err := epicheroinfo.RawJSONValidator(v); err != nil {
|
||||
return &ValidationError{Name: "raw_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.raw_json": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.SetContentJSON(); ok {
|
||||
if err := epicheroinfo.SetContentJSONValidator(v); err != nil {
|
||||
return &ValidationError{Name: "set_content_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.set_content_json": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicHeroInfoUpdateOne) sqlSave(ctx context.Context) (_node *EpicHeroInfo, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicheroinfo.Table, epicheroinfo.Columns, sqlgraph.NewFieldSpec(epicheroinfo.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EpicHeroInfo.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicheroinfo.FieldID)
|
||||
for _, f := range fields {
|
||||
if !epicheroinfo.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != epicheroinfo.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.HeroName(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroCode(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroAttrLv60(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeroAttrLv60, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicheroinfo.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicheroinfo.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.NickName(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldNickName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Rarity(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRarity, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Role(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRole, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Zodiac(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldZodiac, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeadImgURL(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldHeadImgURL, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Attribute(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldAttribute, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Remark(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRemark, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.RawJSON(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldRawJSON, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SetContentJSON(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldSetContentJSON, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SetUpdateTime(); ok {
|
||||
_spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.SetUpdateTimeCleared() {
|
||||
_spec.ClearField(epicheroinfo.FieldSetUpdateTime, field.TypeTime)
|
||||
}
|
||||
_node = &EpicHeroInfo{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicheroinfo.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
215
internal/ent/epicherouserbuild.go
Normal file
215
internal/ent/epicherouserbuild.go
Normal file
@@ -0,0 +1,215 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epicherouserbuild"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicHeroUserBuild is the model entity for the EpicHeroUserBuild schema.
|
||||
type EpicHeroUserBuild struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// ArtifactCode holds the value of the "artifact_code" field.
|
||||
ArtifactCode string `json:"artifact_code,omitempty"`
|
||||
// HeroCode holds the value of the "hero_code" field.
|
||||
HeroCode string `json:"hero_code,omitempty"`
|
||||
// HeroHeathBuild holds the value of the "hero_heath_build" field.
|
||||
HeroHeathBuild float64 `json:"hero_heath_build,omitempty"`
|
||||
// HeroAttackBuild holds the value of the "hero_attack_build" field.
|
||||
HeroAttackBuild float64 `json:"hero_attack_build,omitempty"`
|
||||
// HeroDefBuild holds the value of the "hero_def_build" field.
|
||||
HeroDefBuild float64 `json:"hero_def_build,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicHeroUserBuild) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicherouserbuild.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case epicherouserbuild.FieldHeroHeathBuild, epicherouserbuild.FieldHeroAttackBuild, epicherouserbuild.FieldHeroDefBuild:
|
||||
values[i] = new(sql.NullFloat64)
|
||||
case epicherouserbuild.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epicherouserbuild.FieldArtifactCode, epicherouserbuild.FieldHeroCode, epicherouserbuild.FieldCreator, epicherouserbuild.FieldUpdater:
|
||||
values[i] = new(sql.NullString)
|
||||
case epicherouserbuild.FieldCreateTime, epicherouserbuild.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the EpicHeroUserBuild fields.
|
||||
func (_m *EpicHeroUserBuild) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicherouserbuild.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epicherouserbuild.FieldArtifactCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifact_code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ArtifactCode = value.String
|
||||
}
|
||||
case epicherouserbuild.FieldHeroCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroCode = value.String
|
||||
}
|
||||
case epicherouserbuild.FieldHeroHeathBuild:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_heath_build", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroHeathBuild = value.Float64
|
||||
}
|
||||
case epicherouserbuild.FieldHeroAttackBuild:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_attack_build", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroAttackBuild = value.Float64
|
||||
}
|
||||
case epicherouserbuild.FieldHeroDefBuild:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_def_build", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroDefBuild = value.Float64
|
||||
}
|
||||
case epicherouserbuild.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epicherouserbuild.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epicherouserbuild.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epicherouserbuild.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epicherouserbuild.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the EpicHeroUserBuild.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicHeroUserBuild) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicHeroUserBuild.
|
||||
// Note that you need to call EpicHeroUserBuild.Unwrap() before calling this method if this EpicHeroUserBuild
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicHeroUserBuild) Update() *EpicHeroUserBuildUpdateOne {
|
||||
return NewEpicHeroUserBuildClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicHeroUserBuild 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 *EpicHeroUserBuild) Unwrap() *EpicHeroUserBuild {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicHeroUserBuild is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicHeroUserBuild) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicHeroUserBuild(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("artifact_code=")
|
||||
builder.WriteString(_m.ArtifactCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hero_code=")
|
||||
builder.WriteString(_m.HeroCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hero_heath_build=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.HeroHeathBuild))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hero_attack_build=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.HeroAttackBuild))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hero_def_build=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.HeroDefBuild))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicHeroUserBuilds is a parsable slice of EpicHeroUserBuild.
|
||||
type EpicHeroUserBuilds []*EpicHeroUserBuild
|
||||
130
internal/ent/epicherouserbuild/epicherouserbuild.go
Normal file
130
internal/ent/epicherouserbuild/epicherouserbuild.go
Normal file
@@ -0,0 +1,130 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicherouserbuild
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the epicherouserbuild type in the database.
|
||||
Label = "epic_hero_user_build"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldArtifactCode holds the string denoting the artifact_code field in the database.
|
||||
FieldArtifactCode = "artifact_code"
|
||||
// FieldHeroCode holds the string denoting the hero_code field in the database.
|
||||
FieldHeroCode = "hero_code"
|
||||
// FieldHeroHeathBuild holds the string denoting the hero_heath_build field in the database.
|
||||
FieldHeroHeathBuild = "hero_heath_build"
|
||||
// FieldHeroAttackBuild holds the string denoting the hero_attack_build field in the database.
|
||||
FieldHeroAttackBuild = "hero_attack_build"
|
||||
// FieldHeroDefBuild holds the string denoting the hero_def_build field in the database.
|
||||
FieldHeroDefBuild = "hero_def_build"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// Table holds the table name of the epicherouserbuild in the database.
|
||||
Table = "epic_hero_user_builds"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for epicherouserbuild fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldArtifactCode,
|
||||
FieldHeroCode,
|
||||
FieldHeroHeathBuild,
|
||||
FieldHeroAttackBuild,
|
||||
FieldHeroDefBuild,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// ArtifactCodeValidator is a validator for the "artifact_code" field. It is called by the builders before save.
|
||||
ArtifactCodeValidator func(string) error
|
||||
// HeroCodeValidator is a validator for the "hero_code" field. It is called by the builders before save.
|
||||
HeroCodeValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the EpicHeroUserBuild queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByArtifactCode orders the results by the artifact_code field.
|
||||
func ByArtifactCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldArtifactCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroCode orders the results by the hero_code field.
|
||||
func ByHeroCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroHeathBuild orders the results by the hero_heath_build field.
|
||||
func ByHeroHeathBuild(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroHeathBuild, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroAttackBuild orders the results by the hero_attack_build field.
|
||||
func ByHeroAttackBuild(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroAttackBuild, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroDefBuild orders the results by the hero_def_build field.
|
||||
func ByHeroDefBuild(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroDefBuild, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
610
internal/ent/epicherouserbuild/where.go
Normal file
610
internal/ent/epicherouserbuild/where.go
Normal file
@@ -0,0 +1,610 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epicherouserbuild
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// ArtifactCode applies equality check predicate on the "artifact_code" field. It's identical to ArtifactCodeEQ.
|
||||
func ArtifactCode(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// HeroCode applies equality check predicate on the "hero_code" field. It's identical to HeroCodeEQ.
|
||||
func HeroCode(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroHeathBuild applies equality check predicate on the "hero_heath_build" field. It's identical to HeroHeathBuildEQ.
|
||||
func HeroHeathBuild(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroHeathBuild, v))
|
||||
}
|
||||
|
||||
// HeroAttackBuild applies equality check predicate on the "hero_attack_build" field. It's identical to HeroAttackBuildEQ.
|
||||
func HeroAttackBuild(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroAttackBuild, v))
|
||||
}
|
||||
|
||||
// HeroDefBuild applies equality check predicate on the "hero_def_build" field. It's identical to HeroDefBuildEQ.
|
||||
func HeroDefBuild(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroDefBuild, v))
|
||||
}
|
||||
|
||||
// Creator applies equality check predicate on the "creator" field. It's identical to CreatorEQ.
|
||||
func Creator(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// Updater applies equality check predicate on the "updater" field. It's identical to UpdaterEQ.
|
||||
func Updater(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||
func Deleted(v bool) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeEQ applies the EQ predicate on the "artifact_code" field.
|
||||
func ArtifactCodeEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeNEQ applies the NEQ predicate on the "artifact_code" field.
|
||||
func ArtifactCodeNEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeIn applies the In predicate on the "artifact_code" field.
|
||||
func ArtifactCodeIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldArtifactCode, vs...))
|
||||
}
|
||||
|
||||
// ArtifactCodeNotIn applies the NotIn predicate on the "artifact_code" field.
|
||||
func ArtifactCodeNotIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldArtifactCode, vs...))
|
||||
}
|
||||
|
||||
// ArtifactCodeGT applies the GT predicate on the "artifact_code" field.
|
||||
func ArtifactCodeGT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeGTE applies the GTE predicate on the "artifact_code" field.
|
||||
func ArtifactCodeGTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeLT applies the LT predicate on the "artifact_code" field.
|
||||
func ArtifactCodeLT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeLTE applies the LTE predicate on the "artifact_code" field.
|
||||
func ArtifactCodeLTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeContains applies the Contains predicate on the "artifact_code" field.
|
||||
func ArtifactCodeContains(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContains(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeHasPrefix applies the HasPrefix predicate on the "artifact_code" field.
|
||||
func ArtifactCodeHasPrefix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasPrefix(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeHasSuffix applies the HasSuffix predicate on the "artifact_code" field.
|
||||
func ArtifactCodeHasSuffix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasSuffix(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeEqualFold applies the EqualFold predicate on the "artifact_code" field.
|
||||
func ArtifactCodeEqualFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEqualFold(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// ArtifactCodeContainsFold applies the ContainsFold predicate on the "artifact_code" field.
|
||||
func ArtifactCodeContainsFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContainsFold(FieldArtifactCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeEQ applies the EQ predicate on the "hero_code" field.
|
||||
func HeroCodeEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeNEQ applies the NEQ predicate on the "hero_code" field.
|
||||
func HeroCodeNEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeIn applies the In predicate on the "hero_code" field.
|
||||
func HeroCodeIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldHeroCode, vs...))
|
||||
}
|
||||
|
||||
// HeroCodeNotIn applies the NotIn predicate on the "hero_code" field.
|
||||
func HeroCodeNotIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldHeroCode, vs...))
|
||||
}
|
||||
|
||||
// HeroCodeGT applies the GT predicate on the "hero_code" field.
|
||||
func HeroCodeGT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeGTE applies the GTE predicate on the "hero_code" field.
|
||||
func HeroCodeGTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeLT applies the LT predicate on the "hero_code" field.
|
||||
func HeroCodeLT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeLTE applies the LTE predicate on the "hero_code" field.
|
||||
func HeroCodeLTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeContains applies the Contains predicate on the "hero_code" field.
|
||||
func HeroCodeContains(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContains(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeHasPrefix applies the HasPrefix predicate on the "hero_code" field.
|
||||
func HeroCodeHasPrefix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasPrefix(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeHasSuffix applies the HasSuffix predicate on the "hero_code" field.
|
||||
func HeroCodeHasSuffix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasSuffix(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeEqualFold applies the EqualFold predicate on the "hero_code" field.
|
||||
func HeroCodeEqualFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEqualFold(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeContainsFold applies the ContainsFold predicate on the "hero_code" field.
|
||||
func HeroCodeContainsFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContainsFold(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroHeathBuildEQ applies the EQ predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildEQ(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroHeathBuild, v))
|
||||
}
|
||||
|
||||
// HeroHeathBuildNEQ applies the NEQ predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildNEQ(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldHeroHeathBuild, v))
|
||||
}
|
||||
|
||||
// HeroHeathBuildIn applies the In predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildIn(vs ...float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldHeroHeathBuild, vs...))
|
||||
}
|
||||
|
||||
// HeroHeathBuildNotIn applies the NotIn predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildNotIn(vs ...float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldHeroHeathBuild, vs...))
|
||||
}
|
||||
|
||||
// HeroHeathBuildGT applies the GT predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildGT(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldHeroHeathBuild, v))
|
||||
}
|
||||
|
||||
// HeroHeathBuildGTE applies the GTE predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildGTE(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldHeroHeathBuild, v))
|
||||
}
|
||||
|
||||
// HeroHeathBuildLT applies the LT predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildLT(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldHeroHeathBuild, v))
|
||||
}
|
||||
|
||||
// HeroHeathBuildLTE applies the LTE predicate on the "hero_heath_build" field.
|
||||
func HeroHeathBuildLTE(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldHeroHeathBuild, v))
|
||||
}
|
||||
|
||||
// HeroAttackBuildEQ applies the EQ predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildEQ(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroAttackBuild, v))
|
||||
}
|
||||
|
||||
// HeroAttackBuildNEQ applies the NEQ predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildNEQ(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldHeroAttackBuild, v))
|
||||
}
|
||||
|
||||
// HeroAttackBuildIn applies the In predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildIn(vs ...float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldHeroAttackBuild, vs...))
|
||||
}
|
||||
|
||||
// HeroAttackBuildNotIn applies the NotIn predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildNotIn(vs ...float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldHeroAttackBuild, vs...))
|
||||
}
|
||||
|
||||
// HeroAttackBuildGT applies the GT predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildGT(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldHeroAttackBuild, v))
|
||||
}
|
||||
|
||||
// HeroAttackBuildGTE applies the GTE predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildGTE(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldHeroAttackBuild, v))
|
||||
}
|
||||
|
||||
// HeroAttackBuildLT applies the LT predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildLT(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldHeroAttackBuild, v))
|
||||
}
|
||||
|
||||
// HeroAttackBuildLTE applies the LTE predicate on the "hero_attack_build" field.
|
||||
func HeroAttackBuildLTE(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldHeroAttackBuild, v))
|
||||
}
|
||||
|
||||
// HeroDefBuildEQ applies the EQ predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildEQ(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldHeroDefBuild, v))
|
||||
}
|
||||
|
||||
// HeroDefBuildNEQ applies the NEQ predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildNEQ(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldHeroDefBuild, v))
|
||||
}
|
||||
|
||||
// HeroDefBuildIn applies the In predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildIn(vs ...float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldHeroDefBuild, vs...))
|
||||
}
|
||||
|
||||
// HeroDefBuildNotIn applies the NotIn predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildNotIn(vs ...float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldHeroDefBuild, vs...))
|
||||
}
|
||||
|
||||
// HeroDefBuildGT applies the GT predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildGT(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldHeroDefBuild, v))
|
||||
}
|
||||
|
||||
// HeroDefBuildGTE applies the GTE predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildGTE(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldHeroDefBuild, v))
|
||||
}
|
||||
|
||||
// HeroDefBuildLT applies the LT predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildLT(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldHeroDefBuild, v))
|
||||
}
|
||||
|
||||
// HeroDefBuildLTE applies the LTE predicate on the "hero_def_build" field.
|
||||
func HeroDefBuildLTE(v float64) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldHeroDefBuild, v))
|
||||
}
|
||||
|
||||
// CreatorEQ applies the EQ predicate on the "creator" field.
|
||||
func CreatorEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorNEQ applies the NEQ predicate on the "creator" field.
|
||||
func CreatorNEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorIn applies the In predicate on the "creator" field.
|
||||
func CreatorIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorNotIn applies the NotIn predicate on the "creator" field.
|
||||
func CreatorNotIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorGT applies the GT predicate on the "creator" field.
|
||||
func CreatorGT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorGTE applies the GTE predicate on the "creator" field.
|
||||
func CreatorGTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLT applies the LT predicate on the "creator" field.
|
||||
func CreatorLT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLTE applies the LTE predicate on the "creator" field.
|
||||
func CreatorLTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContains applies the Contains predicate on the "creator" field.
|
||||
func CreatorContains(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContains(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasPrefix applies the HasPrefix predicate on the "creator" field.
|
||||
func CreatorHasPrefix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasPrefix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasSuffix applies the HasSuffix predicate on the "creator" field.
|
||||
func CreatorHasSuffix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasSuffix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorEqualFold applies the EqualFold predicate on the "creator" field.
|
||||
func CreatorEqualFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEqualFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContainsFold applies the ContainsFold predicate on the "creator" field.
|
||||
func CreatorContainsFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContainsFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIsNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// UpdaterEQ applies the EQ predicate on the "updater" field.
|
||||
func UpdaterEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterNEQ applies the NEQ predicate on the "updater" field.
|
||||
func UpdaterNEQ(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterIn applies the In predicate on the "updater" field.
|
||||
func UpdaterIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterNotIn applies the NotIn predicate on the "updater" field.
|
||||
func UpdaterNotIn(vs ...string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterGT applies the GT predicate on the "updater" field.
|
||||
func UpdaterGT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterGTE applies the GTE predicate on the "updater" field.
|
||||
func UpdaterGTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLT applies the LT predicate on the "updater" field.
|
||||
func UpdaterLT(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLTE applies the LTE predicate on the "updater" field.
|
||||
func UpdaterLTE(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContains applies the Contains predicate on the "updater" field.
|
||||
func UpdaterContains(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContains(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasPrefix applies the HasPrefix predicate on the "updater" field.
|
||||
func UpdaterHasPrefix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasPrefix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasSuffix applies the HasSuffix predicate on the "updater" field.
|
||||
func UpdaterHasSuffix(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldHasSuffix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterEqualFold applies the EqualFold predicate on the "updater" field.
|
||||
func UpdaterEqualFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEqualFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContainsFold applies the ContainsFold predicate on the "updater" field.
|
||||
func UpdaterContainsFold(v string) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldContainsFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v time.Time) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIsNil applies the IsNil predicate on the "update_time" field.
|
||||
func UpdateTimeIsNil() predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldIsNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// UpdateTimeNotNil applies the NotNil predicate on the "update_time" field.
|
||||
func UpdateTimeNotNil() predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNotNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||
func DeletedEQ(v bool) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||
func DeletedNEQ(v bool) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.FieldNEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.EpicHeroUserBuild) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.EpicHeroUserBuild) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.EpicHeroUserBuild) predicate.EpicHeroUserBuild {
|
||||
return predicate.EpicHeroUserBuild(sql.NotPredicates(p))
|
||||
}
|
||||
343
internal/ent/epicherouserbuild_create.go
Normal file
343
internal/ent/epicherouserbuild_create.go
Normal file
@@ -0,0 +1,343 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicherouserbuild"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroUserBuildCreate is the builder for creating a EpicHeroUserBuild entity.
|
||||
type EpicHeroUserBuildCreate struct {
|
||||
config
|
||||
mutation *EpicHeroUserBuildMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetArtifactCode sets the "artifact_code" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetArtifactCode(v string) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetArtifactCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetHeroCode(v string) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetHeroCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeroHeathBuild sets the "hero_heath_build" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetHeroHeathBuild(v float64) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetHeroHeathBuild(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeroAttackBuild sets the "hero_attack_build" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetHeroAttackBuild(v float64) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetHeroAttackBuild(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeroDefBuild sets the "hero_def_build" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetHeroDefBuild(v float64) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetHeroDefBuild(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetCreator(v string) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetCreateTime(v time.Time) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *EpicHeroUserBuildCreate) SetNillableCreateTime(v *time.Time) *EpicHeroUserBuildCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetUpdater(v string) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetUpdateTime(v time.Time) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *EpicHeroUserBuildCreate) SetNillableUpdateTime(v *time.Time) *EpicHeroUserBuildCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetDeleted(v bool) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *EpicHeroUserBuildCreate) SetID(v int64) *EpicHeroUserBuildCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the EpicHeroUserBuildMutation object of the builder.
|
||||
func (_c *EpicHeroUserBuildCreate) Mutation() *EpicHeroUserBuildMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the EpicHeroUserBuild in the database.
|
||||
func (_c *EpicHeroUserBuildCreate) Save(ctx context.Context) (*EpicHeroUserBuild, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *EpicHeroUserBuildCreate) SaveX(ctx context.Context) *EpicHeroUserBuild {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicHeroUserBuildCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicHeroUserBuildCreate) 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 (_c *EpicHeroUserBuildCreate) check() error {
|
||||
if _, ok := _c.mutation.ArtifactCode(); !ok {
|
||||
return &ValidationError{Name: "artifact_code", err: errors.New(`ent: missing required field "EpicHeroUserBuild.artifact_code"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.ArtifactCode(); ok {
|
||||
if err := epicherouserbuild.ArtifactCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.artifact_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.HeroCode(); !ok {
|
||||
return &ValidationError{Name: "hero_code", err: errors.New(`ent: missing required field "EpicHeroUserBuild.hero_code"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.HeroCode(); ok {
|
||||
if err := epicherouserbuild.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.HeroHeathBuild(); !ok {
|
||||
return &ValidationError{Name: "hero_heath_build", err: errors.New(`ent: missing required field "EpicHeroUserBuild.hero_heath_build"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.HeroAttackBuild(); !ok {
|
||||
return &ValidationError{Name: "hero_attack_build", err: errors.New(`ent: missing required field "EpicHeroUserBuild.hero_attack_build"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.HeroDefBuild(); !ok {
|
||||
return &ValidationError{Name: "hero_def_build", err: errors.New(`ent: missing required field "EpicHeroUserBuild.hero_def_build"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "EpicHeroUserBuild.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := epicherouserbuild.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "EpicHeroUserBuild.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := epicherouserbuild.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "EpicHeroUserBuild.deleted"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *EpicHeroUserBuildCreate) sqlSave(ctx context.Context) (*EpicHeroUserBuild, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *EpicHeroUserBuildCreate) createSpec() (*EpicHeroUserBuild, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &EpicHeroUserBuild{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(epicherouserbuild.Table, sqlgraph.NewFieldSpec(epicherouserbuild.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.ArtifactCode(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldArtifactCode, field.TypeString, value)
|
||||
_node.ArtifactCode = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeroCode(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroCode, field.TypeString, value)
|
||||
_node.HeroCode = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeroHeathBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroHeathBuild, field.TypeFloat64, value)
|
||||
_node.HeroHeathBuild = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeroAttackBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroAttackBuild, field.TypeFloat64, value)
|
||||
_node.HeroAttackBuild = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeroDefBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroDefBuild, field.TypeFloat64, value)
|
||||
_node.HeroDefBuild = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// EpicHeroUserBuildCreateBulk is the builder for creating many EpicHeroUserBuild entities in bulk.
|
||||
type EpicHeroUserBuildCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*EpicHeroUserBuildCreate
|
||||
}
|
||||
|
||||
// Save creates the EpicHeroUserBuild entities in the database.
|
||||
func (_c *EpicHeroUserBuildCreateBulk) Save(ctx context.Context) ([]*EpicHeroUserBuild, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*EpicHeroUserBuild, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*EpicHeroUserBuildMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *EpicHeroUserBuildCreateBulk) SaveX(ctx context.Context) []*EpicHeroUserBuild {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicHeroUserBuildCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicHeroUserBuildCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/epicherouserbuild_delete.go
Normal file
88
internal/ent/epicherouserbuild_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicherouserbuild"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroUserBuildDelete is the builder for deleting a EpicHeroUserBuild entity.
|
||||
type EpicHeroUserBuildDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicHeroUserBuildMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroUserBuildDelete builder.
|
||||
func (_d *EpicHeroUserBuildDelete) Where(ps ...predicate.EpicHeroUserBuild) *EpicHeroUserBuildDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *EpicHeroUserBuildDelete) 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 (_d *EpicHeroUserBuildDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *EpicHeroUserBuildDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(epicherouserbuild.Table, sqlgraph.NewFieldSpec(epicherouserbuild.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// EpicHeroUserBuildDeleteOne is the builder for deleting a single EpicHeroUserBuild entity.
|
||||
type EpicHeroUserBuildDeleteOne struct {
|
||||
_d *EpicHeroUserBuildDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroUserBuildDelete builder.
|
||||
func (_d *EpicHeroUserBuildDeleteOne) Where(ps ...predicate.EpicHeroUserBuild) *EpicHeroUserBuildDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *EpicHeroUserBuildDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{epicherouserbuild.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *EpicHeroUserBuildDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/epicherouserbuild_query.go
Normal file
527
internal/ent/epicherouserbuild_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicherouserbuild"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroUserBuildQuery is the builder for querying EpicHeroUserBuild entities.
|
||||
type EpicHeroUserBuildQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []epicherouserbuild.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.EpicHeroUserBuild
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the EpicHeroUserBuildQuery builder.
|
||||
func (_q *EpicHeroUserBuildQuery) Where(ps ...predicate.EpicHeroUserBuild) *EpicHeroUserBuildQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *EpicHeroUserBuildQuery) Limit(limit int) *EpicHeroUserBuildQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *EpicHeroUserBuildQuery) Offset(offset int) *EpicHeroUserBuildQuery {
|
||||
_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 (_q *EpicHeroUserBuildQuery) Unique(unique bool) *EpicHeroUserBuildQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *EpicHeroUserBuildQuery) Order(o ...epicherouserbuild.OrderOption) *EpicHeroUserBuildQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first EpicHeroUserBuild entity from the query.
|
||||
// Returns a *NotFoundError when no EpicHeroUserBuild was found.
|
||||
func (_q *EpicHeroUserBuildQuery) First(ctx context.Context) (*EpicHeroUserBuild, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{epicherouserbuild.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) FirstX(ctx context.Context) *EpicHeroUserBuild {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first EpicHeroUserBuild ID from the query.
|
||||
// Returns a *NotFoundError when no EpicHeroUserBuild ID was found.
|
||||
func (_q *EpicHeroUserBuildQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{epicherouserbuild.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single EpicHeroUserBuild entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one EpicHeroUserBuild entity is found.
|
||||
// Returns a *NotFoundError when no EpicHeroUserBuild entities are found.
|
||||
func (_q *EpicHeroUserBuildQuery) Only(ctx context.Context) (*EpicHeroUserBuild, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{epicherouserbuild.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{epicherouserbuild.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) OnlyX(ctx context.Context) *EpicHeroUserBuild {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only EpicHeroUserBuild ID in the query.
|
||||
// Returns a *NotSingularError when more than one EpicHeroUserBuild ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *EpicHeroUserBuildQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{epicherouserbuild.Label}
|
||||
default:
|
||||
err = &NotSingularError{epicherouserbuild.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of EpicHeroUserBuilds.
|
||||
func (_q *EpicHeroUserBuildQuery) All(ctx context.Context) ([]*EpicHeroUserBuild, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*EpicHeroUserBuild, *EpicHeroUserBuildQuery]()
|
||||
return withInterceptors[[]*EpicHeroUserBuild](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) AllX(ctx context.Context) []*EpicHeroUserBuild {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of EpicHeroUserBuild IDs.
|
||||
func (_q *EpicHeroUserBuildQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(epicherouserbuild.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *EpicHeroUserBuildQuery) 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, _q, querierCount[*EpicHeroUserBuildQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *EpicHeroUserBuildQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *EpicHeroUserBuildQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the EpicHeroUserBuildQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *EpicHeroUserBuildQuery) Clone() *EpicHeroUserBuildQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &EpicHeroUserBuildQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]epicherouserbuild.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.EpicHeroUserBuild{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// ArtifactCode string `json:"artifact_code,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicHeroUserBuild.Query().
|
||||
// GroupBy(epicherouserbuild.FieldArtifactCode).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicHeroUserBuildQuery) GroupBy(field string, fields ...string) *EpicHeroUserBuildGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &EpicHeroUserBuildGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = epicherouserbuild.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// ArtifactCode string `json:"artifact_code,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicHeroUserBuild.Query().
|
||||
// Select(epicherouserbuild.FieldArtifactCode).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicHeroUserBuildQuery) Select(fields ...string) *EpicHeroUserBuildSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &EpicHeroUserBuildSelect{EpicHeroUserBuildQuery: _q}
|
||||
sbuild.label = epicherouserbuild.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a EpicHeroUserBuildSelect configured with the given aggregations.
|
||||
func (_q *EpicHeroUserBuildQuery) Aggregate(fns ...AggregateFunc) *EpicHeroUserBuildSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *EpicHeroUserBuildQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !epicherouserbuild.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *EpicHeroUserBuildQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EpicHeroUserBuild, error) {
|
||||
var (
|
||||
nodes = []*EpicHeroUserBuild{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*EpicHeroUserBuild).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &EpicHeroUserBuild{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *EpicHeroUserBuildQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *EpicHeroUserBuildQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(epicherouserbuild.Table, epicherouserbuild.Columns, sqlgraph.NewFieldSpec(epicherouserbuild.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicherouserbuild.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != epicherouserbuild.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *EpicHeroUserBuildQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(epicherouserbuild.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = epicherouserbuild.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// EpicHeroUserBuildGroupBy is the group-by builder for EpicHeroUserBuild entities.
|
||||
type EpicHeroUserBuildGroupBy struct {
|
||||
selector
|
||||
build *EpicHeroUserBuildQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *EpicHeroUserBuildGroupBy) Aggregate(fns ...AggregateFunc) *EpicHeroUserBuildGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *EpicHeroUserBuildGroupBy) 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[*EpicHeroUserBuildQuery, *EpicHeroUserBuildGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *EpicHeroUserBuildGroupBy) sqlScan(ctx context.Context, root *EpicHeroUserBuildQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// EpicHeroUserBuildSelect is the builder for selecting fields of EpicHeroUserBuild entities.
|
||||
type EpicHeroUserBuildSelect struct {
|
||||
*EpicHeroUserBuildQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *EpicHeroUserBuildSelect) Aggregate(fns ...AggregateFunc) *EpicHeroUserBuildSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *EpicHeroUserBuildSelect) 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[*EpicHeroUserBuildQuery, *EpicHeroUserBuildSelect](ctx, _s.EpicHeroUserBuildQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *EpicHeroUserBuildSelect) sqlScan(ctx context.Context, root *EpicHeroUserBuildQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
668
internal/ent/epicherouserbuild_update.go
Normal file
668
internal/ent/epicherouserbuild_update.go
Normal file
@@ -0,0 +1,668 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epicherouserbuild"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicHeroUserBuildUpdate is the builder for updating EpicHeroUserBuild entities.
|
||||
type EpicHeroUserBuildUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicHeroUserBuildMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroUserBuildUpdate builder.
|
||||
func (_u *EpicHeroUserBuildUpdate) Where(ps ...predicate.EpicHeroUserBuild) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArtifactCode sets the "artifact_code" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetArtifactCode(v string) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.SetArtifactCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactCode sets the "artifact_code" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableArtifactCode(v *string) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetArtifactCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetHeroCode(v string) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.SetHeroCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroCode sets the "hero_code" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableHeroCode(v *string) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroHeathBuild sets the "hero_heath_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetHeroHeathBuild(v float64) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.ResetHeroHeathBuild()
|
||||
_u.mutation.SetHeroHeathBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroHeathBuild sets the "hero_heath_build" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableHeroHeathBuild(v *float64) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroHeathBuild(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHeroHeathBuild adds value to the "hero_heath_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) AddHeroHeathBuild(v float64) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.AddHeroHeathBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroAttackBuild sets the "hero_attack_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetHeroAttackBuild(v float64) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.ResetHeroAttackBuild()
|
||||
_u.mutation.SetHeroAttackBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroAttackBuild sets the "hero_attack_build" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableHeroAttackBuild(v *float64) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroAttackBuild(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHeroAttackBuild adds value to the "hero_attack_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) AddHeroAttackBuild(v float64) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.AddHeroAttackBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroDefBuild sets the "hero_def_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetHeroDefBuild(v float64) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.ResetHeroDefBuild()
|
||||
_u.mutation.SetHeroDefBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroDefBuild sets the "hero_def_build" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableHeroDefBuild(v *float64) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroDefBuild(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHeroDefBuild adds value to the "hero_def_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) AddHeroDefBuild(v float64) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.AddHeroDefBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetCreator(v string) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableCreator(v *string) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetCreateTime(v time.Time) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableCreateTime(v *time.Time) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) ClearCreateTime() *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetUpdater(v string) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableUpdater(v *string) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetUpdateTime(v time.Time) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableUpdateTime(v *time.Time) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) ClearUpdateTime() *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetDeleted(v bool) *EpicHeroUserBuildUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdate) SetNillableDeleted(v *bool) *EpicHeroUserBuildUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicHeroUserBuildMutation object of the builder.
|
||||
func (_u *EpicHeroUserBuildUpdate) Mutation() *EpicHeroUserBuildMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *EpicHeroUserBuildUpdate) 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 (_u *EpicHeroUserBuildUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *EpicHeroUserBuildUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicHeroUserBuildUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicHeroUserBuildUpdate) check() error {
|
||||
if v, ok := _u.mutation.ArtifactCode(); ok {
|
||||
if err := epicherouserbuild.ArtifactCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.artifact_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroCode(); ok {
|
||||
if err := epicherouserbuild.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicherouserbuild.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicherouserbuild.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicHeroUserBuildUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicherouserbuild.Table, epicherouserbuild.Columns, sqlgraph.NewFieldSpec(epicherouserbuild.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactCode(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldArtifactCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroCode(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroHeathBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroHeathBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedHeroHeathBuild(); ok {
|
||||
_spec.AddField(epicherouserbuild.FieldHeroHeathBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroAttackBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroAttackBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedHeroAttackBuild(); ok {
|
||||
_spec.AddField(epicherouserbuild.FieldHeroAttackBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroDefBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroDefBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedHeroDefBuild(); ok {
|
||||
_spec.AddField(epicherouserbuild.FieldHeroDefBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicherouserbuild.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicherouserbuild.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicherouserbuild.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// EpicHeroUserBuildUpdateOne is the builder for updating a single EpicHeroUserBuild entity.
|
||||
type EpicHeroUserBuildUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *EpicHeroUserBuildMutation
|
||||
}
|
||||
|
||||
// SetArtifactCode sets the "artifact_code" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetArtifactCode(v string) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.SetArtifactCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArtifactCode sets the "artifact_code" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableArtifactCode(v *string) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetArtifactCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetHeroCode(v string) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.SetHeroCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroCode sets the "hero_code" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableHeroCode(v *string) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroHeathBuild sets the "hero_heath_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetHeroHeathBuild(v float64) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.ResetHeroHeathBuild()
|
||||
_u.mutation.SetHeroHeathBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroHeathBuild sets the "hero_heath_build" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableHeroHeathBuild(v *float64) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroHeathBuild(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHeroHeathBuild adds value to the "hero_heath_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) AddHeroHeathBuild(v float64) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.AddHeroHeathBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroAttackBuild sets the "hero_attack_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetHeroAttackBuild(v float64) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.ResetHeroAttackBuild()
|
||||
_u.mutation.SetHeroAttackBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroAttackBuild sets the "hero_attack_build" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableHeroAttackBuild(v *float64) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroAttackBuild(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHeroAttackBuild adds value to the "hero_attack_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) AddHeroAttackBuild(v float64) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.AddHeroAttackBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroDefBuild sets the "hero_def_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetHeroDefBuild(v float64) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.ResetHeroDefBuild()
|
||||
_u.mutation.SetHeroDefBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroDefBuild sets the "hero_def_build" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableHeroDefBuild(v *float64) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroDefBuild(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddHeroDefBuild adds value to the "hero_def_build" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) AddHeroDefBuild(v float64) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.AddHeroDefBuild(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetCreator(v string) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableCreator(v *string) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetCreateTime(v time.Time) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableCreateTime(v *time.Time) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) ClearCreateTime() *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetUpdater(v string) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableUpdater(v *string) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetUpdateTime(v time.Time) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableUpdateTime(v *time.Time) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) ClearUpdateTime() *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetDeleted(v bool) *EpicHeroUserBuildUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SetNillableDeleted(v *bool) *EpicHeroUserBuildUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicHeroUserBuildMutation object of the builder.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) Mutation() *EpicHeroUserBuildMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicHeroUserBuildUpdate builder.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) Where(ps ...predicate.EpicHeroUserBuild) *EpicHeroUserBuildUpdateOne {
|
||||
_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 (_u *EpicHeroUserBuildUpdateOne) Select(field string, fields ...string) *EpicHeroUserBuildUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated EpicHeroUserBuild entity.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) Save(ctx context.Context) (*EpicHeroUserBuild, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) SaveX(ctx context.Context) *EpicHeroUserBuild {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicHeroUserBuildUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.ArtifactCode(); ok {
|
||||
if err := epicherouserbuild.ArtifactCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "artifact_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.artifact_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroCode(); ok {
|
||||
if err := epicherouserbuild.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epicherouserbuild.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epicherouserbuild.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicHeroUserBuild.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicHeroUserBuildUpdateOne) sqlSave(ctx context.Context) (_node *EpicHeroUserBuild, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epicherouserbuild.Table, epicherouserbuild.Columns, sqlgraph.NewFieldSpec(epicherouserbuild.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EpicHeroUserBuild.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epicherouserbuild.FieldID)
|
||||
for _, f := range fields {
|
||||
if !epicherouserbuild.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != epicherouserbuild.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.ArtifactCode(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldArtifactCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroCode(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroHeathBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroHeathBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedHeroHeathBuild(); ok {
|
||||
_spec.AddField(epicherouserbuild.FieldHeroHeathBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroAttackBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroAttackBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedHeroAttackBuild(); ok {
|
||||
_spec.AddField(epicherouserbuild.FieldHeroAttackBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroDefBuild(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldHeroDefBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedHeroDefBuild(); ok {
|
||||
_spec.AddField(epicherouserbuild.FieldHeroDefBuild, field.TypeFloat64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epicherouserbuild.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epicherouserbuild.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epicherouserbuild.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
_node = &EpicHeroUserBuild{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epicherouserbuild.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
222
internal/ent/epici18nmappings.go
Normal file
222
internal/ent/epici18nmappings.go
Normal file
@@ -0,0 +1,222 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epici18nmappings"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicI18NMappings is the model entity for the EpicI18NMappings schema.
|
||||
type EpicI18NMappings struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// KeyName holds the value of the "key_name" field.
|
||||
KeyName string `json:"key_name,omitempty"`
|
||||
// Language holds the value of the "language" field.
|
||||
Language string `json:"language,omitempty"`
|
||||
// Value holds the value of the "value" field.
|
||||
Value string `json:"value,omitempty"`
|
||||
// Category holds the value of the "category" field.
|
||||
Category string `json:"category,omitempty"`
|
||||
// Status holds the value of the "status" field.
|
||||
Status int `json:"status,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted int `json:"deleted,omitempty"`
|
||||
// Code holds the value of the "code" field.
|
||||
Code string `json:"code,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicI18NMappings) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epici18nmappings.FieldID, epici18nmappings.FieldStatus, epici18nmappings.FieldDeleted:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epici18nmappings.FieldKeyName, epici18nmappings.FieldLanguage, epici18nmappings.FieldValue, epici18nmappings.FieldCategory, epici18nmappings.FieldCreator, epici18nmappings.FieldUpdater, epici18nmappings.FieldCode:
|
||||
values[i] = new(sql.NullString)
|
||||
case epici18nmappings.FieldCreateTime, epici18nmappings.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the EpicI18NMappings fields.
|
||||
func (_m *EpicI18NMappings) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epici18nmappings.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epici18nmappings.FieldKeyName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field key_name", values[i])
|
||||
} else if value.Valid {
|
||||
_m.KeyName = value.String
|
||||
}
|
||||
case epici18nmappings.FieldLanguage:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field language", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Language = value.String
|
||||
}
|
||||
case epici18nmappings.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
|
||||
}
|
||||
case epici18nmappings.FieldCategory:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field category", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Category = value.String
|
||||
}
|
||||
case epici18nmappings.FieldStatus:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field status", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Status = int(value.Int64)
|
||||
}
|
||||
case epici18nmappings.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epici18nmappings.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epici18nmappings.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epici18nmappings.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epici18nmappings.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = int(value.Int64)
|
||||
}
|
||||
case epici18nmappings.FieldCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Code = value.String
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetValue returns the ent.Value that was dynamically selected and assigned to the EpicI18NMappings.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicI18NMappings) GetValue(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicI18NMappings.
|
||||
// Note that you need to call EpicI18NMappings.Unwrap() before calling this method if this EpicI18NMappings
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicI18NMappings) Update() *EpicI18NMappingsUpdateOne {
|
||||
return NewEpicI18NMappingsClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicI18NMappings 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 *EpicI18NMappings) Unwrap() *EpicI18NMappings {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicI18NMappings is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicI18NMappings) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicI18NMappings(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("key_name=")
|
||||
builder.WriteString(_m.KeyName)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("language=")
|
||||
builder.WriteString(_m.Language)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("value=")
|
||||
builder.WriteString(_m.Value)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("category=")
|
||||
builder.WriteString(_m.Category)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("status=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Status))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("code=")
|
||||
builder.WriteString(_m.Code)
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicI18NMappingsSlice is a parsable slice of EpicI18NMappings.
|
||||
type EpicI18NMappingsSlice []*EpicI18NMappings
|
||||
144
internal/ent/epici18nmappings/epici18nmappings.go
Normal file
144
internal/ent/epici18nmappings/epici18nmappings.go
Normal file
@@ -0,0 +1,144 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epici18nmappings
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the epici18nmappings type in the database.
|
||||
Label = "epic_i18n_mappings"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldKeyName holds the string denoting the key_name field in the database.
|
||||
FieldKeyName = "key_name"
|
||||
// FieldLanguage holds the string denoting the language field in the database.
|
||||
FieldLanguage = "language"
|
||||
// FieldValue holds the string denoting the value field in the database.
|
||||
FieldValue = "value"
|
||||
// FieldCategory holds the string denoting the category field in the database.
|
||||
FieldCategory = "category"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// FieldCode holds the string denoting the code field in the database.
|
||||
FieldCode = "code"
|
||||
// Table holds the table name of the epici18nmappings in the database.
|
||||
Table = "epic_i18n_mappings"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for epici18nmappings fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldKeyName,
|
||||
FieldLanguage,
|
||||
FieldValue,
|
||||
FieldCategory,
|
||||
FieldStatus,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
FieldCode,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// KeyNameValidator is a validator for the "key_name" field. It is called by the builders before save.
|
||||
KeyNameValidator func(string) error
|
||||
// LanguageValidator is a validator for the "language" field. It is called by the builders before save.
|
||||
LanguageValidator func(string) error
|
||||
// ValueValidator is a validator for the "value" field. It is called by the builders before save.
|
||||
ValueValidator func(string) error
|
||||
// CategoryValidator is a validator for the "category" field. It is called by the builders before save.
|
||||
CategoryValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
// CodeValidator is a validator for the "code" field. It is called by the builders before save.
|
||||
CodeValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the EpicI18NMappings queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByKeyName orders the results by the key_name field.
|
||||
func ByKeyName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldKeyName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLanguage orders the results by the language field.
|
||||
func ByLanguage(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLanguage, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByValue orders the results by the value field.
|
||||
func ByValue(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldValue, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCategory orders the results by the category field.
|
||||
func ByCategory(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCategory, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCode orders the results by the code field.
|
||||
func ByCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCode, opts...).ToFunc()
|
||||
}
|
||||
760
internal/ent/epici18nmappings/where.go
Normal file
760
internal/ent/epici18nmappings/where.go
Normal file
@@ -0,0 +1,760 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package epici18nmappings
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// KeyName applies equality check predicate on the "key_name" field. It's identical to KeyNameEQ.
|
||||
func KeyName(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// Language applies equality check predicate on the "language" field. It's identical to LanguageEQ.
|
||||
func Language(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// Value applies equality check predicate on the "value" field. It's identical to ValueEQ.
|
||||
func Value(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldValue, v))
|
||||
}
|
||||
|
||||
// Category applies equality check predicate on the "category" field. It's identical to CategoryEQ.
|
||||
func Category(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCategory, v))
|
||||
}
|
||||
|
||||
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
||||
func Status(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// Creator applies equality check predicate on the "creator" field. It's identical to CreatorEQ.
|
||||
func Creator(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// Updater applies equality check predicate on the "updater" field. It's identical to UpdaterEQ.
|
||||
func Updater(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||
func Deleted(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// Code applies equality check predicate on the "code" field. It's identical to CodeEQ.
|
||||
func Code(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// KeyNameEQ applies the EQ predicate on the "key_name" field.
|
||||
func KeyNameEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameNEQ applies the NEQ predicate on the "key_name" field.
|
||||
func KeyNameNEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameIn applies the In predicate on the "key_name" field.
|
||||
func KeyNameIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldKeyName, vs...))
|
||||
}
|
||||
|
||||
// KeyNameNotIn applies the NotIn predicate on the "key_name" field.
|
||||
func KeyNameNotIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldKeyName, vs...))
|
||||
}
|
||||
|
||||
// KeyNameGT applies the GT predicate on the "key_name" field.
|
||||
func KeyNameGT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameGTE applies the GTE predicate on the "key_name" field.
|
||||
func KeyNameGTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameLT applies the LT predicate on the "key_name" field.
|
||||
func KeyNameLT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameLTE applies the LTE predicate on the "key_name" field.
|
||||
func KeyNameLTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameContains applies the Contains predicate on the "key_name" field.
|
||||
func KeyNameContains(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContains(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameHasPrefix applies the HasPrefix predicate on the "key_name" field.
|
||||
func KeyNameHasPrefix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasPrefix(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameHasSuffix applies the HasSuffix predicate on the "key_name" field.
|
||||
func KeyNameHasSuffix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasSuffix(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameEqualFold applies the EqualFold predicate on the "key_name" field.
|
||||
func KeyNameEqualFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEqualFold(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// KeyNameContainsFold applies the ContainsFold predicate on the "key_name" field.
|
||||
func KeyNameContainsFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContainsFold(FieldKeyName, v))
|
||||
}
|
||||
|
||||
// LanguageEQ applies the EQ predicate on the "language" field.
|
||||
func LanguageEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageNEQ applies the NEQ predicate on the "language" field.
|
||||
func LanguageNEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageIn applies the In predicate on the "language" field.
|
||||
func LanguageIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldLanguage, vs...))
|
||||
}
|
||||
|
||||
// LanguageNotIn applies the NotIn predicate on the "language" field.
|
||||
func LanguageNotIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldLanguage, vs...))
|
||||
}
|
||||
|
||||
// LanguageGT applies the GT predicate on the "language" field.
|
||||
func LanguageGT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageGTE applies the GTE predicate on the "language" field.
|
||||
func LanguageGTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageLT applies the LT predicate on the "language" field.
|
||||
func LanguageLT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageLTE applies the LTE predicate on the "language" field.
|
||||
func LanguageLTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageContains applies the Contains predicate on the "language" field.
|
||||
func LanguageContains(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContains(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageHasPrefix applies the HasPrefix predicate on the "language" field.
|
||||
func LanguageHasPrefix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasPrefix(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageHasSuffix applies the HasSuffix predicate on the "language" field.
|
||||
func LanguageHasSuffix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasSuffix(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageEqualFold applies the EqualFold predicate on the "language" field.
|
||||
func LanguageEqualFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEqualFold(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// LanguageContainsFold applies the ContainsFold predicate on the "language" field.
|
||||
func LanguageContainsFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContainsFold(FieldLanguage, v))
|
||||
}
|
||||
|
||||
// ValueEQ applies the EQ predicate on the "value" field.
|
||||
func ValueEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueNEQ applies the NEQ predicate on the "value" field.
|
||||
func ValueNEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueIn applies the In predicate on the "value" field.
|
||||
func ValueIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldValue, vs...))
|
||||
}
|
||||
|
||||
// ValueNotIn applies the NotIn predicate on the "value" field.
|
||||
func ValueNotIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldValue, vs...))
|
||||
}
|
||||
|
||||
// ValueGT applies the GT predicate on the "value" field.
|
||||
func ValueGT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueGTE applies the GTE predicate on the "value" field.
|
||||
func ValueGTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueLT applies the LT predicate on the "value" field.
|
||||
func ValueLT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueLTE applies the LTE predicate on the "value" field.
|
||||
func ValueLTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueContains applies the Contains predicate on the "value" field.
|
||||
func ValueContains(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContains(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueHasPrefix applies the HasPrefix predicate on the "value" field.
|
||||
func ValueHasPrefix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasPrefix(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueHasSuffix applies the HasSuffix predicate on the "value" field.
|
||||
func ValueHasSuffix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasSuffix(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueEqualFold applies the EqualFold predicate on the "value" field.
|
||||
func ValueEqualFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEqualFold(FieldValue, v))
|
||||
}
|
||||
|
||||
// ValueContainsFold applies the ContainsFold predicate on the "value" field.
|
||||
func ValueContainsFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContainsFold(FieldValue, v))
|
||||
}
|
||||
|
||||
// CategoryEQ applies the EQ predicate on the "category" field.
|
||||
func CategoryEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryNEQ applies the NEQ predicate on the "category" field.
|
||||
func CategoryNEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryIn applies the In predicate on the "category" field.
|
||||
func CategoryIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldCategory, vs...))
|
||||
}
|
||||
|
||||
// CategoryNotIn applies the NotIn predicate on the "category" field.
|
||||
func CategoryNotIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldCategory, vs...))
|
||||
}
|
||||
|
||||
// CategoryGT applies the GT predicate on the "category" field.
|
||||
func CategoryGT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryGTE applies the GTE predicate on the "category" field.
|
||||
func CategoryGTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryLT applies the LT predicate on the "category" field.
|
||||
func CategoryLT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryLTE applies the LTE predicate on the "category" field.
|
||||
func CategoryLTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryContains applies the Contains predicate on the "category" field.
|
||||
func CategoryContains(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContains(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryHasPrefix applies the HasPrefix predicate on the "category" field.
|
||||
func CategoryHasPrefix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasPrefix(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryHasSuffix applies the HasSuffix predicate on the "category" field.
|
||||
func CategoryHasSuffix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasSuffix(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryEqualFold applies the EqualFold predicate on the "category" field.
|
||||
func CategoryEqualFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEqualFold(FieldCategory, v))
|
||||
}
|
||||
|
||||
// CategoryContainsFold applies the ContainsFold predicate on the "category" field.
|
||||
func CategoryContainsFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContainsFold(FieldCategory, v))
|
||||
}
|
||||
|
||||
// StatusEQ applies the EQ predicate on the "status" field.
|
||||
func StatusEQ(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusNEQ applies the NEQ predicate on the "status" field.
|
||||
func StatusNEQ(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusIn applies the In predicate on the "status" field.
|
||||
func StatusIn(vs ...int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// StatusNotIn applies the NotIn predicate on the "status" field.
|
||||
func StatusNotIn(vs ...int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// StatusGT applies the GT predicate on the "status" field.
|
||||
func StatusGT(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusGTE applies the GTE predicate on the "status" field.
|
||||
func StatusGTE(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusLT applies the LT predicate on the "status" field.
|
||||
func StatusLT(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusLTE applies the LTE predicate on the "status" field.
|
||||
func StatusLTE(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldStatus, v))
|
||||
}
|
||||
|
||||
// CreatorEQ applies the EQ predicate on the "creator" field.
|
||||
func CreatorEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorNEQ applies the NEQ predicate on the "creator" field.
|
||||
func CreatorNEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorIn applies the In predicate on the "creator" field.
|
||||
func CreatorIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorNotIn applies the NotIn predicate on the "creator" field.
|
||||
func CreatorNotIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorGT applies the GT predicate on the "creator" field.
|
||||
func CreatorGT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorGTE applies the GTE predicate on the "creator" field.
|
||||
func CreatorGTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLT applies the LT predicate on the "creator" field.
|
||||
func CreatorLT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLTE applies the LTE predicate on the "creator" field.
|
||||
func CreatorLTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContains applies the Contains predicate on the "creator" field.
|
||||
func CreatorContains(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContains(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasPrefix applies the HasPrefix predicate on the "creator" field.
|
||||
func CreatorHasPrefix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasPrefix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasSuffix applies the HasSuffix predicate on the "creator" field.
|
||||
func CreatorHasSuffix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasSuffix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorEqualFold applies the EqualFold predicate on the "creator" field.
|
||||
func CreatorEqualFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEqualFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContainsFold applies the ContainsFold predicate on the "creator" field.
|
||||
func CreatorContainsFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContainsFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIsNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// UpdaterEQ applies the EQ predicate on the "updater" field.
|
||||
func UpdaterEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterNEQ applies the NEQ predicate on the "updater" field.
|
||||
func UpdaterNEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterIn applies the In predicate on the "updater" field.
|
||||
func UpdaterIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterNotIn applies the NotIn predicate on the "updater" field.
|
||||
func UpdaterNotIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterGT applies the GT predicate on the "updater" field.
|
||||
func UpdaterGT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterGTE applies the GTE predicate on the "updater" field.
|
||||
func UpdaterGTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLT applies the LT predicate on the "updater" field.
|
||||
func UpdaterLT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLTE applies the LTE predicate on the "updater" field.
|
||||
func UpdaterLTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContains applies the Contains predicate on the "updater" field.
|
||||
func UpdaterContains(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContains(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasPrefix applies the HasPrefix predicate on the "updater" field.
|
||||
func UpdaterHasPrefix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasPrefix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasSuffix applies the HasSuffix predicate on the "updater" field.
|
||||
func UpdaterHasSuffix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasSuffix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterEqualFold applies the EqualFold predicate on the "updater" field.
|
||||
func UpdaterEqualFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEqualFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContainsFold applies the ContainsFold predicate on the "updater" field.
|
||||
func UpdaterContainsFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContainsFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v time.Time) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIsNil applies the IsNil predicate on the "update_time" field.
|
||||
func UpdateTimeIsNil() predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIsNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// UpdateTimeNotNil applies the NotNil predicate on the "update_time" field.
|
||||
func UpdateTimeNotNil() predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||
func DeletedEQ(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||
func DeletedNEQ(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedIn applies the In predicate on the "deleted" field.
|
||||
func DeletedIn(vs ...int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldDeleted, vs...))
|
||||
}
|
||||
|
||||
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
|
||||
func DeletedNotIn(vs ...int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldDeleted, vs...))
|
||||
}
|
||||
|
||||
// DeletedGT applies the GT predicate on the "deleted" field.
|
||||
func DeletedGT(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedGTE applies the GTE predicate on the "deleted" field.
|
||||
func DeletedGTE(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedLT applies the LT predicate on the "deleted" field.
|
||||
func DeletedLT(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedLTE applies the LTE predicate on the "deleted" field.
|
||||
func DeletedLTE(v int) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// CodeEQ applies the EQ predicate on the "code" field.
|
||||
func CodeEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeNEQ applies the NEQ predicate on the "code" field.
|
||||
func CodeNEQ(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNEQ(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeIn applies the In predicate on the "code" field.
|
||||
func CodeIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldIn(FieldCode, vs...))
|
||||
}
|
||||
|
||||
// CodeNotIn applies the NotIn predicate on the "code" field.
|
||||
func CodeNotIn(vs ...string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldNotIn(FieldCode, vs...))
|
||||
}
|
||||
|
||||
// CodeGT applies the GT predicate on the "code" field.
|
||||
func CodeGT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGT(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeGTE applies the GTE predicate on the "code" field.
|
||||
func CodeGTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldGTE(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeLT applies the LT predicate on the "code" field.
|
||||
func CodeLT(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLT(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeLTE applies the LTE predicate on the "code" field.
|
||||
func CodeLTE(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldLTE(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeContains applies the Contains predicate on the "code" field.
|
||||
func CodeContains(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContains(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeHasPrefix applies the HasPrefix predicate on the "code" field.
|
||||
func CodeHasPrefix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasPrefix(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeHasSuffix applies the HasSuffix predicate on the "code" field.
|
||||
func CodeHasSuffix(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldHasSuffix(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeEqualFold applies the EqualFold predicate on the "code" field.
|
||||
func CodeEqualFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldEqualFold(FieldCode, v))
|
||||
}
|
||||
|
||||
// CodeContainsFold applies the ContainsFold predicate on the "code" field.
|
||||
func CodeContainsFold(v string) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.FieldContainsFold(FieldCode, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.EpicI18NMappings) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.EpicI18NMappings) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.EpicI18NMappings) predicate.EpicI18NMappings {
|
||||
return predicate.EpicI18NMappings(sql.NotPredicates(p))
|
||||
}
|
||||
371
internal/ent/epici18nmappings_create.go
Normal file
371
internal/ent/epici18nmappings_create.go
Normal file
@@ -0,0 +1,371 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epici18nmappings"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicI18NMappingsCreate is the builder for creating a EpicI18NMappings entity.
|
||||
type EpicI18NMappingsCreate struct {
|
||||
config
|
||||
mutation *EpicI18NMappingsMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetKeyName sets the "key_name" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetKeyName(v string) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetKeyName(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetLanguage sets the "language" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetLanguage(v string) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetLanguage(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetValue sets the "value" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetValue(v string) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetValue(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCategory sets the "category" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetCategory(v string) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetCategory(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetStatus(v int) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetStatus(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetCreator(v string) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetCreateTime(v time.Time) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *EpicI18NMappingsCreate) SetNillableCreateTime(v *time.Time) *EpicI18NMappingsCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetUpdater(v string) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetUpdateTime(v time.Time) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *EpicI18NMappingsCreate) SetNillableUpdateTime(v *time.Time) *EpicI18NMappingsCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetDeleted(v int) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCode sets the "code" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetCode(v string) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *EpicI18NMappingsCreate) SetID(v int64) *EpicI18NMappingsCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the EpicI18NMappingsMutation object of the builder.
|
||||
func (_c *EpicI18NMappingsCreate) Mutation() *EpicI18NMappingsMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the EpicI18NMappings in the database.
|
||||
func (_c *EpicI18NMappingsCreate) Save(ctx context.Context) (*EpicI18NMappings, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *EpicI18NMappingsCreate) SaveX(ctx context.Context) *EpicI18NMappings {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicI18NMappingsCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicI18NMappingsCreate) 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 (_c *EpicI18NMappingsCreate) check() error {
|
||||
if _, ok := _c.mutation.KeyName(); !ok {
|
||||
return &ValidationError{Name: "key_name", err: errors.New(`ent: missing required field "EpicI18NMappings.key_name"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.KeyName(); ok {
|
||||
if err := epici18nmappings.KeyNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "key_name", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.key_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Language(); !ok {
|
||||
return &ValidationError{Name: "language", err: errors.New(`ent: missing required field "EpicI18NMappings.language"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Language(); ok {
|
||||
if err := epici18nmappings.LanguageValidator(v); err != nil {
|
||||
return &ValidationError{Name: "language", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.language": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Value(); !ok {
|
||||
return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "EpicI18NMappings.value"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Value(); ok {
|
||||
if err := epici18nmappings.ValueValidator(v); err != nil {
|
||||
return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.value": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Category(); !ok {
|
||||
return &ValidationError{Name: "category", err: errors.New(`ent: missing required field "EpicI18NMappings.category"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Category(); ok {
|
||||
if err := epici18nmappings.CategoryValidator(v); err != nil {
|
||||
return &ValidationError{Name: "category", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.category": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Status(); !ok {
|
||||
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "EpicI18NMappings.status"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "EpicI18NMappings.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := epici18nmappings.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "EpicI18NMappings.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := epici18nmappings.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "EpicI18NMappings.deleted"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Code(); !ok {
|
||||
return &ValidationError{Name: "code", err: errors.New(`ent: missing required field "EpicI18NMappings.code"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Code(); ok {
|
||||
if err := epici18nmappings.CodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "code", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.code": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *EpicI18NMappingsCreate) sqlSave(ctx context.Context) (*EpicI18NMappings, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *EpicI18NMappingsCreate) createSpec() (*EpicI18NMappings, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &EpicI18NMappings{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(epici18nmappings.Table, sqlgraph.NewFieldSpec(epici18nmappings.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.KeyName(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldKeyName, field.TypeString, value)
|
||||
_node.KeyName = value
|
||||
}
|
||||
if value, ok := _c.mutation.Language(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldLanguage, field.TypeString, value)
|
||||
_node.Language = value
|
||||
}
|
||||
if value, ok := _c.mutation.Value(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldValue, field.TypeString, value)
|
||||
_node.Value = value
|
||||
}
|
||||
if value, ok := _c.mutation.Category(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCategory, field.TypeString, value)
|
||||
_node.Category = value
|
||||
}
|
||||
if value, ok := _c.mutation.Status(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldStatus, field.TypeInt, value)
|
||||
_node.Status = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldDeleted, field.TypeInt, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
if value, ok := _c.mutation.Code(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCode, field.TypeString, value)
|
||||
_node.Code = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// EpicI18NMappingsCreateBulk is the builder for creating many EpicI18NMappings entities in bulk.
|
||||
type EpicI18NMappingsCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*EpicI18NMappingsCreate
|
||||
}
|
||||
|
||||
// Save creates the EpicI18NMappings entities in the database.
|
||||
func (_c *EpicI18NMappingsCreateBulk) Save(ctx context.Context) ([]*EpicI18NMappings, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*EpicI18NMappings, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*EpicI18NMappingsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *EpicI18NMappingsCreateBulk) SaveX(ctx context.Context) []*EpicI18NMappings {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *EpicI18NMappingsCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *EpicI18NMappingsCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/epici18nmappings_delete.go
Normal file
88
internal/ent/epici18nmappings_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epici18nmappings"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicI18NMappingsDelete is the builder for deleting a EpicI18NMappings entity.
|
||||
type EpicI18NMappingsDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicI18NMappingsMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicI18NMappingsDelete builder.
|
||||
func (_d *EpicI18NMappingsDelete) Where(ps ...predicate.EpicI18NMappings) *EpicI18NMappingsDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *EpicI18NMappingsDelete) 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 (_d *EpicI18NMappingsDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *EpicI18NMappingsDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(epici18nmappings.Table, sqlgraph.NewFieldSpec(epici18nmappings.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// EpicI18NMappingsDeleteOne is the builder for deleting a single EpicI18NMappings entity.
|
||||
type EpicI18NMappingsDeleteOne struct {
|
||||
_d *EpicI18NMappingsDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicI18NMappingsDelete builder.
|
||||
func (_d *EpicI18NMappingsDeleteOne) Where(ps ...predicate.EpicI18NMappings) *EpicI18NMappingsDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *EpicI18NMappingsDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{epici18nmappings.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *EpicI18NMappingsDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/epici18nmappings_query.go
Normal file
527
internal/ent/epici18nmappings_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epici18nmappings"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicI18NMappingsQuery is the builder for querying EpicI18NMappings entities.
|
||||
type EpicI18NMappingsQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []epici18nmappings.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.EpicI18NMappings
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the EpicI18NMappingsQuery builder.
|
||||
func (_q *EpicI18NMappingsQuery) Where(ps ...predicate.EpicI18NMappings) *EpicI18NMappingsQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *EpicI18NMappingsQuery) Limit(limit int) *EpicI18NMappingsQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *EpicI18NMappingsQuery) Offset(offset int) *EpicI18NMappingsQuery {
|
||||
_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 (_q *EpicI18NMappingsQuery) Unique(unique bool) *EpicI18NMappingsQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *EpicI18NMappingsQuery) Order(o ...epici18nmappings.OrderOption) *EpicI18NMappingsQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first EpicI18NMappings entity from the query.
|
||||
// Returns a *NotFoundError when no EpicI18NMappings was found.
|
||||
func (_q *EpicI18NMappingsQuery) First(ctx context.Context) (*EpicI18NMappings, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{epici18nmappings.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) FirstX(ctx context.Context) *EpicI18NMappings {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first EpicI18NMappings ID from the query.
|
||||
// Returns a *NotFoundError when no EpicI18NMappings ID was found.
|
||||
func (_q *EpicI18NMappingsQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{epici18nmappings.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single EpicI18NMappings entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one EpicI18NMappings entity is found.
|
||||
// Returns a *NotFoundError when no EpicI18NMappings entities are found.
|
||||
func (_q *EpicI18NMappingsQuery) Only(ctx context.Context) (*EpicI18NMappings, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{epici18nmappings.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{epici18nmappings.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) OnlyX(ctx context.Context) *EpicI18NMappings {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only EpicI18NMappings ID in the query.
|
||||
// Returns a *NotSingularError when more than one EpicI18NMappings ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *EpicI18NMappingsQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{epici18nmappings.Label}
|
||||
default:
|
||||
err = &NotSingularError{epici18nmappings.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of EpicI18NMappingsSlice.
|
||||
func (_q *EpicI18NMappingsQuery) All(ctx context.Context) ([]*EpicI18NMappings, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*EpicI18NMappings, *EpicI18NMappingsQuery]()
|
||||
return withInterceptors[[]*EpicI18NMappings](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) AllX(ctx context.Context) []*EpicI18NMappings {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of EpicI18NMappings IDs.
|
||||
func (_q *EpicI18NMappingsQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(epici18nmappings.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *EpicI18NMappingsQuery) 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, _q, querierCount[*EpicI18NMappingsQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *EpicI18NMappingsQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *EpicI18NMappingsQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the EpicI18NMappingsQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *EpicI18NMappingsQuery) Clone() *EpicI18NMappingsQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &EpicI18NMappingsQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]epici18nmappings.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.EpicI18NMappings{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// KeyName string `json:"key_name,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicI18NMappings.Query().
|
||||
// GroupBy(epici18nmappings.FieldKeyName).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicI18NMappingsQuery) GroupBy(field string, fields ...string) *EpicI18NMappingsGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &EpicI18NMappingsGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = epici18nmappings.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// KeyName string `json:"key_name,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.EpicI18NMappings.Query().
|
||||
// Select(epici18nmappings.FieldKeyName).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *EpicI18NMappingsQuery) Select(fields ...string) *EpicI18NMappingsSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &EpicI18NMappingsSelect{EpicI18NMappingsQuery: _q}
|
||||
sbuild.label = epici18nmappings.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a EpicI18NMappingsSelect configured with the given aggregations.
|
||||
func (_q *EpicI18NMappingsQuery) Aggregate(fns ...AggregateFunc) *EpicI18NMappingsSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *EpicI18NMappingsQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !epici18nmappings.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *EpicI18NMappingsQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*EpicI18NMappings, error) {
|
||||
var (
|
||||
nodes = []*EpicI18NMappings{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*EpicI18NMappings).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &EpicI18NMappings{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *EpicI18NMappingsQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *EpicI18NMappingsQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(epici18nmappings.Table, epici18nmappings.Columns, sqlgraph.NewFieldSpec(epici18nmappings.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epici18nmappings.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != epici18nmappings.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *EpicI18NMappingsQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(epici18nmappings.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = epici18nmappings.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// EpicI18NMappingsGroupBy is the group-by builder for EpicI18NMappings entities.
|
||||
type EpicI18NMappingsGroupBy struct {
|
||||
selector
|
||||
build *EpicI18NMappingsQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *EpicI18NMappingsGroupBy) Aggregate(fns ...AggregateFunc) *EpicI18NMappingsGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *EpicI18NMappingsGroupBy) 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[*EpicI18NMappingsQuery, *EpicI18NMappingsGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *EpicI18NMappingsGroupBy) sqlScan(ctx context.Context, root *EpicI18NMappingsQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// EpicI18NMappingsSelect is the builder for selecting fields of EpicI18NMappings entities.
|
||||
type EpicI18NMappingsSelect struct {
|
||||
*EpicI18NMappingsQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *EpicI18NMappingsSelect) Aggregate(fns ...AggregateFunc) *EpicI18NMappingsSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *EpicI18NMappingsSelect) 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[*EpicI18NMappingsQuery, *EpicI18NMappingsSelect](ctx, _s.EpicI18NMappingsQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *EpicI18NMappingsSelect) sqlScan(ctx context.Context, root *EpicI18NMappingsQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
712
internal/ent/epici18nmappings_update.go
Normal file
712
internal/ent/epici18nmappings_update.go
Normal file
@@ -0,0 +1,712 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/epici18nmappings"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// EpicI18NMappingsUpdate is the builder for updating EpicI18NMappings entities.
|
||||
type EpicI18NMappingsUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *EpicI18NMappingsMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicI18NMappingsUpdate builder.
|
||||
func (_u *EpicI18NMappingsUpdate) Where(ps ...predicate.EpicI18NMappings) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetKeyName sets the "key_name" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetKeyName(v string) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetKeyName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableKeyName sets the "key_name" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableKeyName(v *string) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetKeyName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetLanguage sets the "language" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetLanguage(v string) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetLanguage(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableLanguage sets the "language" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableLanguage(v *string) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetLanguage(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetValue sets the "value" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetValue(v string) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetValue(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableValue sets the "value" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableValue(v *string) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetValue(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCategory sets the "category" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetCategory(v string) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetCategory(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCategory sets the "category" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableCategory(v *string) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCategory(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetStatus(v int) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.ResetStatus()
|
||||
_u.mutation.SetStatus(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableStatus(v *int) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetStatus(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatus adds value to the "status" field.
|
||||
func (_u *EpicI18NMappingsUpdate) AddStatus(v int) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.AddStatus(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetCreator(v string) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableCreator(v *string) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetCreateTime(v time.Time) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableCreateTime(v *time.Time) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicI18NMappingsUpdate) ClearCreateTime() *EpicI18NMappingsUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetUpdater(v string) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableUpdater(v *string) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetUpdateTime(v time.Time) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableUpdateTime(v *time.Time) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicI18NMappingsUpdate) ClearUpdateTime() *EpicI18NMappingsUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetDeleted(v int) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.ResetDeleted()
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableDeleted(v *int) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDeleted adds value to the "deleted" field.
|
||||
func (_u *EpicI18NMappingsUpdate) AddDeleted(v int) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.AddDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCode sets the "code" field.
|
||||
func (_u *EpicI18NMappingsUpdate) SetCode(v string) *EpicI18NMappingsUpdate {
|
||||
_u.mutation.SetCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCode sets the "code" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdate) SetNillableCode(v *string) *EpicI18NMappingsUpdate {
|
||||
if v != nil {
|
||||
_u.SetCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicI18NMappingsMutation object of the builder.
|
||||
func (_u *EpicI18NMappingsUpdate) Mutation() *EpicI18NMappingsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *EpicI18NMappingsUpdate) 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 (_u *EpicI18NMappingsUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *EpicI18NMappingsUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicI18NMappingsUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicI18NMappingsUpdate) check() error {
|
||||
if v, ok := _u.mutation.KeyName(); ok {
|
||||
if err := epici18nmappings.KeyNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "key_name", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.key_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Language(); ok {
|
||||
if err := epici18nmappings.LanguageValidator(v); err != nil {
|
||||
return &ValidationError{Name: "language", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.language": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Value(); ok {
|
||||
if err := epici18nmappings.ValueValidator(v); err != nil {
|
||||
return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.value": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Category(); ok {
|
||||
if err := epici18nmappings.CategoryValidator(v); err != nil {
|
||||
return &ValidationError{Name: "category", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.category": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epici18nmappings.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epici18nmappings.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Code(); ok {
|
||||
if err := epici18nmappings.CodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "code", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.code": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicI18NMappingsUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epici18nmappings.Table, epici18nmappings.Columns, sqlgraph.NewFieldSpec(epici18nmappings.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.KeyName(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldKeyName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Language(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldLanguage, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Value(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldValue, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Category(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCategory, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Status(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldStatus, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatus(); ok {
|
||||
_spec.AddField(epici18nmappings.FieldStatus, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epici18nmappings.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epici18nmappings.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldDeleted, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedDeleted(); ok {
|
||||
_spec.AddField(epici18nmappings.FieldDeleted, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Code(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCode, field.TypeString, value)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epici18nmappings.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// EpicI18NMappingsUpdateOne is the builder for updating a single EpicI18NMappings entity.
|
||||
type EpicI18NMappingsUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *EpicI18NMappingsMutation
|
||||
}
|
||||
|
||||
// SetKeyName sets the "key_name" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetKeyName(v string) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetKeyName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableKeyName sets the "key_name" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableKeyName(v *string) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetKeyName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetLanguage sets the "language" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetLanguage(v string) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetLanguage(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableLanguage sets the "language" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableLanguage(v *string) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetLanguage(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetValue sets the "value" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetValue(v string) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetValue(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableValue sets the "value" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableValue(v *string) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetValue(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCategory sets the "category" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetCategory(v string) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetCategory(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCategory sets the "category" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableCategory(v *string) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCategory(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetStatus(v int) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.ResetStatus()
|
||||
_u.mutation.SetStatus(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableStatus(v *int) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetStatus(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddStatus adds value to the "status" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) AddStatus(v int) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.AddStatus(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetCreator(v string) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableCreator(v *string) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetCreateTime(v time.Time) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableCreateTime(v *time.Time) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) ClearCreateTime() *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetUpdater(v string) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableUpdater(v *string) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetUpdateTime(v time.Time) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableUpdateTime(v *time.Time) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) ClearUpdateTime() *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetDeleted(v int) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.ResetDeleted()
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableDeleted(v *int) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDeleted adds value to the "deleted" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) AddDeleted(v int) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.AddDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCode sets the "code" field.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetCode(v string) *EpicI18NMappingsUpdateOne {
|
||||
_u.mutation.SetCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCode sets the "code" field if the given value is not nil.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SetNillableCode(v *string) *EpicI18NMappingsUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the EpicI18NMappingsMutation object of the builder.
|
||||
func (_u *EpicI18NMappingsUpdateOne) Mutation() *EpicI18NMappingsMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the EpicI18NMappingsUpdate builder.
|
||||
func (_u *EpicI18NMappingsUpdateOne) Where(ps ...predicate.EpicI18NMappings) *EpicI18NMappingsUpdateOne {
|
||||
_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 (_u *EpicI18NMappingsUpdateOne) Select(field string, fields ...string) *EpicI18NMappingsUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated EpicI18NMappings entity.
|
||||
func (_u *EpicI18NMappingsUpdateOne) Save(ctx context.Context) (*EpicI18NMappings, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *EpicI18NMappingsUpdateOne) SaveX(ctx context.Context) *EpicI18NMappings {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *EpicI18NMappingsUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *EpicI18NMappingsUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *EpicI18NMappingsUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.KeyName(); ok {
|
||||
if err := epici18nmappings.KeyNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "key_name", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.key_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Language(); ok {
|
||||
if err := epici18nmappings.LanguageValidator(v); err != nil {
|
||||
return &ValidationError{Name: "language", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.language": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Value(); ok {
|
||||
if err := epici18nmappings.ValueValidator(v); err != nil {
|
||||
return &ValidationError{Name: "value", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.value": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Category(); ok {
|
||||
if err := epici18nmappings.CategoryValidator(v); err != nil {
|
||||
return &ValidationError{Name: "category", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.category": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := epici18nmappings.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := epici18nmappings.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Code(); ok {
|
||||
if err := epici18nmappings.CodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "code", err: fmt.Errorf(`ent: validator failed for field "EpicI18NMappings.code": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *EpicI18NMappingsUpdateOne) sqlSave(ctx context.Context) (_node *EpicI18NMappings, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(epici18nmappings.Table, epici18nmappings.Columns, sqlgraph.NewFieldSpec(epici18nmappings.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "EpicI18NMappings.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, epici18nmappings.FieldID)
|
||||
for _, f := range fields {
|
||||
if !epici18nmappings.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != epici18nmappings.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.KeyName(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldKeyName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Language(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldLanguage, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Value(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldValue, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Category(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCategory, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Status(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldStatus, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedStatus(); ok {
|
||||
_spec.AddField(epici18nmappings.FieldStatus, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(epici18nmappings.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(epici18nmappings.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldDeleted, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedDeleted(); ok {
|
||||
_spec.AddField(epici18nmappings.FieldDeleted, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Code(); ok {
|
||||
_spec.SetField(epici18nmappings.FieldCode, field.TypeString, value)
|
||||
}
|
||||
_node = &EpicI18NMappings{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{epici18nmappings.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
202
internal/ent/fribbleheroset.go
Normal file
202
internal/ent/fribbleheroset.go
Normal file
@@ -0,0 +1,202 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/fribbleheroset"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// FribbleHeroSet is the model entity for the FribbleHeroSet schema.
|
||||
type FribbleHeroSet struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// HeroCode holds the value of the "hero_code" field.
|
||||
HeroCode string `json:"hero_code,omitempty"`
|
||||
// JSONContent holds the value of the "json_content" field.
|
||||
JSONContent string `json:"json_content,omitempty"`
|
||||
// HeroName holds the value of the "hero_name" field.
|
||||
HeroName string `json:"hero_name,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
// SuccessGet holds the value of the "success_get" field.
|
||||
SuccessGet int `json:"success_get,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*FribbleHeroSet) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case fribbleheroset.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case fribbleheroset.FieldID, fribbleheroset.FieldSuccessGet:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case fribbleheroset.FieldHeroCode, fribbleheroset.FieldJSONContent, fribbleheroset.FieldHeroName, fribbleheroset.FieldCreator, fribbleheroset.FieldUpdater:
|
||||
values[i] = new(sql.NullString)
|
||||
case fribbleheroset.FieldCreateTime, fribbleheroset.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the FribbleHeroSet fields.
|
||||
func (_m *FribbleHeroSet) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case fribbleheroset.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case fribbleheroset.FieldHeroCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroCode = value.String
|
||||
}
|
||||
case fribbleheroset.FieldJSONContent:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field json_content", values[i])
|
||||
} else if value.Valid {
|
||||
_m.JSONContent = value.String
|
||||
}
|
||||
case fribbleheroset.FieldHeroName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hero_name", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HeroName = value.String
|
||||
}
|
||||
case fribbleheroset.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case fribbleheroset.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case fribbleheroset.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case fribbleheroset.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case fribbleheroset.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
case fribbleheroset.FieldSuccessGet:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field success_get", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SuccessGet = int(value.Int64)
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the FribbleHeroSet.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *FribbleHeroSet) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this FribbleHeroSet.
|
||||
// Note that you need to call FribbleHeroSet.Unwrap() before calling this method if this FribbleHeroSet
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *FribbleHeroSet) Update() *FribbleHeroSetUpdateOne {
|
||||
return NewFribbleHeroSetClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the FribbleHeroSet 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 *FribbleHeroSet) Unwrap() *FribbleHeroSet {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: FribbleHeroSet is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *FribbleHeroSet) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("FribbleHeroSet(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("hero_code=")
|
||||
builder.WriteString(_m.HeroCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("json_content=")
|
||||
builder.WriteString(_m.JSONContent)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hero_name=")
|
||||
builder.WriteString(_m.HeroName)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("success_get=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.SuccessGet))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// FribbleHeroSets is a parsable slice of FribbleHeroSet.
|
||||
type FribbleHeroSets []*FribbleHeroSet
|
||||
124
internal/ent/fribbleheroset/fribbleheroset.go
Normal file
124
internal/ent/fribbleheroset/fribbleheroset.go
Normal file
@@ -0,0 +1,124 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package fribbleheroset
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the fribbleheroset type in the database.
|
||||
Label = "fribble_hero_set"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldHeroCode holds the string denoting the hero_code field in the database.
|
||||
FieldHeroCode = "hero_code"
|
||||
// FieldJSONContent holds the string denoting the json_content field in the database.
|
||||
FieldJSONContent = "json_content"
|
||||
// FieldHeroName holds the string denoting the hero_name field in the database.
|
||||
FieldHeroName = "hero_name"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// FieldSuccessGet holds the string denoting the success_get field in the database.
|
||||
FieldSuccessGet = "success_get"
|
||||
// Table holds the table name of the fribbleheroset in the database.
|
||||
Table = "fribble_hero_sets"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for fribbleheroset fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldHeroCode,
|
||||
FieldJSONContent,
|
||||
FieldHeroName,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
FieldSuccessGet,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// HeroCodeValidator is a validator for the "hero_code" field. It is called by the builders before save.
|
||||
HeroCodeValidator func(string) error
|
||||
// JSONContentValidator is a validator for the "json_content" field. It is called by the builders before save.
|
||||
JSONContentValidator func(string) error
|
||||
// HeroNameValidator is a validator for the "hero_name" field. It is called by the builders before save.
|
||||
HeroNameValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the FribbleHeroSet queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroCode orders the results by the hero_code field.
|
||||
func ByHeroCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByJSONContent orders the results by the json_content field.
|
||||
func ByJSONContent(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldJSONContent, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHeroName orders the results by the hero_name field.
|
||||
func ByHeroName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldHeroName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySuccessGet orders the results by the success_get field.
|
||||
func BySuccessGet(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSuccessGet, opts...).ToFunc()
|
||||
}
|
||||
590
internal/ent/fribbleheroset/where.go
Normal file
590
internal/ent/fribbleheroset/where.go
Normal file
@@ -0,0 +1,590 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package fribbleheroset
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// HeroCode applies equality check predicate on the "hero_code" field. It's identical to HeroCodeEQ.
|
||||
func HeroCode(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// JSONContent applies equality check predicate on the "json_content" field. It's identical to JSONContentEQ.
|
||||
func JSONContent(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// HeroName applies equality check predicate on the "hero_name" field. It's identical to HeroNameEQ.
|
||||
func HeroName(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// Creator applies equality check predicate on the "creator" field. It's identical to CreatorEQ.
|
||||
func Creator(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||
func CreateTime(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// Updater applies equality check predicate on the "updater" field. It's identical to UpdaterEQ.
|
||||
func Updater(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTime applies equality check predicate on the "update_time" field. It's identical to UpdateTimeEQ.
|
||||
func UpdateTime(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||
func Deleted(v bool) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// SuccessGet applies equality check predicate on the "success_get" field. It's identical to SuccessGetEQ.
|
||||
func SuccessGet(v int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldSuccessGet, v))
|
||||
}
|
||||
|
||||
// HeroCodeEQ applies the EQ predicate on the "hero_code" field.
|
||||
func HeroCodeEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeNEQ applies the NEQ predicate on the "hero_code" field.
|
||||
func HeroCodeNEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeIn applies the In predicate on the "hero_code" field.
|
||||
func HeroCodeIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldHeroCode, vs...))
|
||||
}
|
||||
|
||||
// HeroCodeNotIn applies the NotIn predicate on the "hero_code" field.
|
||||
func HeroCodeNotIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldHeroCode, vs...))
|
||||
}
|
||||
|
||||
// HeroCodeGT applies the GT predicate on the "hero_code" field.
|
||||
func HeroCodeGT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeGTE applies the GTE predicate on the "hero_code" field.
|
||||
func HeroCodeGTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeLT applies the LT predicate on the "hero_code" field.
|
||||
func HeroCodeLT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeLTE applies the LTE predicate on the "hero_code" field.
|
||||
func HeroCodeLTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeContains applies the Contains predicate on the "hero_code" field.
|
||||
func HeroCodeContains(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContains(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeHasPrefix applies the HasPrefix predicate on the "hero_code" field.
|
||||
func HeroCodeHasPrefix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasPrefix(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeHasSuffix applies the HasSuffix predicate on the "hero_code" field.
|
||||
func HeroCodeHasSuffix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasSuffix(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeEqualFold applies the EqualFold predicate on the "hero_code" field.
|
||||
func HeroCodeEqualFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEqualFold(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// HeroCodeContainsFold applies the ContainsFold predicate on the "hero_code" field.
|
||||
func HeroCodeContainsFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContainsFold(FieldHeroCode, v))
|
||||
}
|
||||
|
||||
// JSONContentEQ applies the EQ predicate on the "json_content" field.
|
||||
func JSONContentEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentNEQ applies the NEQ predicate on the "json_content" field.
|
||||
func JSONContentNEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentIn applies the In predicate on the "json_content" field.
|
||||
func JSONContentIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldJSONContent, vs...))
|
||||
}
|
||||
|
||||
// JSONContentNotIn applies the NotIn predicate on the "json_content" field.
|
||||
func JSONContentNotIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldJSONContent, vs...))
|
||||
}
|
||||
|
||||
// JSONContentGT applies the GT predicate on the "json_content" field.
|
||||
func JSONContentGT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentGTE applies the GTE predicate on the "json_content" field.
|
||||
func JSONContentGTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentLT applies the LT predicate on the "json_content" field.
|
||||
func JSONContentLT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentLTE applies the LTE predicate on the "json_content" field.
|
||||
func JSONContentLTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentContains applies the Contains predicate on the "json_content" field.
|
||||
func JSONContentContains(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContains(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentHasPrefix applies the HasPrefix predicate on the "json_content" field.
|
||||
func JSONContentHasPrefix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasPrefix(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentHasSuffix applies the HasSuffix predicate on the "json_content" field.
|
||||
func JSONContentHasSuffix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasSuffix(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentEqualFold applies the EqualFold predicate on the "json_content" field.
|
||||
func JSONContentEqualFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEqualFold(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// JSONContentContainsFold applies the ContainsFold predicate on the "json_content" field.
|
||||
func JSONContentContainsFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContainsFold(FieldJSONContent, v))
|
||||
}
|
||||
|
||||
// HeroNameEQ applies the EQ predicate on the "hero_name" field.
|
||||
func HeroNameEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameNEQ applies the NEQ predicate on the "hero_name" field.
|
||||
func HeroNameNEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameIn applies the In predicate on the "hero_name" field.
|
||||
func HeroNameIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldHeroName, vs...))
|
||||
}
|
||||
|
||||
// HeroNameNotIn applies the NotIn predicate on the "hero_name" field.
|
||||
func HeroNameNotIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldHeroName, vs...))
|
||||
}
|
||||
|
||||
// HeroNameGT applies the GT predicate on the "hero_name" field.
|
||||
func HeroNameGT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameGTE applies the GTE predicate on the "hero_name" field.
|
||||
func HeroNameGTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameLT applies the LT predicate on the "hero_name" field.
|
||||
func HeroNameLT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameLTE applies the LTE predicate on the "hero_name" field.
|
||||
func HeroNameLTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameContains applies the Contains predicate on the "hero_name" field.
|
||||
func HeroNameContains(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContains(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameHasPrefix applies the HasPrefix predicate on the "hero_name" field.
|
||||
func HeroNameHasPrefix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasPrefix(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameHasSuffix applies the HasSuffix predicate on the "hero_name" field.
|
||||
func HeroNameHasSuffix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasSuffix(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameEqualFold applies the EqualFold predicate on the "hero_name" field.
|
||||
func HeroNameEqualFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEqualFold(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// HeroNameContainsFold applies the ContainsFold predicate on the "hero_name" field.
|
||||
func HeroNameContainsFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContainsFold(FieldHeroName, v))
|
||||
}
|
||||
|
||||
// CreatorEQ applies the EQ predicate on the "creator" field.
|
||||
func CreatorEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorNEQ applies the NEQ predicate on the "creator" field.
|
||||
func CreatorNEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorIn applies the In predicate on the "creator" field.
|
||||
func CreatorIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorNotIn applies the NotIn predicate on the "creator" field.
|
||||
func CreatorNotIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldCreator, vs...))
|
||||
}
|
||||
|
||||
// CreatorGT applies the GT predicate on the "creator" field.
|
||||
func CreatorGT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorGTE applies the GTE predicate on the "creator" field.
|
||||
func CreatorGTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLT applies the LT predicate on the "creator" field.
|
||||
func CreatorLT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorLTE applies the LTE predicate on the "creator" field.
|
||||
func CreatorLTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContains applies the Contains predicate on the "creator" field.
|
||||
func CreatorContains(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContains(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasPrefix applies the HasPrefix predicate on the "creator" field.
|
||||
func CreatorHasPrefix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasPrefix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorHasSuffix applies the HasSuffix predicate on the "creator" field.
|
||||
func CreatorHasSuffix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasSuffix(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorEqualFold applies the EqualFold predicate on the "creator" field.
|
||||
func CreatorEqualFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEqualFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreatorContainsFold applies the ContainsFold predicate on the "creator" field.
|
||||
func CreatorContainsFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContainsFold(FieldCreator, v))
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldCreateTime, v))
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIsNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotNull(FieldCreateTime))
|
||||
}
|
||||
|
||||
// UpdaterEQ applies the EQ predicate on the "updater" field.
|
||||
func UpdaterEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterNEQ applies the NEQ predicate on the "updater" field.
|
||||
func UpdaterNEQ(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterIn applies the In predicate on the "updater" field.
|
||||
func UpdaterIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterNotIn applies the NotIn predicate on the "updater" field.
|
||||
func UpdaterNotIn(vs ...string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldUpdater, vs...))
|
||||
}
|
||||
|
||||
// UpdaterGT applies the GT predicate on the "updater" field.
|
||||
func UpdaterGT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterGTE applies the GTE predicate on the "updater" field.
|
||||
func UpdaterGTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLT applies the LT predicate on the "updater" field.
|
||||
func UpdaterLT(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterLTE applies the LTE predicate on the "updater" field.
|
||||
func UpdaterLTE(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContains applies the Contains predicate on the "updater" field.
|
||||
func UpdaterContains(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContains(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasPrefix applies the HasPrefix predicate on the "updater" field.
|
||||
func UpdaterHasPrefix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasPrefix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterHasSuffix applies the HasSuffix predicate on the "updater" field.
|
||||
func UpdaterHasSuffix(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldHasSuffix(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterEqualFold applies the EqualFold predicate on the "updater" field.
|
||||
func UpdaterEqualFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEqualFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdaterContainsFold applies the ContainsFold predicate on the "updater" field.
|
||||
func UpdaterContainsFold(v string) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldContainsFold(FieldUpdater, v))
|
||||
}
|
||||
|
||||
// UpdateTimeEQ applies the EQ predicate on the "update_time" field.
|
||||
func UpdateTimeEQ(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeNEQ applies the NEQ predicate on the "update_time" field.
|
||||
func UpdateTimeNEQ(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIn applies the In predicate on the "update_time" field.
|
||||
func UpdateTimeIn(vs ...time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeNotIn applies the NotIn predicate on the "update_time" field.
|
||||
func UpdateTimeNotIn(vs ...time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldUpdateTime, vs...))
|
||||
}
|
||||
|
||||
// UpdateTimeGT applies the GT predicate on the "update_time" field.
|
||||
func UpdateTimeGT(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeGTE applies the GTE predicate on the "update_time" field.
|
||||
func UpdateTimeGTE(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLT applies the LT predicate on the "update_time" field.
|
||||
func UpdateTimeLT(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeLTE applies the LTE predicate on the "update_time" field.
|
||||
func UpdateTimeLTE(v time.Time) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldUpdateTime, v))
|
||||
}
|
||||
|
||||
// UpdateTimeIsNil applies the IsNil predicate on the "update_time" field.
|
||||
func UpdateTimeIsNil() predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIsNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// UpdateTimeNotNil applies the NotNil predicate on the "update_time" field.
|
||||
func UpdateTimeNotNil() predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotNull(FieldUpdateTime))
|
||||
}
|
||||
|
||||
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||
func DeletedEQ(v bool) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||
func DeletedNEQ(v bool) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldDeleted, v))
|
||||
}
|
||||
|
||||
// SuccessGetEQ applies the EQ predicate on the "success_get" field.
|
||||
func SuccessGetEQ(v int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldEQ(FieldSuccessGet, v))
|
||||
}
|
||||
|
||||
// SuccessGetNEQ applies the NEQ predicate on the "success_get" field.
|
||||
func SuccessGetNEQ(v int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNEQ(FieldSuccessGet, v))
|
||||
}
|
||||
|
||||
// SuccessGetIn applies the In predicate on the "success_get" field.
|
||||
func SuccessGetIn(vs ...int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldIn(FieldSuccessGet, vs...))
|
||||
}
|
||||
|
||||
// SuccessGetNotIn applies the NotIn predicate on the "success_get" field.
|
||||
func SuccessGetNotIn(vs ...int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldNotIn(FieldSuccessGet, vs...))
|
||||
}
|
||||
|
||||
// SuccessGetGT applies the GT predicate on the "success_get" field.
|
||||
func SuccessGetGT(v int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGT(FieldSuccessGet, v))
|
||||
}
|
||||
|
||||
// SuccessGetGTE applies the GTE predicate on the "success_get" field.
|
||||
func SuccessGetGTE(v int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldGTE(FieldSuccessGet, v))
|
||||
}
|
||||
|
||||
// SuccessGetLT applies the LT predicate on the "success_get" field.
|
||||
func SuccessGetLT(v int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLT(FieldSuccessGet, v))
|
||||
}
|
||||
|
||||
// SuccessGetLTE applies the LTE predicate on the "success_get" field.
|
||||
func SuccessGetLTE(v int) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.FieldLTE(FieldSuccessGet, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.FribbleHeroSet) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.FribbleHeroSet) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.FribbleHeroSet) predicate.FribbleHeroSet {
|
||||
return predicate.FribbleHeroSet(sql.NotPredicates(p))
|
||||
}
|
||||
335
internal/ent/fribbleheroset_create.go
Normal file
335
internal/ent/fribbleheroset_create.go
Normal file
@@ -0,0 +1,335 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/fribbleheroset"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// FribbleHeroSetCreate is the builder for creating a FribbleHeroSet entity.
|
||||
type FribbleHeroSetCreate struct {
|
||||
config
|
||||
mutation *FribbleHeroSetMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_c *FribbleHeroSetCreate) SetHeroCode(v string) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetHeroCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetJSONContent sets the "json_content" field.
|
||||
func (_c *FribbleHeroSetCreate) SetJSONContent(v string) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetJSONContent(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetHeroName sets the "hero_name" field.
|
||||
func (_c *FribbleHeroSetCreate) SetHeroName(v string) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetHeroName(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *FribbleHeroSetCreate) SetCreator(v string) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *FribbleHeroSetCreate) SetCreateTime(v time.Time) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *FribbleHeroSetCreate) SetNillableCreateTime(v *time.Time) *FribbleHeroSetCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *FribbleHeroSetCreate) SetUpdater(v string) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *FribbleHeroSetCreate) SetUpdateTime(v time.Time) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *FribbleHeroSetCreate) SetNillableUpdateTime(v *time.Time) *FribbleHeroSetCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *FribbleHeroSetCreate) SetDeleted(v bool) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSuccessGet sets the "success_get" field.
|
||||
func (_c *FribbleHeroSetCreate) SetSuccessGet(v int) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetSuccessGet(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *FribbleHeroSetCreate) SetID(v int64) *FribbleHeroSetCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the FribbleHeroSetMutation object of the builder.
|
||||
func (_c *FribbleHeroSetCreate) Mutation() *FribbleHeroSetMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the FribbleHeroSet in the database.
|
||||
func (_c *FribbleHeroSetCreate) Save(ctx context.Context) (*FribbleHeroSet, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *FribbleHeroSetCreate) SaveX(ctx context.Context) *FribbleHeroSet {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *FribbleHeroSetCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *FribbleHeroSetCreate) 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 (_c *FribbleHeroSetCreate) check() error {
|
||||
if _, ok := _c.mutation.HeroCode(); !ok {
|
||||
return &ValidationError{Name: "hero_code", err: errors.New(`ent: missing required field "FribbleHeroSet.hero_code"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.HeroCode(); ok {
|
||||
if err := fribbleheroset.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.JSONContent(); !ok {
|
||||
return &ValidationError{Name: "json_content", err: errors.New(`ent: missing required field "FribbleHeroSet.json_content"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.JSONContent(); ok {
|
||||
if err := fribbleheroset.JSONContentValidator(v); err != nil {
|
||||
return &ValidationError{Name: "json_content", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.json_content": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.HeroName(); !ok {
|
||||
return &ValidationError{Name: "hero_name", err: errors.New(`ent: missing required field "FribbleHeroSet.hero_name"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.HeroName(); ok {
|
||||
if err := fribbleheroset.HeroNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_name", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.hero_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "FribbleHeroSet.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := fribbleheroset.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "FribbleHeroSet.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := fribbleheroset.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "FribbleHeroSet.deleted"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.SuccessGet(); !ok {
|
||||
return &ValidationError{Name: "success_get", err: errors.New(`ent: missing required field "FribbleHeroSet.success_get"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *FribbleHeroSetCreate) sqlSave(ctx context.Context) (*FribbleHeroSet, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *FribbleHeroSetCreate) createSpec() (*FribbleHeroSet, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &FribbleHeroSet{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(fribbleheroset.Table, sqlgraph.NewFieldSpec(fribbleheroset.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.HeroCode(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldHeroCode, field.TypeString, value)
|
||||
_node.HeroCode = value
|
||||
}
|
||||
if value, ok := _c.mutation.JSONContent(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldJSONContent, field.TypeString, value)
|
||||
_node.JSONContent = value
|
||||
}
|
||||
if value, ok := _c.mutation.HeroName(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldHeroName, field.TypeString, value)
|
||||
_node.HeroName = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
if value, ok := _c.mutation.SuccessGet(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldSuccessGet, field.TypeInt, value)
|
||||
_node.SuccessGet = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// FribbleHeroSetCreateBulk is the builder for creating many FribbleHeroSet entities in bulk.
|
||||
type FribbleHeroSetCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*FribbleHeroSetCreate
|
||||
}
|
||||
|
||||
// Save creates the FribbleHeroSet entities in the database.
|
||||
func (_c *FribbleHeroSetCreateBulk) Save(ctx context.Context) ([]*FribbleHeroSet, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*FribbleHeroSet, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*FribbleHeroSetMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *FribbleHeroSetCreateBulk) SaveX(ctx context.Context) []*FribbleHeroSet {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *FribbleHeroSetCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *FribbleHeroSetCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/fribbleheroset_delete.go
Normal file
88
internal/ent/fribbleheroset_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/fribbleheroset"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// FribbleHeroSetDelete is the builder for deleting a FribbleHeroSet entity.
|
||||
type FribbleHeroSetDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *FribbleHeroSetMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the FribbleHeroSetDelete builder.
|
||||
func (_d *FribbleHeroSetDelete) Where(ps ...predicate.FribbleHeroSet) *FribbleHeroSetDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *FribbleHeroSetDelete) 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 (_d *FribbleHeroSetDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *FribbleHeroSetDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(fribbleheroset.Table, sqlgraph.NewFieldSpec(fribbleheroset.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// FribbleHeroSetDeleteOne is the builder for deleting a single FribbleHeroSet entity.
|
||||
type FribbleHeroSetDeleteOne struct {
|
||||
_d *FribbleHeroSetDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the FribbleHeroSetDelete builder.
|
||||
func (_d *FribbleHeroSetDeleteOne) Where(ps ...predicate.FribbleHeroSet) *FribbleHeroSetDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *FribbleHeroSetDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{fribbleheroset.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *FribbleHeroSetDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/fribbleheroset_query.go
Normal file
527
internal/ent/fribbleheroset_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/fribbleheroset"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// FribbleHeroSetQuery is the builder for querying FribbleHeroSet entities.
|
||||
type FribbleHeroSetQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []fribbleheroset.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.FribbleHeroSet
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the FribbleHeroSetQuery builder.
|
||||
func (_q *FribbleHeroSetQuery) Where(ps ...predicate.FribbleHeroSet) *FribbleHeroSetQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *FribbleHeroSetQuery) Limit(limit int) *FribbleHeroSetQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *FribbleHeroSetQuery) Offset(offset int) *FribbleHeroSetQuery {
|
||||
_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 (_q *FribbleHeroSetQuery) Unique(unique bool) *FribbleHeroSetQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *FribbleHeroSetQuery) Order(o ...fribbleheroset.OrderOption) *FribbleHeroSetQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first FribbleHeroSet entity from the query.
|
||||
// Returns a *NotFoundError when no FribbleHeroSet was found.
|
||||
func (_q *FribbleHeroSetQuery) First(ctx context.Context) (*FribbleHeroSet, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{fribbleheroset.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) FirstX(ctx context.Context) *FribbleHeroSet {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first FribbleHeroSet ID from the query.
|
||||
// Returns a *NotFoundError when no FribbleHeroSet ID was found.
|
||||
func (_q *FribbleHeroSetQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{fribbleheroset.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single FribbleHeroSet entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one FribbleHeroSet entity is found.
|
||||
// Returns a *NotFoundError when no FribbleHeroSet entities are found.
|
||||
func (_q *FribbleHeroSetQuery) Only(ctx context.Context) (*FribbleHeroSet, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{fribbleheroset.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{fribbleheroset.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) OnlyX(ctx context.Context) *FribbleHeroSet {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only FribbleHeroSet ID in the query.
|
||||
// Returns a *NotSingularError when more than one FribbleHeroSet ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *FribbleHeroSetQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{fribbleheroset.Label}
|
||||
default:
|
||||
err = &NotSingularError{fribbleheroset.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of FribbleHeroSets.
|
||||
func (_q *FribbleHeroSetQuery) All(ctx context.Context) ([]*FribbleHeroSet, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*FribbleHeroSet, *FribbleHeroSetQuery]()
|
||||
return withInterceptors[[]*FribbleHeroSet](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) AllX(ctx context.Context) []*FribbleHeroSet {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of FribbleHeroSet IDs.
|
||||
func (_q *FribbleHeroSetQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(fribbleheroset.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *FribbleHeroSetQuery) 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, _q, querierCount[*FribbleHeroSetQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *FribbleHeroSetQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *FribbleHeroSetQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the FribbleHeroSetQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *FribbleHeroSetQuery) Clone() *FribbleHeroSetQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &FribbleHeroSetQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]fribbleheroset.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.FribbleHeroSet{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// HeroCode string `json:"hero_code,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.FribbleHeroSet.Query().
|
||||
// GroupBy(fribbleheroset.FieldHeroCode).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *FribbleHeroSetQuery) GroupBy(field string, fields ...string) *FribbleHeroSetGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &FribbleHeroSetGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = fribbleheroset.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// HeroCode string `json:"hero_code,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.FribbleHeroSet.Query().
|
||||
// Select(fribbleheroset.FieldHeroCode).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *FribbleHeroSetQuery) Select(fields ...string) *FribbleHeroSetSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &FribbleHeroSetSelect{FribbleHeroSetQuery: _q}
|
||||
sbuild.label = fribbleheroset.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a FribbleHeroSetSelect configured with the given aggregations.
|
||||
func (_q *FribbleHeroSetQuery) Aggregate(fns ...AggregateFunc) *FribbleHeroSetSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *FribbleHeroSetQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !fribbleheroset.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *FribbleHeroSetQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*FribbleHeroSet, error) {
|
||||
var (
|
||||
nodes = []*FribbleHeroSet{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*FribbleHeroSet).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &FribbleHeroSet{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *FribbleHeroSetQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *FribbleHeroSetQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(fribbleheroset.Table, fribbleheroset.Columns, sqlgraph.NewFieldSpec(fribbleheroset.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fribbleheroset.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != fribbleheroset.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *FribbleHeroSetQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(fribbleheroset.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = fribbleheroset.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// FribbleHeroSetGroupBy is the group-by builder for FribbleHeroSet entities.
|
||||
type FribbleHeroSetGroupBy struct {
|
||||
selector
|
||||
build *FribbleHeroSetQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *FribbleHeroSetGroupBy) Aggregate(fns ...AggregateFunc) *FribbleHeroSetGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *FribbleHeroSetGroupBy) 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[*FribbleHeroSetQuery, *FribbleHeroSetGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *FribbleHeroSetGroupBy) sqlScan(ctx context.Context, root *FribbleHeroSetQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// FribbleHeroSetSelect is the builder for selecting fields of FribbleHeroSet entities.
|
||||
type FribbleHeroSetSelect struct {
|
||||
*FribbleHeroSetQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *FribbleHeroSetSelect) Aggregate(fns ...AggregateFunc) *FribbleHeroSetSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *FribbleHeroSetSelect) 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[*FribbleHeroSetQuery, *FribbleHeroSetSelect](ctx, _s.FribbleHeroSetQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *FribbleHeroSetSelect) sqlScan(ctx context.Context, root *FribbleHeroSetQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
604
internal/ent/fribbleheroset_update.go
Normal file
604
internal/ent/fribbleheroset_update.go
Normal file
@@ -0,0 +1,604 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/fribbleheroset"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// FribbleHeroSetUpdate is the builder for updating FribbleHeroSet entities.
|
||||
type FribbleHeroSetUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *FribbleHeroSetMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the FribbleHeroSetUpdate builder.
|
||||
func (_u *FribbleHeroSetUpdate) Where(ps ...predicate.FribbleHeroSet) *FribbleHeroSetUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetHeroCode(v string) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetHeroCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroCode sets the "hero_code" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableHeroCode(v *string) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetJSONContent sets the "json_content" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetJSONContent(v string) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetJSONContent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableJSONContent sets the "json_content" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableJSONContent(v *string) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetJSONContent(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroName sets the "hero_name" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetHeroName(v string) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetHeroName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroName sets the "hero_name" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableHeroName(v *string) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetHeroName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetCreator(v string) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableCreator(v *string) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetCreateTime(v time.Time) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableCreateTime(v *time.Time) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *FribbleHeroSetUpdate) ClearCreateTime() *FribbleHeroSetUpdate {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetUpdater(v string) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableUpdater(v *string) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetUpdateTime(v time.Time) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableUpdateTime(v *time.Time) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *FribbleHeroSetUpdate) ClearUpdateTime() *FribbleHeroSetUpdate {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetDeleted(v bool) *FribbleHeroSetUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableDeleted(v *bool) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSuccessGet sets the "success_get" field.
|
||||
func (_u *FribbleHeroSetUpdate) SetSuccessGet(v int) *FribbleHeroSetUpdate {
|
||||
_u.mutation.ResetSuccessGet()
|
||||
_u.mutation.SetSuccessGet(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSuccessGet sets the "success_get" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdate) SetNillableSuccessGet(v *int) *FribbleHeroSetUpdate {
|
||||
if v != nil {
|
||||
_u.SetSuccessGet(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSuccessGet adds value to the "success_get" field.
|
||||
func (_u *FribbleHeroSetUpdate) AddSuccessGet(v int) *FribbleHeroSetUpdate {
|
||||
_u.mutation.AddSuccessGet(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the FribbleHeroSetMutation object of the builder.
|
||||
func (_u *FribbleHeroSetUpdate) Mutation() *FribbleHeroSetMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *FribbleHeroSetUpdate) 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 (_u *FribbleHeroSetUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *FribbleHeroSetUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *FribbleHeroSetUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *FribbleHeroSetUpdate) check() error {
|
||||
if v, ok := _u.mutation.HeroCode(); ok {
|
||||
if err := fribbleheroset.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.JSONContent(); ok {
|
||||
if err := fribbleheroset.JSONContentValidator(v); err != nil {
|
||||
return &ValidationError{Name: "json_content", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.json_content": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroName(); ok {
|
||||
if err := fribbleheroset.HeroNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_name", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.hero_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := fribbleheroset.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := fribbleheroset.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *FribbleHeroSetUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(fribbleheroset.Table, fribbleheroset.Columns, sqlgraph.NewFieldSpec(fribbleheroset.FieldID, field.TypeInt64))
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.HeroCode(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldHeroCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.JSONContent(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldJSONContent, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroName(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldHeroName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(fribbleheroset.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(fribbleheroset.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SuccessGet(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldSuccessGet, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedSuccessGet(); ok {
|
||||
_spec.AddField(fribbleheroset.FieldSuccessGet, field.TypeInt, value)
|
||||
}
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{fribbleheroset.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
// FribbleHeroSetUpdateOne is the builder for updating a single FribbleHeroSet entity.
|
||||
type FribbleHeroSetUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *FribbleHeroSetMutation
|
||||
}
|
||||
|
||||
// SetHeroCode sets the "hero_code" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetHeroCode(v string) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetHeroCode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroCode sets the "hero_code" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableHeroCode(v *string) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroCode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetJSONContent sets the "json_content" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetJSONContent(v string) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetJSONContent(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableJSONContent sets the "json_content" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableJSONContent(v *string) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetJSONContent(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetHeroName sets the "hero_name" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetHeroName(v string) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetHeroName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableHeroName sets the "hero_name" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableHeroName(v *string) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetHeroName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetCreator(v string) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetCreator(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreator sets the "creator" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableCreator(v *string) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreator(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetCreateTime(v time.Time) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetCreateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableCreateTime(v *time.Time) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetCreateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearCreateTime clears the value of the "create_time" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) ClearCreateTime() *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.ClearCreateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetUpdater(v string) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetUpdater(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdater sets the "updater" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableUpdater(v *string) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdater(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetUpdateTime(v time.Time) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetUpdateTime(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableUpdateTime(v *time.Time) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetUpdateTime(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearUpdateTime clears the value of the "update_time" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) ClearUpdateTime() *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.ClearUpdateTime()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetDeleted(v bool) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableDeleted(v *bool) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetSuccessGet sets the "success_get" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetSuccessGet(v int) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.ResetSuccessGet()
|
||||
_u.mutation.SetSuccessGet(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableSuccessGet sets the "success_get" field if the given value is not nil.
|
||||
func (_u *FribbleHeroSetUpdateOne) SetNillableSuccessGet(v *int) *FribbleHeroSetUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetSuccessGet(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSuccessGet adds value to the "success_get" field.
|
||||
func (_u *FribbleHeroSetUpdateOne) AddSuccessGet(v int) *FribbleHeroSetUpdateOne {
|
||||
_u.mutation.AddSuccessGet(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the FribbleHeroSetMutation object of the builder.
|
||||
func (_u *FribbleHeroSetUpdateOne) Mutation() *FribbleHeroSetMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the FribbleHeroSetUpdate builder.
|
||||
func (_u *FribbleHeroSetUpdateOne) Where(ps ...predicate.FribbleHeroSet) *FribbleHeroSetUpdateOne {
|
||||
_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 (_u *FribbleHeroSetUpdateOne) Select(field string, fields ...string) *FribbleHeroSetUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated FribbleHeroSet entity.
|
||||
func (_u *FribbleHeroSetUpdateOne) Save(ctx context.Context) (*FribbleHeroSet, error) {
|
||||
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *FribbleHeroSetUpdateOne) SaveX(ctx context.Context) *FribbleHeroSet {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *FribbleHeroSetUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *FribbleHeroSetUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *FribbleHeroSetUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.HeroCode(); ok {
|
||||
if err := fribbleheroset.HeroCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_code", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.hero_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.JSONContent(); ok {
|
||||
if err := fribbleheroset.JSONContentValidator(v); err != nil {
|
||||
return &ValidationError{Name: "json_content", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.json_content": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.HeroName(); ok {
|
||||
if err := fribbleheroset.HeroNameValidator(v); err != nil {
|
||||
return &ValidationError{Name: "hero_name", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.hero_name": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Creator(); ok {
|
||||
if err := fribbleheroset.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Updater(); ok {
|
||||
if err := fribbleheroset.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "FribbleHeroSet.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *FribbleHeroSetUpdateOne) sqlSave(ctx context.Context) (_node *FribbleHeroSet, err error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := sqlgraph.NewUpdateSpec(fribbleheroset.Table, fribbleheroset.Columns, sqlgraph.NewFieldSpec(fribbleheroset.FieldID, field.TypeInt64))
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "FribbleHeroSet.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := _u.fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fribbleheroset.FieldID)
|
||||
for _, f := range fields {
|
||||
if !fribbleheroset.ValidColumn(f) {
|
||||
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
if f != fribbleheroset.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _u.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := _u.mutation.HeroCode(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldHeroCode, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.JSONContent(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldJSONContent, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.HeroName(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldHeroName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Creator(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldCreator, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.CreateTime(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldCreateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.CreateTimeCleared() {
|
||||
_spec.ClearField(fribbleheroset.FieldCreateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Updater(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldUpdater, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldUpdateTime, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.UpdateTimeCleared() {
|
||||
_spec.ClearField(fribbleheroset.FieldUpdateTime, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.SuccessGet(); ok {
|
||||
_spec.SetField(fribbleheroset.FieldSuccessGet, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedSuccessGet(); ok {
|
||||
_spec.AddField(fribbleheroset.FieldSuccessGet, field.TypeInt, value)
|
||||
}
|
||||
_node = &FribbleHeroSet{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{fribbleheroset.Label}
|
||||
} else if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
345
internal/ent/gearsetinfo.go
Normal file
345
internal/ent/gearsetinfo.go
Normal file
@@ -0,0 +1,345 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/gearsetinfo"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// GearSetInfo is the model entity for the GearSetInfo schema.
|
||||
type GearSetInfo struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// Level holds the value of the "level" field.
|
||||
Level int `json:"level,omitempty"`
|
||||
// GearID holds the value of the "gear_id" field.
|
||||
GearID int64 `json:"gear_id,omitempty"`
|
||||
// Enhance holds the value of the "enhance" field.
|
||||
Enhance int `json:"enhance,omitempty"`
|
||||
// GearType holds the value of the "gear_type" field.
|
||||
GearType string `json:"gear_type,omitempty"`
|
||||
// GearSetType holds the value of the "gear_set_type" field.
|
||||
GearSetType string `json:"gear_set_type,omitempty"`
|
||||
// MainStatType holds the value of the "main_stat_type" field.
|
||||
MainStatType string `json:"main_stat_type,omitempty"`
|
||||
// MainStatValue holds the value of the "main_stat_value" field.
|
||||
MainStatValue int `json:"main_stat_value,omitempty"`
|
||||
// SubStatOneType holds the value of the "sub_stat_one_type" field.
|
||||
SubStatOneType string `json:"sub_stat_one_type,omitempty"`
|
||||
// SubStatOneValue holds the value of the "sub_stat_one_value" field.
|
||||
SubStatOneValue int `json:"sub_stat_one_value,omitempty"`
|
||||
// SubStatTwoType holds the value of the "sub_stat_two_type" field.
|
||||
SubStatTwoType string `json:"sub_stat_two_type,omitempty"`
|
||||
// SubStatTwoValue holds the value of the "sub_stat_two_value" field.
|
||||
SubStatTwoValue int `json:"sub_stat_two_value,omitempty"`
|
||||
// SubStatThreeType holds the value of the "sub_stat_three_type" field.
|
||||
SubStatThreeType string `json:"sub_stat_three_type,omitempty"`
|
||||
// SubStatThreeValue holds the value of the "sub_stat_three_value" field.
|
||||
SubStatThreeValue int `json:"sub_stat_three_value,omitempty"`
|
||||
// SubStatFourType holds the value of the "sub_stat_four_type" field.
|
||||
SubStatFourType string `json:"sub_stat_four_type,omitempty"`
|
||||
// SubStatFourValue holds the value of the "sub_stat_four_value" field.
|
||||
SubStatFourValue int `json:"sub_stat_four_value,omitempty"`
|
||||
// AccountCode holds the value of the "account_code" field.
|
||||
AccountCode string `json:"account_code,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
// TenantID holds the value of the "tenant_id" field.
|
||||
TenantID int64 `json:"tenant_id,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*GearSetInfo) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case gearsetinfo.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case gearsetinfo.FieldID, gearsetinfo.FieldLevel, gearsetinfo.FieldGearID, gearsetinfo.FieldEnhance, gearsetinfo.FieldMainStatValue, gearsetinfo.FieldSubStatOneValue, gearsetinfo.FieldSubStatTwoValue, gearsetinfo.FieldSubStatThreeValue, gearsetinfo.FieldSubStatFourValue, gearsetinfo.FieldTenantID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case gearsetinfo.FieldGearType, gearsetinfo.FieldGearSetType, gearsetinfo.FieldMainStatType, gearsetinfo.FieldSubStatOneType, gearsetinfo.FieldSubStatTwoType, gearsetinfo.FieldSubStatThreeType, gearsetinfo.FieldSubStatFourType, gearsetinfo.FieldAccountCode, gearsetinfo.FieldCreator, gearsetinfo.FieldUpdater:
|
||||
values[i] = new(sql.NullString)
|
||||
case gearsetinfo.FieldCreateTime, gearsetinfo.FieldUpdateTime:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the GearSetInfo fields.
|
||||
func (_m *GearSetInfo) 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)
|
||||
}
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case gearsetinfo.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case gearsetinfo.FieldLevel:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field level", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Level = int(value.Int64)
|
||||
}
|
||||
case gearsetinfo.FieldGearID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field gear_id", values[i])
|
||||
} else if value.Valid {
|
||||
_m.GearID = value.Int64
|
||||
}
|
||||
case gearsetinfo.FieldEnhance:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field enhance", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Enhance = int(value.Int64)
|
||||
}
|
||||
case gearsetinfo.FieldGearType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field gear_type", values[i])
|
||||
} else if value.Valid {
|
||||
_m.GearType = value.String
|
||||
}
|
||||
case gearsetinfo.FieldGearSetType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field gear_set_type", values[i])
|
||||
} else if value.Valid {
|
||||
_m.GearSetType = value.String
|
||||
}
|
||||
case gearsetinfo.FieldMainStatType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field main_stat_type", values[i])
|
||||
} else if value.Valid {
|
||||
_m.MainStatType = value.String
|
||||
}
|
||||
case gearsetinfo.FieldMainStatValue:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field main_stat_value", values[i])
|
||||
} else if value.Valid {
|
||||
_m.MainStatValue = int(value.Int64)
|
||||
}
|
||||
case gearsetinfo.FieldSubStatOneType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_one_type", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatOneType = value.String
|
||||
}
|
||||
case gearsetinfo.FieldSubStatOneValue:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_one_value", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatOneValue = int(value.Int64)
|
||||
}
|
||||
case gearsetinfo.FieldSubStatTwoType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_two_type", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatTwoType = value.String
|
||||
}
|
||||
case gearsetinfo.FieldSubStatTwoValue:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_two_value", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatTwoValue = int(value.Int64)
|
||||
}
|
||||
case gearsetinfo.FieldSubStatThreeType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_three_type", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatThreeType = value.String
|
||||
}
|
||||
case gearsetinfo.FieldSubStatThreeValue:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_three_value", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatThreeValue = int(value.Int64)
|
||||
}
|
||||
case gearsetinfo.FieldSubStatFourType:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_four_type", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatFourType = value.String
|
||||
}
|
||||
case gearsetinfo.FieldSubStatFourValue:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field sub_stat_four_value", values[i])
|
||||
} else if value.Valid {
|
||||
_m.SubStatFourValue = int(value.Int64)
|
||||
}
|
||||
case gearsetinfo.FieldAccountCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field account_code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.AccountCode = value.String
|
||||
}
|
||||
case gearsetinfo.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case gearsetinfo.FieldCreateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case gearsetinfo.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case gearsetinfo.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case gearsetinfo.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
case gearsetinfo.FieldTenantID:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field tenant_id", values[i])
|
||||
} else if value.Valid {
|
||||
_m.TenantID = value.Int64
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the GearSetInfo.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *GearSetInfo) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this GearSetInfo.
|
||||
// Note that you need to call GearSetInfo.Unwrap() before calling this method if this GearSetInfo
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *GearSetInfo) Update() *GearSetInfoUpdateOne {
|
||||
return NewGearSetInfoClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the GearSetInfo 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 *GearSetInfo) Unwrap() *GearSetInfo {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: GearSetInfo is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *GearSetInfo) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("GearSetInfo(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("level=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Level))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("gear_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.GearID))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("enhance=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Enhance))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("gear_type=")
|
||||
builder.WriteString(_m.GearType)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("gear_set_type=")
|
||||
builder.WriteString(_m.GearSetType)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("main_stat_type=")
|
||||
builder.WriteString(_m.MainStatType)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("main_stat_value=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.MainStatValue))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_one_type=")
|
||||
builder.WriteString(_m.SubStatOneType)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_one_value=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.SubStatOneValue))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_two_type=")
|
||||
builder.WriteString(_m.SubStatTwoType)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_two_value=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.SubStatTwoValue))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_three_type=")
|
||||
builder.WriteString(_m.SubStatThreeType)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_three_value=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.SubStatThreeValue))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_four_type=")
|
||||
builder.WriteString(_m.SubStatFourType)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("sub_stat_four_value=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.SubStatFourValue))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("account_code=")
|
||||
builder.WriteString(_m.AccountCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("tenant_id=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.TenantID))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// GearSetInfos is a parsable slice of GearSetInfo.
|
||||
type GearSetInfos []*GearSetInfo
|
||||
238
internal/ent/gearsetinfo/gearsetinfo.go
Normal file
238
internal/ent/gearsetinfo/gearsetinfo.go
Normal file
@@ -0,0 +1,238 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package gearsetinfo
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the gearsetinfo type in the database.
|
||||
Label = "gear_set_info"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldLevel holds the string denoting the level field in the database.
|
||||
FieldLevel = "level"
|
||||
// FieldGearID holds the string denoting the gear_id field in the database.
|
||||
FieldGearID = "gear_id"
|
||||
// FieldEnhance holds the string denoting the enhance field in the database.
|
||||
FieldEnhance = "enhance"
|
||||
// FieldGearType holds the string denoting the gear_type field in the database.
|
||||
FieldGearType = "gear_type"
|
||||
// FieldGearSetType holds the string denoting the gear_set_type field in the database.
|
||||
FieldGearSetType = "gear_set_type"
|
||||
// FieldMainStatType holds the string denoting the main_stat_type field in the database.
|
||||
FieldMainStatType = "main_stat_type"
|
||||
// FieldMainStatValue holds the string denoting the main_stat_value field in the database.
|
||||
FieldMainStatValue = "main_stat_value"
|
||||
// FieldSubStatOneType holds the string denoting the sub_stat_one_type field in the database.
|
||||
FieldSubStatOneType = "sub_stat_one_type"
|
||||
// FieldSubStatOneValue holds the string denoting the sub_stat_one_value field in the database.
|
||||
FieldSubStatOneValue = "sub_stat_one_value"
|
||||
// FieldSubStatTwoType holds the string denoting the sub_stat_two_type field in the database.
|
||||
FieldSubStatTwoType = "sub_stat_two_type"
|
||||
// FieldSubStatTwoValue holds the string denoting the sub_stat_two_value field in the database.
|
||||
FieldSubStatTwoValue = "sub_stat_two_value"
|
||||
// FieldSubStatThreeType holds the string denoting the sub_stat_three_type field in the database.
|
||||
FieldSubStatThreeType = "sub_stat_three_type"
|
||||
// FieldSubStatThreeValue holds the string denoting the sub_stat_three_value field in the database.
|
||||
FieldSubStatThreeValue = "sub_stat_three_value"
|
||||
// FieldSubStatFourType holds the string denoting the sub_stat_four_type field in the database.
|
||||
FieldSubStatFourType = "sub_stat_four_type"
|
||||
// FieldSubStatFourValue holds the string denoting the sub_stat_four_value field in the database.
|
||||
FieldSubStatFourValue = "sub_stat_four_value"
|
||||
// FieldAccountCode holds the string denoting the account_code field in the database.
|
||||
FieldAccountCode = "account_code"
|
||||
// FieldCreator holds the string denoting the creator field in the database.
|
||||
FieldCreator = "creator"
|
||||
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||
FieldCreateTime = "create_time"
|
||||
// FieldUpdater holds the string denoting the updater field in the database.
|
||||
FieldUpdater = "updater"
|
||||
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
||||
FieldUpdateTime = "update_time"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
FieldDeleted = "deleted"
|
||||
// FieldTenantID holds the string denoting the tenant_id field in the database.
|
||||
FieldTenantID = "tenant_id"
|
||||
// Table holds the table name of the gearsetinfo in the database.
|
||||
Table = "gear_set_infos"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for gearsetinfo fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldLevel,
|
||||
FieldGearID,
|
||||
FieldEnhance,
|
||||
FieldGearType,
|
||||
FieldGearSetType,
|
||||
FieldMainStatType,
|
||||
FieldMainStatValue,
|
||||
FieldSubStatOneType,
|
||||
FieldSubStatOneValue,
|
||||
FieldSubStatTwoType,
|
||||
FieldSubStatTwoValue,
|
||||
FieldSubStatThreeType,
|
||||
FieldSubStatThreeValue,
|
||||
FieldSubStatFourType,
|
||||
FieldSubStatFourValue,
|
||||
FieldAccountCode,
|
||||
FieldCreator,
|
||||
FieldCreateTime,
|
||||
FieldUpdater,
|
||||
FieldUpdateTime,
|
||||
FieldDeleted,
|
||||
FieldTenantID,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// GearTypeValidator is a validator for the "gear_type" field. It is called by the builders before save.
|
||||
GearTypeValidator func(string) error
|
||||
// GearSetTypeValidator is a validator for the "gear_set_type" field. It is called by the builders before save.
|
||||
GearSetTypeValidator func(string) error
|
||||
// MainStatTypeValidator is a validator for the "main_stat_type" field. It is called by the builders before save.
|
||||
MainStatTypeValidator func(string) error
|
||||
// SubStatOneTypeValidator is a validator for the "sub_stat_one_type" field. It is called by the builders before save.
|
||||
SubStatOneTypeValidator func(string) error
|
||||
// SubStatTwoTypeValidator is a validator for the "sub_stat_two_type" field. It is called by the builders before save.
|
||||
SubStatTwoTypeValidator func(string) error
|
||||
// SubStatThreeTypeValidator is a validator for the "sub_stat_three_type" field. It is called by the builders before save.
|
||||
SubStatThreeTypeValidator func(string) error
|
||||
// SubStatFourTypeValidator is a validator for the "sub_stat_four_type" field. It is called by the builders before save.
|
||||
SubStatFourTypeValidator func(string) error
|
||||
// AccountCodeValidator is a validator for the "account_code" field. It is called by the builders before save.
|
||||
AccountCodeValidator func(string) error
|
||||
// CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
CreatorValidator func(string) error
|
||||
// UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
UpdaterValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the GearSetInfo queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLevel orders the results by the level field.
|
||||
func ByLevel(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLevel, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGearID orders the results by the gear_id field.
|
||||
func ByGearID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGearID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEnhance orders the results by the enhance field.
|
||||
func ByEnhance(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEnhance, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGearType orders the results by the gear_type field.
|
||||
func ByGearType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGearType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGearSetType orders the results by the gear_set_type field.
|
||||
func ByGearSetType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGearSetType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMainStatType orders the results by the main_stat_type field.
|
||||
func ByMainStatType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMainStatType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMainStatValue orders the results by the main_stat_value field.
|
||||
func ByMainStatValue(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMainStatValue, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatOneType orders the results by the sub_stat_one_type field.
|
||||
func BySubStatOneType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatOneType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatOneValue orders the results by the sub_stat_one_value field.
|
||||
func BySubStatOneValue(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatOneValue, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatTwoType orders the results by the sub_stat_two_type field.
|
||||
func BySubStatTwoType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatTwoType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatTwoValue orders the results by the sub_stat_two_value field.
|
||||
func BySubStatTwoValue(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatTwoValue, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatThreeType orders the results by the sub_stat_three_type field.
|
||||
func BySubStatThreeType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatThreeType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatThreeValue orders the results by the sub_stat_three_value field.
|
||||
func BySubStatThreeValue(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatThreeValue, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatFourType orders the results by the sub_stat_four_type field.
|
||||
func BySubStatFourType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatFourType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySubStatFourValue orders the results by the sub_stat_four_value field.
|
||||
func BySubStatFourValue(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSubStatFourValue, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAccountCode orders the results by the account_code field.
|
||||
func ByAccountCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAccountCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreator orders the results by the creator field.
|
||||
func ByCreator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreator, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreateTime orders the results by the create_time field.
|
||||
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdater orders the results by the updater field.
|
||||
func ByUpdater(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdater, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdateTime orders the results by the update_time field.
|
||||
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDeleted orders the results by the deleted field.
|
||||
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTenantID orders the results by the tenant_id field.
|
||||
func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTenantID, opts...).ToFunc()
|
||||
}
|
||||
1300
internal/ent/gearsetinfo/where.go
Normal file
1300
internal/ent/gearsetinfo/where.go
Normal file
File diff suppressed because it is too large
Load Diff
529
internal/ent/gearsetinfo_create.go
Normal file
529
internal/ent/gearsetinfo_create.go
Normal file
@@ -0,0 +1,529 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/gearsetinfo"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// GearSetInfoCreate is the builder for creating a GearSetInfo entity.
|
||||
type GearSetInfoCreate struct {
|
||||
config
|
||||
mutation *GearSetInfoMutation
|
||||
hooks []Hook
|
||||
}
|
||||
|
||||
// SetLevel sets the "level" field.
|
||||
func (_c *GearSetInfoCreate) SetLevel(v int) *GearSetInfoCreate {
|
||||
_c.mutation.SetLevel(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetGearID sets the "gear_id" field.
|
||||
func (_c *GearSetInfoCreate) SetGearID(v int64) *GearSetInfoCreate {
|
||||
_c.mutation.SetGearID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetEnhance sets the "enhance" field.
|
||||
func (_c *GearSetInfoCreate) SetEnhance(v int) *GearSetInfoCreate {
|
||||
_c.mutation.SetEnhance(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetGearType sets the "gear_type" field.
|
||||
func (_c *GearSetInfoCreate) SetGearType(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetGearType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetGearSetType sets the "gear_set_type" field.
|
||||
func (_c *GearSetInfoCreate) SetGearSetType(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetGearSetType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMainStatType sets the "main_stat_type" field.
|
||||
func (_c *GearSetInfoCreate) SetMainStatType(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetMainStatType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMainStatValue sets the "main_stat_value" field.
|
||||
func (_c *GearSetInfoCreate) SetMainStatValue(v int) *GearSetInfoCreate {
|
||||
_c.mutation.SetMainStatValue(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatOneType sets the "sub_stat_one_type" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatOneType(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatOneType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatOneValue sets the "sub_stat_one_value" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatOneValue(v int) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatOneValue(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatTwoType sets the "sub_stat_two_type" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatTwoType(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatTwoType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatTwoValue sets the "sub_stat_two_value" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatTwoValue(v int) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatTwoValue(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatThreeType sets the "sub_stat_three_type" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatThreeType(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatThreeType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatThreeValue sets the "sub_stat_three_value" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatThreeValue(v int) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatThreeValue(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatFourType sets the "sub_stat_four_type" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatFourType(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatFourType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetSubStatFourValue sets the "sub_stat_four_value" field.
|
||||
func (_c *GearSetInfoCreate) SetSubStatFourValue(v int) *GearSetInfoCreate {
|
||||
_c.mutation.SetSubStatFourValue(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAccountCode sets the "account_code" field.
|
||||
func (_c *GearSetInfoCreate) SetAccountCode(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetAccountCode(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreator sets the "creator" field.
|
||||
func (_c *GearSetInfoCreate) SetCreator(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetCreator(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreateTime sets the "create_time" field.
|
||||
func (_c *GearSetInfoCreate) SetCreateTime(v time.Time) *GearSetInfoCreate {
|
||||
_c.mutation.SetCreateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||
func (_c *GearSetInfoCreate) SetNillableCreateTime(v *time.Time) *GearSetInfoCreate {
|
||||
if v != nil {
|
||||
_c.SetCreateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdater sets the "updater" field.
|
||||
func (_c *GearSetInfoCreate) SetUpdater(v string) *GearSetInfoCreate {
|
||||
_c.mutation.SetUpdater(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetUpdateTime sets the "update_time" field.
|
||||
func (_c *GearSetInfoCreate) SetUpdateTime(v time.Time) *GearSetInfoCreate {
|
||||
_c.mutation.SetUpdateTime(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
||||
func (_c *GearSetInfoCreate) SetNillableUpdateTime(v *time.Time) *GearSetInfoCreate {
|
||||
if v != nil {
|
||||
_c.SetUpdateTime(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *GearSetInfoCreate) SetDeleted(v bool) *GearSetInfoCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetTenantID sets the "tenant_id" field.
|
||||
func (_c *GearSetInfoCreate) SetTenantID(v int64) *GearSetInfoCreate {
|
||||
_c.mutation.SetTenantID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *GearSetInfoCreate) SetID(v int64) *GearSetInfoCreate {
|
||||
_c.mutation.SetID(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Mutation returns the GearSetInfoMutation object of the builder.
|
||||
func (_c *GearSetInfoCreate) Mutation() *GearSetInfoMutation {
|
||||
return _c.mutation
|
||||
}
|
||||
|
||||
// Save creates the GearSetInfo in the database.
|
||||
func (_c *GearSetInfoCreate) Save(ctx context.Context) (*GearSetInfo, error) {
|
||||
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
func (_c *GearSetInfoCreate) SaveX(ctx context.Context) *GearSetInfo {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *GearSetInfoCreate) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *GearSetInfoCreate) 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 (_c *GearSetInfoCreate) check() error {
|
||||
if _, ok := _c.mutation.Level(); !ok {
|
||||
return &ValidationError{Name: "level", err: errors.New(`ent: missing required field "GearSetInfo.level"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.GearID(); !ok {
|
||||
return &ValidationError{Name: "gear_id", err: errors.New(`ent: missing required field "GearSetInfo.gear_id"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Enhance(); !ok {
|
||||
return &ValidationError{Name: "enhance", err: errors.New(`ent: missing required field "GearSetInfo.enhance"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.GearType(); !ok {
|
||||
return &ValidationError{Name: "gear_type", err: errors.New(`ent: missing required field "GearSetInfo.gear_type"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.GearType(); ok {
|
||||
if err := gearsetinfo.GearTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "gear_type", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.gear_type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.GearSetType(); !ok {
|
||||
return &ValidationError{Name: "gear_set_type", err: errors.New(`ent: missing required field "GearSetInfo.gear_set_type"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.GearSetType(); ok {
|
||||
if err := gearsetinfo.GearSetTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "gear_set_type", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.gear_set_type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.MainStatType(); !ok {
|
||||
return &ValidationError{Name: "main_stat_type", err: errors.New(`ent: missing required field "GearSetInfo.main_stat_type"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.MainStatType(); ok {
|
||||
if err := gearsetinfo.MainStatTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "main_stat_type", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.main_stat_type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.MainStatValue(); !ok {
|
||||
return &ValidationError{Name: "main_stat_value", err: errors.New(`ent: missing required field "GearSetInfo.main_stat_value"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatOneType(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_one_type", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_one_type"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.SubStatOneType(); ok {
|
||||
if err := gearsetinfo.SubStatOneTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "sub_stat_one_type", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.sub_stat_one_type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatOneValue(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_one_value", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_one_value"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatTwoType(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_two_type", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_two_type"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.SubStatTwoType(); ok {
|
||||
if err := gearsetinfo.SubStatTwoTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "sub_stat_two_type", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.sub_stat_two_type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatTwoValue(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_two_value", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_two_value"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatThreeType(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_three_type", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_three_type"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.SubStatThreeType(); ok {
|
||||
if err := gearsetinfo.SubStatThreeTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "sub_stat_three_type", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.sub_stat_three_type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatThreeValue(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_three_value", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_three_value"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatFourType(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_four_type", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_four_type"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.SubStatFourType(); ok {
|
||||
if err := gearsetinfo.SubStatFourTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "sub_stat_four_type", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.sub_stat_four_type": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.SubStatFourValue(); !ok {
|
||||
return &ValidationError{Name: "sub_stat_four_value", err: errors.New(`ent: missing required field "GearSetInfo.sub_stat_four_value"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.AccountCode(); !ok {
|
||||
return &ValidationError{Name: "account_code", err: errors.New(`ent: missing required field "GearSetInfo.account_code"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.AccountCode(); ok {
|
||||
if err := gearsetinfo.AccountCodeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "account_code", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.account_code": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Creator(); !ok {
|
||||
return &ValidationError{Name: "creator", err: errors.New(`ent: missing required field "GearSetInfo.creator"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Creator(); ok {
|
||||
if err := gearsetinfo.CreatorValidator(v); err != nil {
|
||||
return &ValidationError{Name: "creator", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.creator": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Updater(); !ok {
|
||||
return &ValidationError{Name: "updater", err: errors.New(`ent: missing required field "GearSetInfo.updater"`)}
|
||||
}
|
||||
if v, ok := _c.mutation.Updater(); ok {
|
||||
if err := gearsetinfo.UpdaterValidator(v); err != nil {
|
||||
return &ValidationError{Name: "updater", err: fmt.Errorf(`ent: validator failed for field "GearSetInfo.updater": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "GearSetInfo.deleted"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.TenantID(); !ok {
|
||||
return &ValidationError{Name: "tenant_id", err: errors.New(`ent: missing required field "GearSetInfo.tenant_id"`)}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_c *GearSetInfoCreate) sqlSave(ctx context.Context) (*GearSetInfo, error) {
|
||||
if err := _c.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := _c.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if _spec.ID.Value != _node.ID {
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int64(id)
|
||||
}
|
||||
_c.mutation.id = &_node.ID
|
||||
_c.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (_c *GearSetInfoCreate) createSpec() (*GearSetInfo, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &GearSetInfo{config: _c.config}
|
||||
_spec = sqlgraph.NewCreateSpec(gearsetinfo.Table, sqlgraph.NewFieldSpec(gearsetinfo.FieldID, field.TypeInt64))
|
||||
)
|
||||
if id, ok := _c.mutation.ID(); ok {
|
||||
_node.ID = id
|
||||
_spec.ID.Value = id
|
||||
}
|
||||
if value, ok := _c.mutation.Level(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldLevel, field.TypeInt, value)
|
||||
_node.Level = value
|
||||
}
|
||||
if value, ok := _c.mutation.GearID(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldGearID, field.TypeInt64, value)
|
||||
_node.GearID = value
|
||||
}
|
||||
if value, ok := _c.mutation.Enhance(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldEnhance, field.TypeInt, value)
|
||||
_node.Enhance = value
|
||||
}
|
||||
if value, ok := _c.mutation.GearType(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldGearType, field.TypeString, value)
|
||||
_node.GearType = value
|
||||
}
|
||||
if value, ok := _c.mutation.GearSetType(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldGearSetType, field.TypeString, value)
|
||||
_node.GearSetType = value
|
||||
}
|
||||
if value, ok := _c.mutation.MainStatType(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldMainStatType, field.TypeString, value)
|
||||
_node.MainStatType = value
|
||||
}
|
||||
if value, ok := _c.mutation.MainStatValue(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldMainStatValue, field.TypeInt, value)
|
||||
_node.MainStatValue = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatOneType(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatOneType, field.TypeString, value)
|
||||
_node.SubStatOneType = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatOneValue(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatOneValue, field.TypeInt, value)
|
||||
_node.SubStatOneValue = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatTwoType(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatTwoType, field.TypeString, value)
|
||||
_node.SubStatTwoType = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatTwoValue(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatTwoValue, field.TypeInt, value)
|
||||
_node.SubStatTwoValue = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatThreeType(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatThreeType, field.TypeString, value)
|
||||
_node.SubStatThreeType = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatThreeValue(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatThreeValue, field.TypeInt, value)
|
||||
_node.SubStatThreeValue = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatFourType(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatFourType, field.TypeString, value)
|
||||
_node.SubStatFourType = value
|
||||
}
|
||||
if value, ok := _c.mutation.SubStatFourValue(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldSubStatFourValue, field.TypeInt, value)
|
||||
_node.SubStatFourValue = value
|
||||
}
|
||||
if value, ok := _c.mutation.AccountCode(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldAccountCode, field.TypeString, value)
|
||||
_node.AccountCode = value
|
||||
}
|
||||
if value, ok := _c.mutation.Creator(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldCreator, field.TypeString, value)
|
||||
_node.Creator = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreateTime(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldCreateTime, field.TypeTime, value)
|
||||
_node.CreateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Updater(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldUpdater, field.TypeString, value)
|
||||
_node.Updater = value
|
||||
}
|
||||
if value, ok := _c.mutation.UpdateTime(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldUpdateTime, field.TypeTime, value)
|
||||
_node.UpdateTime = &value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
if value, ok := _c.mutation.TenantID(); ok {
|
||||
_spec.SetField(gearsetinfo.FieldTenantID, field.TypeInt64, value)
|
||||
_node.TenantID = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
// GearSetInfoCreateBulk is the builder for creating many GearSetInfo entities in bulk.
|
||||
type GearSetInfoCreateBulk struct {
|
||||
config
|
||||
err error
|
||||
builders []*GearSetInfoCreate
|
||||
}
|
||||
|
||||
// Save creates the GearSetInfo entities in the database.
|
||||
func (_c *GearSetInfoCreateBulk) Save(ctx context.Context) ([]*GearSetInfo, error) {
|
||||
if _c.err != nil {
|
||||
return nil, _c.err
|
||||
}
|
||||
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||||
nodes := make([]*GearSetInfo, len(_c.builders))
|
||||
mutators := make([]Mutator, len(_c.builders))
|
||||
for i := range _c.builders {
|
||||
func(i int, root context.Context) {
|
||||
builder := _c.builders[i]
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*GearSetInfoMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err := builder.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder.mutation = mutation
|
||||
var err error
|
||||
nodes[i], specs[i] = builder.createSpec()
|
||||
if i < len(mutators)-1 {
|
||||
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
||||
} else {
|
||||
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||
// Invoke the actual operation on the latest mutation in the chain.
|
||||
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &nodes[i].ID
|
||||
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||
id := specs[i].ID.Value.(int64)
|
||||
nodes[i].ID = int64(id)
|
||||
}
|
||||
mutation.done = true
|
||||
return nodes[i], nil
|
||||
})
|
||||
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||
mut = builder.hooks[i](mut)
|
||||
}
|
||||
mutators[i] = mut
|
||||
}(i, ctx)
|
||||
}
|
||||
if len(mutators) > 0 {
|
||||
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_c *GearSetInfoCreateBulk) SaveX(ctx context.Context) []*GearSetInfo {
|
||||
v, err := _c.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_c *GearSetInfoCreateBulk) Exec(ctx context.Context) error {
|
||||
_, err := _c.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_c *GearSetInfoCreateBulk) ExecX(ctx context.Context) {
|
||||
if err := _c.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
88
internal/ent/gearsetinfo_delete.go
Normal file
88
internal/ent/gearsetinfo_delete.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/gearsetinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// GearSetInfoDelete is the builder for deleting a GearSetInfo entity.
|
||||
type GearSetInfoDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *GearSetInfoMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the GearSetInfoDelete builder.
|
||||
func (_d *GearSetInfoDelete) Where(ps ...predicate.GearSetInfo) *GearSetInfoDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *GearSetInfoDelete) 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 (_d *GearSetInfoDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *GearSetInfoDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(gearsetinfo.Table, sqlgraph.NewFieldSpec(gearsetinfo.FieldID, field.TypeInt64))
|
||||
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, _d.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
_d.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// GearSetInfoDeleteOne is the builder for deleting a single GearSetInfo entity.
|
||||
type GearSetInfoDeleteOne struct {
|
||||
_d *GearSetInfoDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the GearSetInfoDelete builder.
|
||||
func (_d *GearSetInfoDeleteOne) Where(ps ...predicate.GearSetInfo) *GearSetInfoDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *GearSetInfoDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{gearsetinfo.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *GearSetInfoDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
527
internal/ent/gearsetinfo_query.go
Normal file
527
internal/ent/gearsetinfo_query.go
Normal file
@@ -0,0 +1,527 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent/gearsetinfo"
|
||||
"epic-ent/internal/ent/predicate"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// GearSetInfoQuery is the builder for querying GearSetInfo entities.
|
||||
type GearSetInfoQuery struct {
|
||||
config
|
||||
ctx *QueryContext
|
||||
order []gearsetinfo.OrderOption
|
||||
inters []Interceptor
|
||||
predicates []predicate.GearSetInfo
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
}
|
||||
|
||||
// Where adds a new predicate for the GearSetInfoQuery builder.
|
||||
func (_q *GearSetInfoQuery) Where(ps ...predicate.GearSetInfo) *GearSetInfoQuery {
|
||||
_q.predicates = append(_q.predicates, ps...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// Limit the number of records to be returned by this query.
|
||||
func (_q *GearSetInfoQuery) Limit(limit int) *GearSetInfoQuery {
|
||||
_q.ctx.Limit = &limit
|
||||
return _q
|
||||
}
|
||||
|
||||
// Offset to start from.
|
||||
func (_q *GearSetInfoQuery) Offset(offset int) *GearSetInfoQuery {
|
||||
_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 (_q *GearSetInfoQuery) Unique(unique bool) *GearSetInfoQuery {
|
||||
_q.ctx.Unique = &unique
|
||||
return _q
|
||||
}
|
||||
|
||||
// Order specifies how the records should be ordered.
|
||||
func (_q *GearSetInfoQuery) Order(o ...gearsetinfo.OrderOption) *GearSetInfoQuery {
|
||||
_q.order = append(_q.order, o...)
|
||||
return _q
|
||||
}
|
||||
|
||||
// First returns the first GearSetInfo entity from the query.
|
||||
// Returns a *NotFoundError when no GearSetInfo was found.
|
||||
func (_q *GearSetInfoQuery) First(ctx context.Context) (*GearSetInfo, error) {
|
||||
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nil, &NotFoundError{gearsetinfo.Label}
|
||||
}
|
||||
return nodes[0], nil
|
||||
}
|
||||
|
||||
// FirstX is like First, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) FirstX(ctx context.Context) *GearSetInfo {
|
||||
node, err := _q.First(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// FirstID returns the first GearSetInfo ID from the query.
|
||||
// Returns a *NotFoundError when no GearSetInfo ID was found.
|
||||
func (_q *GearSetInfoQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
|
||||
return
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
err = &NotFoundError{gearsetinfo.Label}
|
||||
return
|
||||
}
|
||||
return ids[0], nil
|
||||
}
|
||||
|
||||
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) FirstIDX(ctx context.Context) int64 {
|
||||
id, err := _q.FirstID(ctx)
|
||||
if err != nil && !IsNotFound(err) {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// Only returns a single GearSetInfo entity found by the query, ensuring it only returns one.
|
||||
// Returns a *NotSingularError when more than one GearSetInfo entity is found.
|
||||
// Returns a *NotFoundError when no GearSetInfo entities are found.
|
||||
func (_q *GearSetInfoQuery) Only(ctx context.Context) (*GearSetInfo, error) {
|
||||
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch len(nodes) {
|
||||
case 1:
|
||||
return nodes[0], nil
|
||||
case 0:
|
||||
return nil, &NotFoundError{gearsetinfo.Label}
|
||||
default:
|
||||
return nil, &NotSingularError{gearsetinfo.Label}
|
||||
}
|
||||
}
|
||||
|
||||
// OnlyX is like Only, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) OnlyX(ctx context.Context) *GearSetInfo {
|
||||
node, err := _q.Only(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// OnlyID is like Only, but returns the only GearSetInfo ID in the query.
|
||||
// Returns a *NotSingularError when more than one GearSetInfo ID is found.
|
||||
// Returns a *NotFoundError when no entities are found.
|
||||
func (_q *GearSetInfoQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||
var ids []int64
|
||||
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||
return
|
||||
}
|
||||
switch len(ids) {
|
||||
case 1:
|
||||
id = ids[0]
|
||||
case 0:
|
||||
err = &NotFoundError{gearsetinfo.Label}
|
||||
default:
|
||||
err = &NotSingularError{gearsetinfo.Label}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) OnlyIDX(ctx context.Context) int64 {
|
||||
id, err := _q.OnlyID(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// All executes the query and returns a list of GearSetInfos.
|
||||
func (_q *GearSetInfoQuery) All(ctx context.Context) ([]*GearSetInfo, error) {
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
|
||||
if err := _q.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qr := querierAll[[]*GearSetInfo, *GearSetInfoQuery]()
|
||||
return withInterceptors[[]*GearSetInfo](ctx, _q, qr, _q.inters)
|
||||
}
|
||||
|
||||
// AllX is like All, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) AllX(ctx context.Context) []*GearSetInfo {
|
||||
nodes, err := _q.All(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return nodes
|
||||
}
|
||||
|
||||
// IDs executes the query and returns a list of GearSetInfo IDs.
|
||||
func (_q *GearSetInfoQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||
if _q.ctx.Unique == nil && _q.path != nil {
|
||||
_q.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
|
||||
if err = _q.Select(gearsetinfo.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
// IDsX is like IDs, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) IDsX(ctx context.Context) []int64 {
|
||||
ids, err := _q.IDs(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Count returns the count of the given query.
|
||||
func (_q *GearSetInfoQuery) 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, _q, querierCount[*GearSetInfoQuery](), _q.inters)
|
||||
}
|
||||
|
||||
// CountX is like Count, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) CountX(ctx context.Context) int {
|
||||
count, err := _q.Count(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
// Exist returns true if the query has elements in the graph.
|
||||
func (_q *GearSetInfoQuery) 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:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExistX is like Exist, but panics if an error occurs.
|
||||
func (_q *GearSetInfoQuery) ExistX(ctx context.Context) bool {
|
||||
exist, err := _q.Exist(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// Clone returns a duplicate of the GearSetInfoQuery builder, including all associated steps. It can be
|
||||
// used to prepare common query builders and use them differently after the clone is made.
|
||||
func (_q *GearSetInfoQuery) Clone() *GearSetInfoQuery {
|
||||
if _q == nil {
|
||||
return nil
|
||||
}
|
||||
return &GearSetInfoQuery{
|
||||
config: _q.config,
|
||||
ctx: _q.ctx.Clone(),
|
||||
order: append([]gearsetinfo.OrderOption{}, _q.order...),
|
||||
inters: append([]Interceptor{}, _q.inters...),
|
||||
predicates: append([]predicate.GearSetInfo{}, _q.predicates...),
|
||||
// clone intermediate query.
|
||||
sql: _q.sql.Clone(),
|
||||
path: _q.path,
|
||||
}
|
||||
}
|
||||
|
||||
// GroupBy is used to group vertices by one or more fields/columns.
|
||||
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// Level int `json:"level,omitempty"`
|
||||
// Count int `json:"count,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.GearSetInfo.Query().
|
||||
// GroupBy(gearsetinfo.FieldLevel).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *GearSetInfoQuery) GroupBy(field string, fields ...string) *GearSetInfoGroupBy {
|
||||
_q.ctx.Fields = append([]string{field}, fields...)
|
||||
grbuild := &GearSetInfoGroupBy{build: _q}
|
||||
grbuild.flds = &_q.ctx.Fields
|
||||
grbuild.label = gearsetinfo.Label
|
||||
grbuild.scan = grbuild.Scan
|
||||
return grbuild
|
||||
}
|
||||
|
||||
// Select allows the selection one or more fields/columns for the given query,
|
||||
// instead of selecting all fields in the entity.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var v []struct {
|
||||
// Level int `json:"level,omitempty"`
|
||||
// }
|
||||
//
|
||||
// client.GearSetInfo.Query().
|
||||
// Select(gearsetinfo.FieldLevel).
|
||||
// Scan(ctx, &v)
|
||||
func (_q *GearSetInfoQuery) Select(fields ...string) *GearSetInfoSelect {
|
||||
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
|
||||
sbuild := &GearSetInfoSelect{GearSetInfoQuery: _q}
|
||||
sbuild.label = gearsetinfo.Label
|
||||
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
|
||||
return sbuild
|
||||
}
|
||||
|
||||
// Aggregate returns a GearSetInfoSelect configured with the given aggregations.
|
||||
func (_q *GearSetInfoQuery) Aggregate(fns ...AggregateFunc) *GearSetInfoSelect {
|
||||
return _q.Select().Aggregate(fns...)
|
||||
}
|
||||
|
||||
func (_q *GearSetInfoQuery) 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, _q); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range _q.ctx.Fields {
|
||||
if !gearsetinfo.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||
}
|
||||
}
|
||||
if _q.path != nil {
|
||||
prev, err := _q.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_q.sql = prev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_q *GearSetInfoQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*GearSetInfo, error) {
|
||||
var (
|
||||
nodes = []*GearSetInfo{}
|
||||
_spec = _q.querySpec()
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*GearSetInfo).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &GearSetInfo{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, _q.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
return nodes, nil
|
||||
}
|
||||
|
||||
func (_q *GearSetInfoQuery) 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, _q.driver, _spec)
|
||||
}
|
||||
|
||||
func (_q *GearSetInfoQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := sqlgraph.NewQuerySpec(gearsetinfo.Table, gearsetinfo.Columns, sqlgraph.NewFieldSpec(gearsetinfo.FieldID, field.TypeInt64))
|
||||
_spec.From = _q.sql
|
||||
if unique := _q.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if _q.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := _q.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, gearsetinfo.FieldID)
|
||||
for i := range fields {
|
||||
if fields[i] != gearsetinfo.FieldID {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
if ps := _q.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
if limit := _q.ctx.Limit; limit != nil {
|
||||
_spec.Limit = *limit
|
||||
}
|
||||
if offset := _q.ctx.Offset; offset != nil {
|
||||
_spec.Offset = *offset
|
||||
}
|
||||
if ps := _q.order; len(ps) > 0 {
|
||||
_spec.Order = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (_q *GearSetInfoQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(_q.driver.Dialect())
|
||||
t1 := builder.Table(gearsetinfo.Table)
|
||||
columns := _q.ctx.Fields
|
||||
if len(columns) == 0 {
|
||||
columns = gearsetinfo.Columns
|
||||
}
|
||||
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||
if _q.sql != nil {
|
||||
selector = _q.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if _q.ctx.Unique != nil && *_q.ctx.Unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, p := range _q.predicates {
|
||||
p(selector)
|
||||
}
|
||||
for _, p := range _q.order {
|
||||
p(selector)
|
||||
}
|
||||
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 := _q.ctx.Limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
return selector
|
||||
}
|
||||
|
||||
// GearSetInfoGroupBy is the group-by builder for GearSetInfo entities.
|
||||
type GearSetInfoGroupBy struct {
|
||||
selector
|
||||
build *GearSetInfoQuery
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the group-by query.
|
||||
func (_g *GearSetInfoGroupBy) Aggregate(fns ...AggregateFunc) *GearSetInfoGroupBy {
|
||||
_g.fns = append(_g.fns, fns...)
|
||||
return _g
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_g *GearSetInfoGroupBy) 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[*GearSetInfoQuery, *GearSetInfoGroupBy](ctx, _g.build, _g, _g.build.inters, v)
|
||||
}
|
||||
|
||||
func (_g *GearSetInfoGroupBy) sqlScan(ctx context.Context, root *GearSetInfoQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx).Select()
|
||||
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(*_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(*_g.flds...)...)
|
||||
if err := selector.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// GearSetInfoSelect is the builder for selecting fields of GearSetInfo entities.
|
||||
type GearSetInfoSelect struct {
|
||||
*GearSetInfoQuery
|
||||
selector
|
||||
}
|
||||
|
||||
// Aggregate adds the given aggregation functions to the selector query.
|
||||
func (_s *GearSetInfoSelect) Aggregate(fns ...AggregateFunc) *GearSetInfoSelect {
|
||||
_s.fns = append(_s.fns, fns...)
|
||||
return _s
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (_s *GearSetInfoSelect) 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[*GearSetInfoQuery, *GearSetInfoSelect](ctx, _s.GearSetInfoQuery, _s, _s.inters, v)
|
||||
}
|
||||
|
||||
func (_s *GearSetInfoSelect) sqlScan(ctx context.Context, root *GearSetInfoQuery, v any) error {
|
||||
selector := root.sqlQuery(ctx)
|
||||
aggregation := make([]string, 0, len(_s.fns))
|
||||
for _, fn := range _s.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
switch n := len(*_s.selector.flds); {
|
||||
case n == 0 && len(aggregation) > 0:
|
||||
selector.Select(aggregation...)
|
||||
case n != 0 && len(aggregation) > 0:
|
||||
selector.AppendSelect(aggregation...)
|
||||
}
|
||||
rows := &sql.Rows{}
|
||||
query, args := selector.Query()
|
||||
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
1256
internal/ent/gearsetinfo_update.go
Normal file
1256
internal/ent/gearsetinfo_update.go
Normal file
File diff suppressed because it is too large
Load Diff
294
internal/ent/hook/hook.go
Normal file
294
internal/ent/hook/hook.go
Normal file
@@ -0,0 +1,294 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package hook
|
||||
|
||||
import (
|
||||
"context"
|
||||
"epic-ent/internal/ent"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// The EpicArtifactInfoFunc type is an adapter to allow the use of ordinary
|
||||
// function as EpicArtifactInfo mutator.
|
||||
type EpicArtifactInfoFunc func(context.Context, *ent.EpicArtifactInfoMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f EpicArtifactInfoFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.EpicArtifactInfoMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EpicArtifactInfoMutation", m)
|
||||
}
|
||||
|
||||
// The EpicGvgAttackTeamsFunc type is an adapter to allow the use of ordinary
|
||||
// function as EpicGvgAttackTeams mutator.
|
||||
type EpicGvgAttackTeamsFunc func(context.Context, *ent.EpicGvgAttackTeamsMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f EpicGvgAttackTeamsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.EpicGvgAttackTeamsMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EpicGvgAttackTeamsMutation", m)
|
||||
}
|
||||
|
||||
// The EpicGvgDefenseAttackMappingFunc type is an adapter to allow the use of ordinary
|
||||
// function as EpicGvgDefenseAttackMapping mutator.
|
||||
type EpicGvgDefenseAttackMappingFunc func(context.Context, *ent.EpicGvgDefenseAttackMappingMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f EpicGvgDefenseAttackMappingFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.EpicGvgDefenseAttackMappingMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EpicGvgDefenseAttackMappingMutation", m)
|
||||
}
|
||||
|
||||
// The EpicGvgDefenseTeamsFunc type is an adapter to allow the use of ordinary
|
||||
// function as EpicGvgDefenseTeams mutator.
|
||||
type EpicGvgDefenseTeamsFunc func(context.Context, *ent.EpicGvgDefenseTeamsMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f EpicGvgDefenseTeamsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.EpicGvgDefenseTeamsMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EpicGvgDefenseTeamsMutation", m)
|
||||
}
|
||||
|
||||
// The EpicHeroInfoFunc type is an adapter to allow the use of ordinary
|
||||
// function as EpicHeroInfo mutator.
|
||||
type EpicHeroInfoFunc func(context.Context, *ent.EpicHeroInfoMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f EpicHeroInfoFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.EpicHeroInfoMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EpicHeroInfoMutation", m)
|
||||
}
|
||||
|
||||
// The EpicHeroUserBuildFunc type is an adapter to allow the use of ordinary
|
||||
// function as EpicHeroUserBuild mutator.
|
||||
type EpicHeroUserBuildFunc func(context.Context, *ent.EpicHeroUserBuildMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f EpicHeroUserBuildFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.EpicHeroUserBuildMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EpicHeroUserBuildMutation", m)
|
||||
}
|
||||
|
||||
// The EpicI18NMappingsFunc type is an adapter to allow the use of ordinary
|
||||
// function as EpicI18NMappings mutator.
|
||||
type EpicI18NMappingsFunc func(context.Context, *ent.EpicI18NMappingsMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f EpicI18NMappingsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.EpicI18NMappingsMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EpicI18NMappingsMutation", m)
|
||||
}
|
||||
|
||||
// The FribbleHeroSetFunc type is an adapter to allow the use of ordinary
|
||||
// function as FribbleHeroSet mutator.
|
||||
type FribbleHeroSetFunc func(context.Context, *ent.FribbleHeroSetMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f FribbleHeroSetFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.FribbleHeroSetMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.FribbleHeroSetMutation", m)
|
||||
}
|
||||
|
||||
// The GearSetInfoFunc type is an adapter to allow the use of ordinary
|
||||
// function as GearSetInfo mutator.
|
||||
type GearSetInfoFunc func(context.Context, *ent.GearSetInfoMutation) (ent.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f GearSetInfoFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if mv, ok := m.(*ent.GearSetInfoMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.GearSetInfoMutation", m)
|
||||
}
|
||||
|
||||
// Condition is a hook condition function.
|
||||
type Condition func(context.Context, ent.Mutation) bool
|
||||
|
||||
// And groups conditions with the AND operator.
|
||||
func And(first, second Condition, rest ...Condition) Condition {
|
||||
return func(ctx context.Context, m ent.Mutation) bool {
|
||||
if !first(ctx, m) || !second(ctx, m) {
|
||||
return false
|
||||
}
|
||||
for _, cond := range rest {
|
||||
if !cond(ctx, m) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Or groups conditions with the OR operator.
|
||||
func Or(first, second Condition, rest ...Condition) Condition {
|
||||
return func(ctx context.Context, m ent.Mutation) bool {
|
||||
if first(ctx, m) || second(ctx, m) {
|
||||
return true
|
||||
}
|
||||
for _, cond := range rest {
|
||||
if cond(ctx, m) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Not negates a given condition.
|
||||
func Not(cond Condition) Condition {
|
||||
return func(ctx context.Context, m ent.Mutation) bool {
|
||||
return !cond(ctx, m)
|
||||
}
|
||||
}
|
||||
|
||||
// HasOp is a condition testing mutation operation.
|
||||
func HasOp(op ent.Op) Condition {
|
||||
return func(_ context.Context, m ent.Mutation) bool {
|
||||
return m.Op().Is(op)
|
||||
}
|
||||
}
|
||||
|
||||
// HasAddedFields is a condition validating `.AddedField` on fields.
|
||||
func HasAddedFields(field string, fields ...string) Condition {
|
||||
return func(_ context.Context, m ent.Mutation) bool {
|
||||
if _, exists := m.AddedField(field); !exists {
|
||||
return false
|
||||
}
|
||||
for _, field := range fields {
|
||||
if _, exists := m.AddedField(field); !exists {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// HasClearedFields is a condition validating `.FieldCleared` on fields.
|
||||
func HasClearedFields(field string, fields ...string) Condition {
|
||||
return func(_ context.Context, m ent.Mutation) bool {
|
||||
if exists := m.FieldCleared(field); !exists {
|
||||
return false
|
||||
}
|
||||
for _, field := range fields {
|
||||
if exists := m.FieldCleared(field); !exists {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// HasFields is a condition validating `.Field` on fields.
|
||||
func HasFields(field string, fields ...string) Condition {
|
||||
return func(_ context.Context, m ent.Mutation) bool {
|
||||
if _, exists := m.Field(field); !exists {
|
||||
return false
|
||||
}
|
||||
for _, field := range fields {
|
||||
if _, exists := m.Field(field); !exists {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// If executes the given hook under condition.
|
||||
//
|
||||
// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))
|
||||
func If(hk ent.Hook, cond Condition) ent.Hook {
|
||||
return func(next ent.Mutator) ent.Mutator {
|
||||
return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
if cond(ctx, m) {
|
||||
return hk(next).Mutate(ctx, m)
|
||||
}
|
||||
return next.Mutate(ctx, m)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// On executes the given hook only for the given operation.
|
||||
//
|
||||
// hook.On(Log, ent.Delete|ent.Create)
|
||||
func On(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, HasOp(op))
|
||||
}
|
||||
|
||||
// Unless skips the given hook only for the given operation.
|
||||
//
|
||||
// hook.Unless(Log, ent.Update|ent.UpdateOne)
|
||||
func Unless(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, Not(HasOp(op)))
|
||||
}
|
||||
|
||||
// FixedError is a hook returning a fixed error.
|
||||
func FixedError(err error) ent.Hook {
|
||||
return func(ent.Mutator) ent.Mutator {
|
||||
return ent.MutateFunc(func(context.Context, ent.Mutation) (ent.Value, error) {
|
||||
return nil, err
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Reject returns a hook that rejects all operations that match op.
|
||||
//
|
||||
// func (T) Hooks() []ent.Hook {
|
||||
// return []ent.Hook{
|
||||
// Reject(ent.Delete|ent.Update),
|
||||
// }
|
||||
// }
|
||||
func Reject(op ent.Op) ent.Hook {
|
||||
hk := FixedError(fmt.Errorf("%s operation is not allowed", op))
|
||||
return On(hk, op)
|
||||
}
|
||||
|
||||
// Chain acts as a list of hooks and is effectively immutable.
|
||||
// Once created, it will always hold the same set of hooks in the same order.
|
||||
type Chain struct {
|
||||
hooks []ent.Hook
|
||||
}
|
||||
|
||||
// NewChain creates a new chain of hooks.
|
||||
func NewChain(hooks ...ent.Hook) Chain {
|
||||
return Chain{append([]ent.Hook(nil), hooks...)}
|
||||
}
|
||||
|
||||
// Hook chains the list of hooks and returns the final hook.
|
||||
func (c Chain) Hook() ent.Hook {
|
||||
return func(mutator ent.Mutator) ent.Mutator {
|
||||
for i := len(c.hooks) - 1; i >= 0; i-- {
|
||||
mutator = c.hooks[i](mutator)
|
||||
}
|
||||
return mutator
|
||||
}
|
||||
}
|
||||
|
||||
// Append extends a chain, adding the specified hook
|
||||
// as the last ones in the mutation flow.
|
||||
func (c Chain) Append(hooks ...ent.Hook) Chain {
|
||||
newHooks := make([]ent.Hook, 0, len(c.hooks)+len(hooks))
|
||||
newHooks = append(newHooks, c.hooks...)
|
||||
newHooks = append(newHooks, hooks...)
|
||||
return Chain{newHooks}
|
||||
}
|
||||
|
||||
// Extend extends a chain, adding the specified chain
|
||||
// as the last ones in the mutation flow.
|
||||
func (c Chain) Extend(chain Chain) Chain {
|
||||
return c.Append(chain.hooks...)
|
||||
}
|
||||
64
internal/ent/migrate/migrate.go
Normal file
64
internal/ent/migrate/migrate.go
Normal file
@@ -0,0 +1,64 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
)
|
||||
|
||||
var (
|
||||
// WithGlobalUniqueID sets the universal ids options to the migration.
|
||||
// If this option is enabled, ent migration will allocate a 1<<32 range
|
||||
// for the ids of each entity (table).
|
||||
// Note that this option cannot be applied on tables that already exist.
|
||||
WithGlobalUniqueID = schema.WithGlobalUniqueID
|
||||
// WithDropColumn sets the drop column option to the migration.
|
||||
// If this option is enabled, ent migration will drop old columns
|
||||
// that were used for both fields and edges. This defaults to false.
|
||||
WithDropColumn = schema.WithDropColumn
|
||||
// WithDropIndex sets the drop index option to the migration.
|
||||
// If this option is enabled, ent migration will drop old indexes
|
||||
// that were defined in the schema. This defaults to false.
|
||||
// Note that unique constraints are defined using `UNIQUE INDEX`,
|
||||
// and therefore, it's recommended to enable this option to get more
|
||||
// flexibility in the schema changes.
|
||||
WithDropIndex = schema.WithDropIndex
|
||||
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
|
||||
WithForeignKeys = schema.WithForeignKeys
|
||||
)
|
||||
|
||||
// Schema is the API for creating, migrating and dropping a schema.
|
||||
type Schema struct {
|
||||
drv dialect.Driver
|
||||
}
|
||||
|
||||
// NewSchema creates a new schema client.
|
||||
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
|
||||
|
||||
// Create creates all schema resources.
|
||||
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
|
||||
return Create(ctx, s, Tables, opts...)
|
||||
}
|
||||
|
||||
// Create creates all table resources using the given schema driver.
|
||||
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
|
||||
migrate, err := schema.NewMigrate(s.drv, opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ent/migrate: %w", err)
|
||||
}
|
||||
return migrate.Create(ctx, tables...)
|
||||
}
|
||||
|
||||
// WriteTo writes the schema changes to w instead of running them against the database.
|
||||
//
|
||||
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
|
||||
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
|
||||
}
|
||||
224
internal/ent/migrate/schema.go
Normal file
224
internal/ent/migrate/schema.go
Normal file
@@ -0,0 +1,224 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
var (
|
||||
// EpicArtifactInfosColumns holds the columns for the "epic_artifact_infos" table.
|
||||
EpicArtifactInfosColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "artifact_name", Type: field.TypeString, Size: 255},
|
||||
{Name: "artifact_code", Type: field.TypeString, Size: 255},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
{Name: "stats_health", Type: field.TypeInt},
|
||||
{Name: "stats_attack", Type: field.TypeInt},
|
||||
{Name: "stats_defense", Type: field.TypeInt},
|
||||
{Name: "rarity", Type: field.TypeString, Size: 255},
|
||||
{Name: "role", Type: field.TypeString, Size: 255},
|
||||
{Name: "artifact_name_en", Type: field.TypeString, Size: 255},
|
||||
{Name: "image_url", Type: field.TypeString, Size: 255},
|
||||
}
|
||||
// EpicArtifactInfosTable holds the schema information for the "epic_artifact_infos" table.
|
||||
EpicArtifactInfosTable = &schema.Table{
|
||||
Name: "epic_artifact_infos",
|
||||
Columns: EpicArtifactInfosColumns,
|
||||
PrimaryKey: []*schema.Column{EpicArtifactInfosColumns[0]},
|
||||
}
|
||||
// EpicGvgAttackTeamsColumns holds the columns for the "epic_gvg_attack_teams" table.
|
||||
EpicGvgAttackTeamsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "attack_heroes", Type: field.TypeString, Size: 255},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
}
|
||||
// EpicGvgAttackTeamsTable holds the schema information for the "epic_gvg_attack_teams" table.
|
||||
EpicGvgAttackTeamsTable = &schema.Table{
|
||||
Name: "epic_gvg_attack_teams",
|
||||
Columns: EpicGvgAttackTeamsColumns,
|
||||
PrimaryKey: []*schema.Column{EpicGvgAttackTeamsColumns[0]},
|
||||
}
|
||||
// EpicGvgDefenseAttackMappingsColumns holds the columns for the "epic_gvg_defense_attack_mappings" table.
|
||||
EpicGvgDefenseAttackMappingsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "defense_id", Type: field.TypeInt64},
|
||||
{Name: "attack_id", Type: field.TypeInt64},
|
||||
{Name: "equipment_info", Type: field.TypeString, Size: 255},
|
||||
{Name: "artifacts", Type: field.TypeString, Size: 255},
|
||||
{Name: "battle_strategy", Type: field.TypeString, Size: 255},
|
||||
{Name: "prerequisites", Type: field.TypeString, Size: 255},
|
||||
{Name: "important_notes", Type: field.TypeString, Size: 255},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
}
|
||||
// EpicGvgDefenseAttackMappingsTable holds the schema information for the "epic_gvg_defense_attack_mappings" table.
|
||||
EpicGvgDefenseAttackMappingsTable = &schema.Table{
|
||||
Name: "epic_gvg_defense_attack_mappings",
|
||||
Columns: EpicGvgDefenseAttackMappingsColumns,
|
||||
PrimaryKey: []*schema.Column{EpicGvgDefenseAttackMappingsColumns[0]},
|
||||
}
|
||||
// EpicGvgDefenseTeamsColumns holds the columns for the "epic_gvg_defense_teams" table.
|
||||
EpicGvgDefenseTeamsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "defense_heroes", Type: field.TypeString, Size: 255},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
}
|
||||
// EpicGvgDefenseTeamsTable holds the schema information for the "epic_gvg_defense_teams" table.
|
||||
EpicGvgDefenseTeamsTable = &schema.Table{
|
||||
Name: "epic_gvg_defense_teams",
|
||||
Columns: EpicGvgDefenseTeamsColumns,
|
||||
PrimaryKey: []*schema.Column{EpicGvgDefenseTeamsColumns[0]},
|
||||
}
|
||||
// EpicHeroInfosColumns holds the columns for the "epic_hero_infos" table.
|
||||
EpicHeroInfosColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "hero_name", Type: field.TypeString, Size: 255},
|
||||
{Name: "hero_code", Type: field.TypeString, Size: 255},
|
||||
{Name: "hero_attr_lv60", Type: field.TypeString, Size: 255},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
{Name: "nick_name", Type: field.TypeString, Size: 255},
|
||||
{Name: "rarity", Type: field.TypeString, Size: 255},
|
||||
{Name: "role", Type: field.TypeString, Size: 255},
|
||||
{Name: "zodiac", Type: field.TypeString, Size: 255},
|
||||
{Name: "head_img_url", Type: field.TypeString, Size: 255},
|
||||
{Name: "attribute", Type: field.TypeString, Size: 255},
|
||||
{Name: "remark", Type: field.TypeString, Size: 255},
|
||||
{Name: "raw_json", Type: field.TypeString, Size: 255},
|
||||
{Name: "set_content_json", Type: field.TypeString, Size: 255},
|
||||
{Name: "set_update_time", Type: field.TypeTime, Nullable: true},
|
||||
}
|
||||
// EpicHeroInfosTable holds the schema information for the "epic_hero_infos" table.
|
||||
EpicHeroInfosTable = &schema.Table{
|
||||
Name: "epic_hero_infos",
|
||||
Columns: EpicHeroInfosColumns,
|
||||
PrimaryKey: []*schema.Column{EpicHeroInfosColumns[0]},
|
||||
}
|
||||
// EpicHeroUserBuildsColumns holds the columns for the "epic_hero_user_builds" table.
|
||||
EpicHeroUserBuildsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "artifact_code", Type: field.TypeString, Size: 255},
|
||||
{Name: "hero_code", Type: field.TypeString, Size: 255},
|
||||
{Name: "hero_heath_build", Type: field.TypeFloat64},
|
||||
{Name: "hero_attack_build", Type: field.TypeFloat64},
|
||||
{Name: "hero_def_build", Type: field.TypeFloat64},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
}
|
||||
// EpicHeroUserBuildsTable holds the schema information for the "epic_hero_user_builds" table.
|
||||
EpicHeroUserBuildsTable = &schema.Table{
|
||||
Name: "epic_hero_user_builds",
|
||||
Columns: EpicHeroUserBuildsColumns,
|
||||
PrimaryKey: []*schema.Column{EpicHeroUserBuildsColumns[0]},
|
||||
}
|
||||
// EpicI18nMappingsColumns holds the columns for the "epic_i18n_mappings" table.
|
||||
EpicI18nMappingsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "key_name", Type: field.TypeString, Size: 255},
|
||||
{Name: "language", Type: field.TypeString, Size: 255},
|
||||
{Name: "value", Type: field.TypeString, Size: 255},
|
||||
{Name: "category", Type: field.TypeString, Size: 255},
|
||||
{Name: "status", Type: field.TypeInt},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeInt},
|
||||
{Name: "code", Type: field.TypeString, Size: 255},
|
||||
}
|
||||
// EpicI18nMappingsTable holds the schema information for the "epic_i18n_mappings" table.
|
||||
EpicI18nMappingsTable = &schema.Table{
|
||||
Name: "epic_i18n_mappings",
|
||||
Columns: EpicI18nMappingsColumns,
|
||||
PrimaryKey: []*schema.Column{EpicI18nMappingsColumns[0]},
|
||||
}
|
||||
// FribbleHeroSetsColumns holds the columns for the "fribble_hero_sets" table.
|
||||
FribbleHeroSetsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "hero_code", Type: field.TypeString, Size: 255},
|
||||
{Name: "json_content", Type: field.TypeString, Size: 255},
|
||||
{Name: "hero_name", Type: field.TypeString, Size: 255},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
{Name: "success_get", Type: field.TypeInt},
|
||||
}
|
||||
// FribbleHeroSetsTable holds the schema information for the "fribble_hero_sets" table.
|
||||
FribbleHeroSetsTable = &schema.Table{
|
||||
Name: "fribble_hero_sets",
|
||||
Columns: FribbleHeroSetsColumns,
|
||||
PrimaryKey: []*schema.Column{FribbleHeroSetsColumns[0]},
|
||||
}
|
||||
// GearSetInfosColumns holds the columns for the "gear_set_infos" table.
|
||||
GearSetInfosColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "level", Type: field.TypeInt},
|
||||
{Name: "gear_id", Type: field.TypeInt64},
|
||||
{Name: "enhance", Type: field.TypeInt},
|
||||
{Name: "gear_type", Type: field.TypeString, Size: 255},
|
||||
{Name: "gear_set_type", Type: field.TypeString, Size: 255},
|
||||
{Name: "main_stat_type", Type: field.TypeString, Size: 255},
|
||||
{Name: "main_stat_value", Type: field.TypeInt},
|
||||
{Name: "sub_stat_one_type", Type: field.TypeString, Size: 255},
|
||||
{Name: "sub_stat_one_value", Type: field.TypeInt},
|
||||
{Name: "sub_stat_two_type", Type: field.TypeString, Size: 255},
|
||||
{Name: "sub_stat_two_value", Type: field.TypeInt},
|
||||
{Name: "sub_stat_three_type", Type: field.TypeString, Size: 255},
|
||||
{Name: "sub_stat_three_value", Type: field.TypeInt},
|
||||
{Name: "sub_stat_four_type", Type: field.TypeString, Size: 255},
|
||||
{Name: "sub_stat_four_value", Type: field.TypeInt},
|
||||
{Name: "account_code", Type: field.TypeString, Size: 255},
|
||||
{Name: "creator", Type: field.TypeString, Size: 255},
|
||||
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updater", Type: field.TypeString, Size: 255},
|
||||
{Name: "update_time", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool},
|
||||
{Name: "tenant_id", Type: field.TypeInt64},
|
||||
}
|
||||
// GearSetInfosTable holds the schema information for the "gear_set_infos" table.
|
||||
GearSetInfosTable = &schema.Table{
|
||||
Name: "gear_set_infos",
|
||||
Columns: GearSetInfosColumns,
|
||||
PrimaryKey: []*schema.Column{GearSetInfosColumns[0]},
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
EpicArtifactInfosTable,
|
||||
EpicGvgAttackTeamsTable,
|
||||
EpicGvgDefenseAttackMappingsTable,
|
||||
EpicGvgDefenseTeamsTable,
|
||||
EpicHeroInfosTable,
|
||||
EpicHeroUserBuildsTable,
|
||||
EpicI18nMappingsTable,
|
||||
FribbleHeroSetsTable,
|
||||
GearSetInfosTable,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
9444
internal/ent/mutation.go
Normal file
9444
internal/ent/mutation.go
Normal file
File diff suppressed because it is too large
Load Diff
34
internal/ent/predicate/predicate.go
Normal file
34
internal/ent/predicate/predicate.go
Normal file
@@ -0,0 +1,34 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package predicate
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicArtifactInfo is the predicate function for epicartifactinfo builders.
|
||||
type EpicArtifactInfo func(*sql.Selector)
|
||||
|
||||
// EpicGvgAttackTeams is the predicate function for epicgvgattackteams builders.
|
||||
type EpicGvgAttackTeams func(*sql.Selector)
|
||||
|
||||
// EpicGvgDefenseAttackMapping is the predicate function for epicgvgdefenseattackmapping builders.
|
||||
type EpicGvgDefenseAttackMapping func(*sql.Selector)
|
||||
|
||||
// EpicGvgDefenseTeams is the predicate function for epicgvgdefenseteams builders.
|
||||
type EpicGvgDefenseTeams func(*sql.Selector)
|
||||
|
||||
// EpicHeroInfo is the predicate function for epicheroinfo builders.
|
||||
type EpicHeroInfo func(*sql.Selector)
|
||||
|
||||
// EpicHeroUserBuild is the predicate function for epicherouserbuild builders.
|
||||
type EpicHeroUserBuild func(*sql.Selector)
|
||||
|
||||
// EpicI18NMappings is the predicate function for epici18nmappings builders.
|
||||
type EpicI18NMappings func(*sql.Selector)
|
||||
|
||||
// FribbleHeroSet is the predicate function for fribbleheroset builders.
|
||||
type FribbleHeroSet func(*sql.Selector)
|
||||
|
||||
// GearSetInfo is the predicate function for gearsetinfo builders.
|
||||
type GearSetInfo func(*sql.Selector)
|
||||
284
internal/ent/runtime.go
Normal file
284
internal/ent/runtime.go
Normal file
@@ -0,0 +1,284 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/domain/entity"
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"epic-ent/internal/ent/epicgvgattackteams"
|
||||
"epic-ent/internal/ent/epicgvgdefenseattackmapping"
|
||||
"epic-ent/internal/ent/epicgvgdefenseteams"
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
"epic-ent/internal/ent/epicherouserbuild"
|
||||
"epic-ent/internal/ent/epici18nmappings"
|
||||
"epic-ent/internal/ent/fribbleheroset"
|
||||
"epic-ent/internal/ent/gearsetinfo"
|
||||
)
|
||||
|
||||
// The init function reads all schema descriptors with runtime code
|
||||
// (default values, validators, hooks and policies) and stitches it
|
||||
// to their package variables.
|
||||
func init() {
|
||||
epicartifactinfoFields := entity.EpicArtifactInfo{}.Fields()
|
||||
_ = epicartifactinfoFields
|
||||
// epicartifactinfoDescArtifactName is the schema descriptor for artifact_name field.
|
||||
epicartifactinfoDescArtifactName := epicartifactinfoFields[1].Descriptor()
|
||||
// epicartifactinfo.ArtifactNameValidator is a validator for the "artifact_name" field. It is called by the builders before save.
|
||||
epicartifactinfo.ArtifactNameValidator = epicartifactinfoDescArtifactName.Validators[0].(func(string) error)
|
||||
// epicartifactinfoDescArtifactCode is the schema descriptor for artifact_code field.
|
||||
epicartifactinfoDescArtifactCode := epicartifactinfoFields[2].Descriptor()
|
||||
// epicartifactinfo.ArtifactCodeValidator is a validator for the "artifact_code" field. It is called by the builders before save.
|
||||
epicartifactinfo.ArtifactCodeValidator = epicartifactinfoDescArtifactCode.Validators[0].(func(string) error)
|
||||
// epicartifactinfoDescCreator is the schema descriptor for creator field.
|
||||
epicartifactinfoDescCreator := epicartifactinfoFields[3].Descriptor()
|
||||
// epicartifactinfo.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
epicartifactinfo.CreatorValidator = epicartifactinfoDescCreator.Validators[0].(func(string) error)
|
||||
// epicartifactinfoDescUpdater is the schema descriptor for updater field.
|
||||
epicartifactinfoDescUpdater := epicartifactinfoFields[5].Descriptor()
|
||||
// epicartifactinfo.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
epicartifactinfo.UpdaterValidator = epicartifactinfoDescUpdater.Validators[0].(func(string) error)
|
||||
// epicartifactinfoDescRarity is the schema descriptor for rarity field.
|
||||
epicartifactinfoDescRarity := epicartifactinfoFields[11].Descriptor()
|
||||
// epicartifactinfo.RarityValidator is a validator for the "rarity" field. It is called by the builders before save.
|
||||
epicartifactinfo.RarityValidator = epicartifactinfoDescRarity.Validators[0].(func(string) error)
|
||||
// epicartifactinfoDescRole is the schema descriptor for role field.
|
||||
epicartifactinfoDescRole := epicartifactinfoFields[12].Descriptor()
|
||||
// epicartifactinfo.RoleValidator is a validator for the "role" field. It is called by the builders before save.
|
||||
epicartifactinfo.RoleValidator = epicartifactinfoDescRole.Validators[0].(func(string) error)
|
||||
// epicartifactinfoDescArtifactNameEn is the schema descriptor for artifact_name_en field.
|
||||
epicartifactinfoDescArtifactNameEn := epicartifactinfoFields[13].Descriptor()
|
||||
// epicartifactinfo.ArtifactNameEnValidator is a validator for the "artifact_name_en" field. It is called by the builders before save.
|
||||
epicartifactinfo.ArtifactNameEnValidator = epicartifactinfoDescArtifactNameEn.Validators[0].(func(string) error)
|
||||
// epicartifactinfoDescImageURL is the schema descriptor for image_url field.
|
||||
epicartifactinfoDescImageURL := epicartifactinfoFields[14].Descriptor()
|
||||
// epicartifactinfo.ImageURLValidator is a validator for the "image_url" field. It is called by the builders before save.
|
||||
epicartifactinfo.ImageURLValidator = epicartifactinfoDescImageURL.Validators[0].(func(string) error)
|
||||
epicgvgattackteamsFields := entity.EpicGvgAttackTeams{}.Fields()
|
||||
_ = epicgvgattackteamsFields
|
||||
// epicgvgattackteamsDescAttackHeroes is the schema descriptor for attack_heroes field.
|
||||
epicgvgattackteamsDescAttackHeroes := epicgvgattackteamsFields[1].Descriptor()
|
||||
// epicgvgattackteams.AttackHeroesValidator is a validator for the "attack_heroes" field. It is called by the builders before save.
|
||||
epicgvgattackteams.AttackHeroesValidator = epicgvgattackteamsDescAttackHeroes.Validators[0].(func(string) error)
|
||||
// epicgvgattackteamsDescCreator is the schema descriptor for creator field.
|
||||
epicgvgattackteamsDescCreator := epicgvgattackteamsFields[2].Descriptor()
|
||||
// epicgvgattackteams.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
epicgvgattackteams.CreatorValidator = epicgvgattackteamsDescCreator.Validators[0].(func(string) error)
|
||||
// epicgvgattackteamsDescUpdater is the schema descriptor for updater field.
|
||||
epicgvgattackteamsDescUpdater := epicgvgattackteamsFields[4].Descriptor()
|
||||
// epicgvgattackteams.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
epicgvgattackteams.UpdaterValidator = epicgvgattackteamsDescUpdater.Validators[0].(func(string) error)
|
||||
epicgvgdefenseattackmappingFields := entity.EpicGvgDefenseAttackMapping{}.Fields()
|
||||
_ = epicgvgdefenseattackmappingFields
|
||||
// epicgvgdefenseattackmappingDescEquipmentInfo is the schema descriptor for equipment_info field.
|
||||
epicgvgdefenseattackmappingDescEquipmentInfo := epicgvgdefenseattackmappingFields[3].Descriptor()
|
||||
// epicgvgdefenseattackmapping.EquipmentInfoValidator is a validator for the "equipment_info" field. It is called by the builders before save.
|
||||
epicgvgdefenseattackmapping.EquipmentInfoValidator = epicgvgdefenseattackmappingDescEquipmentInfo.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseattackmappingDescArtifacts is the schema descriptor for artifacts field.
|
||||
epicgvgdefenseattackmappingDescArtifacts := epicgvgdefenseattackmappingFields[4].Descriptor()
|
||||
// epicgvgdefenseattackmapping.ArtifactsValidator is a validator for the "artifacts" field. It is called by the builders before save.
|
||||
epicgvgdefenseattackmapping.ArtifactsValidator = epicgvgdefenseattackmappingDescArtifacts.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseattackmappingDescBattleStrategy is the schema descriptor for battle_strategy field.
|
||||
epicgvgdefenseattackmappingDescBattleStrategy := epicgvgdefenseattackmappingFields[5].Descriptor()
|
||||
// epicgvgdefenseattackmapping.BattleStrategyValidator is a validator for the "battle_strategy" field. It is called by the builders before save.
|
||||
epicgvgdefenseattackmapping.BattleStrategyValidator = epicgvgdefenseattackmappingDescBattleStrategy.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseattackmappingDescPrerequisites is the schema descriptor for prerequisites field.
|
||||
epicgvgdefenseattackmappingDescPrerequisites := epicgvgdefenseattackmappingFields[6].Descriptor()
|
||||
// epicgvgdefenseattackmapping.PrerequisitesValidator is a validator for the "prerequisites" field. It is called by the builders before save.
|
||||
epicgvgdefenseattackmapping.PrerequisitesValidator = epicgvgdefenseattackmappingDescPrerequisites.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseattackmappingDescImportantNotes is the schema descriptor for important_notes field.
|
||||
epicgvgdefenseattackmappingDescImportantNotes := epicgvgdefenseattackmappingFields[7].Descriptor()
|
||||
// epicgvgdefenseattackmapping.ImportantNotesValidator is a validator for the "important_notes" field. It is called by the builders before save.
|
||||
epicgvgdefenseattackmapping.ImportantNotesValidator = epicgvgdefenseattackmappingDescImportantNotes.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseattackmappingDescCreator is the schema descriptor for creator field.
|
||||
epicgvgdefenseattackmappingDescCreator := epicgvgdefenseattackmappingFields[8].Descriptor()
|
||||
// epicgvgdefenseattackmapping.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
epicgvgdefenseattackmapping.CreatorValidator = epicgvgdefenseattackmappingDescCreator.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseattackmappingDescUpdater is the schema descriptor for updater field.
|
||||
epicgvgdefenseattackmappingDescUpdater := epicgvgdefenseattackmappingFields[10].Descriptor()
|
||||
// epicgvgdefenseattackmapping.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
epicgvgdefenseattackmapping.UpdaterValidator = epicgvgdefenseattackmappingDescUpdater.Validators[0].(func(string) error)
|
||||
epicgvgdefenseteamsFields := entity.EpicGvgDefenseTeams{}.Fields()
|
||||
_ = epicgvgdefenseteamsFields
|
||||
// epicgvgdefenseteamsDescDefenseHeroes is the schema descriptor for defense_heroes field.
|
||||
epicgvgdefenseteamsDescDefenseHeroes := epicgvgdefenseteamsFields[1].Descriptor()
|
||||
// epicgvgdefenseteams.DefenseHeroesValidator is a validator for the "defense_heroes" field. It is called by the builders before save.
|
||||
epicgvgdefenseteams.DefenseHeroesValidator = epicgvgdefenseteamsDescDefenseHeroes.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseteamsDescCreator is the schema descriptor for creator field.
|
||||
epicgvgdefenseteamsDescCreator := epicgvgdefenseteamsFields[2].Descriptor()
|
||||
// epicgvgdefenseteams.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
epicgvgdefenseteams.CreatorValidator = epicgvgdefenseteamsDescCreator.Validators[0].(func(string) error)
|
||||
// epicgvgdefenseteamsDescUpdater is the schema descriptor for updater field.
|
||||
epicgvgdefenseteamsDescUpdater := epicgvgdefenseteamsFields[4].Descriptor()
|
||||
// epicgvgdefenseteams.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
epicgvgdefenseteams.UpdaterValidator = epicgvgdefenseteamsDescUpdater.Validators[0].(func(string) error)
|
||||
epicheroinfoFields := entity.EpicHeroInfo{}.Fields()
|
||||
_ = epicheroinfoFields
|
||||
// epicheroinfoDescHeroName is the schema descriptor for hero_name field.
|
||||
epicheroinfoDescHeroName := epicheroinfoFields[1].Descriptor()
|
||||
// epicheroinfo.HeroNameValidator is a validator for the "hero_name" field. It is called by the builders before save.
|
||||
epicheroinfo.HeroNameValidator = epicheroinfoDescHeroName.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescHeroCode is the schema descriptor for hero_code field.
|
||||
epicheroinfoDescHeroCode := epicheroinfoFields[2].Descriptor()
|
||||
// epicheroinfo.HeroCodeValidator is a validator for the "hero_code" field. It is called by the builders before save.
|
||||
epicheroinfo.HeroCodeValidator = epicheroinfoDescHeroCode.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescHeroAttrLv60 is the schema descriptor for hero_attr_lv60 field.
|
||||
epicheroinfoDescHeroAttrLv60 := epicheroinfoFields[3].Descriptor()
|
||||
// epicheroinfo.HeroAttrLv60Validator is a validator for the "hero_attr_lv60" field. It is called by the builders before save.
|
||||
epicheroinfo.HeroAttrLv60Validator = epicheroinfoDescHeroAttrLv60.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescCreator is the schema descriptor for creator field.
|
||||
epicheroinfoDescCreator := epicheroinfoFields[4].Descriptor()
|
||||
// epicheroinfo.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
epicheroinfo.CreatorValidator = epicheroinfoDescCreator.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescUpdater is the schema descriptor for updater field.
|
||||
epicheroinfoDescUpdater := epicheroinfoFields[6].Descriptor()
|
||||
// epicheroinfo.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
epicheroinfo.UpdaterValidator = epicheroinfoDescUpdater.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescNickName is the schema descriptor for nick_name field.
|
||||
epicheroinfoDescNickName := epicheroinfoFields[9].Descriptor()
|
||||
// epicheroinfo.NickNameValidator is a validator for the "nick_name" field. It is called by the builders before save.
|
||||
epicheroinfo.NickNameValidator = epicheroinfoDescNickName.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescRarity is the schema descriptor for rarity field.
|
||||
epicheroinfoDescRarity := epicheroinfoFields[10].Descriptor()
|
||||
// epicheroinfo.RarityValidator is a validator for the "rarity" field. It is called by the builders before save.
|
||||
epicheroinfo.RarityValidator = epicheroinfoDescRarity.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescRole is the schema descriptor for role field.
|
||||
epicheroinfoDescRole := epicheroinfoFields[11].Descriptor()
|
||||
// epicheroinfo.RoleValidator is a validator for the "role" field. It is called by the builders before save.
|
||||
epicheroinfo.RoleValidator = epicheroinfoDescRole.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescZodiac is the schema descriptor for zodiac field.
|
||||
epicheroinfoDescZodiac := epicheroinfoFields[12].Descriptor()
|
||||
// epicheroinfo.ZodiacValidator is a validator for the "zodiac" field. It is called by the builders before save.
|
||||
epicheroinfo.ZodiacValidator = epicheroinfoDescZodiac.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescHeadImgURL is the schema descriptor for head_img_url field.
|
||||
epicheroinfoDescHeadImgURL := epicheroinfoFields[13].Descriptor()
|
||||
// epicheroinfo.HeadImgURLValidator is a validator for the "head_img_url" field. It is called by the builders before save.
|
||||
epicheroinfo.HeadImgURLValidator = epicheroinfoDescHeadImgURL.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescAttribute is the schema descriptor for attribute field.
|
||||
epicheroinfoDescAttribute := epicheroinfoFields[14].Descriptor()
|
||||
// epicheroinfo.AttributeValidator is a validator for the "attribute" field. It is called by the builders before save.
|
||||
epicheroinfo.AttributeValidator = epicheroinfoDescAttribute.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescRemark is the schema descriptor for remark field.
|
||||
epicheroinfoDescRemark := epicheroinfoFields[15].Descriptor()
|
||||
// epicheroinfo.RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
|
||||
epicheroinfo.RemarkValidator = epicheroinfoDescRemark.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescRawJSON is the schema descriptor for raw_json field.
|
||||
epicheroinfoDescRawJSON := epicheroinfoFields[16].Descriptor()
|
||||
// epicheroinfo.RawJSONValidator is a validator for the "raw_json" field. It is called by the builders before save.
|
||||
epicheroinfo.RawJSONValidator = epicheroinfoDescRawJSON.Validators[0].(func(string) error)
|
||||
// epicheroinfoDescSetContentJSON is the schema descriptor for set_content_json field.
|
||||
epicheroinfoDescSetContentJSON := epicheroinfoFields[17].Descriptor()
|
||||
// epicheroinfo.SetContentJSONValidator is a validator for the "set_content_json" field. It is called by the builders before save.
|
||||
epicheroinfo.SetContentJSONValidator = epicheroinfoDescSetContentJSON.Validators[0].(func(string) error)
|
||||
epicherouserbuildFields := entity.EpicHeroUserBuild{}.Fields()
|
||||
_ = epicherouserbuildFields
|
||||
// epicherouserbuildDescArtifactCode is the schema descriptor for artifact_code field.
|
||||
epicherouserbuildDescArtifactCode := epicherouserbuildFields[1].Descriptor()
|
||||
// epicherouserbuild.ArtifactCodeValidator is a validator for the "artifact_code" field. It is called by the builders before save.
|
||||
epicherouserbuild.ArtifactCodeValidator = epicherouserbuildDescArtifactCode.Validators[0].(func(string) error)
|
||||
// epicherouserbuildDescHeroCode is the schema descriptor for hero_code field.
|
||||
epicherouserbuildDescHeroCode := epicherouserbuildFields[2].Descriptor()
|
||||
// epicherouserbuild.HeroCodeValidator is a validator for the "hero_code" field. It is called by the builders before save.
|
||||
epicherouserbuild.HeroCodeValidator = epicherouserbuildDescHeroCode.Validators[0].(func(string) error)
|
||||
// epicherouserbuildDescCreator is the schema descriptor for creator field.
|
||||
epicherouserbuildDescCreator := epicherouserbuildFields[6].Descriptor()
|
||||
// epicherouserbuild.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
epicherouserbuild.CreatorValidator = epicherouserbuildDescCreator.Validators[0].(func(string) error)
|
||||
// epicherouserbuildDescUpdater is the schema descriptor for updater field.
|
||||
epicherouserbuildDescUpdater := epicherouserbuildFields[8].Descriptor()
|
||||
// epicherouserbuild.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
epicherouserbuild.UpdaterValidator = epicherouserbuildDescUpdater.Validators[0].(func(string) error)
|
||||
epici18nmappingsFields := entity.EpicI18NMappings{}.Fields()
|
||||
_ = epici18nmappingsFields
|
||||
// epici18nmappingsDescKeyName is the schema descriptor for key_name field.
|
||||
epici18nmappingsDescKeyName := epici18nmappingsFields[1].Descriptor()
|
||||
// epici18nmappings.KeyNameValidator is a validator for the "key_name" field. It is called by the builders before save.
|
||||
epici18nmappings.KeyNameValidator = epici18nmappingsDescKeyName.Validators[0].(func(string) error)
|
||||
// epici18nmappingsDescLanguage is the schema descriptor for language field.
|
||||
epici18nmappingsDescLanguage := epici18nmappingsFields[2].Descriptor()
|
||||
// epici18nmappings.LanguageValidator is a validator for the "language" field. It is called by the builders before save.
|
||||
epici18nmappings.LanguageValidator = epici18nmappingsDescLanguage.Validators[0].(func(string) error)
|
||||
// epici18nmappingsDescValue is the schema descriptor for value field.
|
||||
epici18nmappingsDescValue := epici18nmappingsFields[3].Descriptor()
|
||||
// epici18nmappings.ValueValidator is a validator for the "value" field. It is called by the builders before save.
|
||||
epici18nmappings.ValueValidator = epici18nmappingsDescValue.Validators[0].(func(string) error)
|
||||
// epici18nmappingsDescCategory is the schema descriptor for category field.
|
||||
epici18nmappingsDescCategory := epici18nmappingsFields[4].Descriptor()
|
||||
// epici18nmappings.CategoryValidator is a validator for the "category" field. It is called by the builders before save.
|
||||
epici18nmappings.CategoryValidator = epici18nmappingsDescCategory.Validators[0].(func(string) error)
|
||||
// epici18nmappingsDescCreator is the schema descriptor for creator field.
|
||||
epici18nmappingsDescCreator := epici18nmappingsFields[6].Descriptor()
|
||||
// epici18nmappings.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
epici18nmappings.CreatorValidator = epici18nmappingsDescCreator.Validators[0].(func(string) error)
|
||||
// epici18nmappingsDescUpdater is the schema descriptor for updater field.
|
||||
epici18nmappingsDescUpdater := epici18nmappingsFields[8].Descriptor()
|
||||
// epici18nmappings.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
epici18nmappings.UpdaterValidator = epici18nmappingsDescUpdater.Validators[0].(func(string) error)
|
||||
// epici18nmappingsDescCode is the schema descriptor for code field.
|
||||
epici18nmappingsDescCode := epici18nmappingsFields[11].Descriptor()
|
||||
// epici18nmappings.CodeValidator is a validator for the "code" field. It is called by the builders before save.
|
||||
epici18nmappings.CodeValidator = epici18nmappingsDescCode.Validators[0].(func(string) error)
|
||||
fribbleherosetFields := entity.FribbleHeroSet{}.Fields()
|
||||
_ = fribbleherosetFields
|
||||
// fribbleherosetDescHeroCode is the schema descriptor for hero_code field.
|
||||
fribbleherosetDescHeroCode := fribbleherosetFields[1].Descriptor()
|
||||
// fribbleheroset.HeroCodeValidator is a validator for the "hero_code" field. It is called by the builders before save.
|
||||
fribbleheroset.HeroCodeValidator = fribbleherosetDescHeroCode.Validators[0].(func(string) error)
|
||||
// fribbleherosetDescJSONContent is the schema descriptor for json_content field.
|
||||
fribbleherosetDescJSONContent := fribbleherosetFields[2].Descriptor()
|
||||
// fribbleheroset.JSONContentValidator is a validator for the "json_content" field. It is called by the builders before save.
|
||||
fribbleheroset.JSONContentValidator = fribbleherosetDescJSONContent.Validators[0].(func(string) error)
|
||||
// fribbleherosetDescHeroName is the schema descriptor for hero_name field.
|
||||
fribbleherosetDescHeroName := fribbleherosetFields[3].Descriptor()
|
||||
// fribbleheroset.HeroNameValidator is a validator for the "hero_name" field. It is called by the builders before save.
|
||||
fribbleheroset.HeroNameValidator = fribbleherosetDescHeroName.Validators[0].(func(string) error)
|
||||
// fribbleherosetDescCreator is the schema descriptor for creator field.
|
||||
fribbleherosetDescCreator := fribbleherosetFields[4].Descriptor()
|
||||
// fribbleheroset.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
fribbleheroset.CreatorValidator = fribbleherosetDescCreator.Validators[0].(func(string) error)
|
||||
// fribbleherosetDescUpdater is the schema descriptor for updater field.
|
||||
fribbleherosetDescUpdater := fribbleherosetFields[6].Descriptor()
|
||||
// fribbleheroset.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
fribbleheroset.UpdaterValidator = fribbleherosetDescUpdater.Validators[0].(func(string) error)
|
||||
gearsetinfoFields := entity.GearSetInfo{}.Fields()
|
||||
_ = gearsetinfoFields
|
||||
// gearsetinfoDescGearType is the schema descriptor for gear_type field.
|
||||
gearsetinfoDescGearType := gearsetinfoFields[4].Descriptor()
|
||||
// gearsetinfo.GearTypeValidator is a validator for the "gear_type" field. It is called by the builders before save.
|
||||
gearsetinfo.GearTypeValidator = gearsetinfoDescGearType.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescGearSetType is the schema descriptor for gear_set_type field.
|
||||
gearsetinfoDescGearSetType := gearsetinfoFields[5].Descriptor()
|
||||
// gearsetinfo.GearSetTypeValidator is a validator for the "gear_set_type" field. It is called by the builders before save.
|
||||
gearsetinfo.GearSetTypeValidator = gearsetinfoDescGearSetType.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescMainStatType is the schema descriptor for main_stat_type field.
|
||||
gearsetinfoDescMainStatType := gearsetinfoFields[6].Descriptor()
|
||||
// gearsetinfo.MainStatTypeValidator is a validator for the "main_stat_type" field. It is called by the builders before save.
|
||||
gearsetinfo.MainStatTypeValidator = gearsetinfoDescMainStatType.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescSubStatOneType is the schema descriptor for sub_stat_one_type field.
|
||||
gearsetinfoDescSubStatOneType := gearsetinfoFields[8].Descriptor()
|
||||
// gearsetinfo.SubStatOneTypeValidator is a validator for the "sub_stat_one_type" field. It is called by the builders before save.
|
||||
gearsetinfo.SubStatOneTypeValidator = gearsetinfoDescSubStatOneType.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescSubStatTwoType is the schema descriptor for sub_stat_two_type field.
|
||||
gearsetinfoDescSubStatTwoType := gearsetinfoFields[10].Descriptor()
|
||||
// gearsetinfo.SubStatTwoTypeValidator is a validator for the "sub_stat_two_type" field. It is called by the builders before save.
|
||||
gearsetinfo.SubStatTwoTypeValidator = gearsetinfoDescSubStatTwoType.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescSubStatThreeType is the schema descriptor for sub_stat_three_type field.
|
||||
gearsetinfoDescSubStatThreeType := gearsetinfoFields[12].Descriptor()
|
||||
// gearsetinfo.SubStatThreeTypeValidator is a validator for the "sub_stat_three_type" field. It is called by the builders before save.
|
||||
gearsetinfo.SubStatThreeTypeValidator = gearsetinfoDescSubStatThreeType.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescSubStatFourType is the schema descriptor for sub_stat_four_type field.
|
||||
gearsetinfoDescSubStatFourType := gearsetinfoFields[14].Descriptor()
|
||||
// gearsetinfo.SubStatFourTypeValidator is a validator for the "sub_stat_four_type" field. It is called by the builders before save.
|
||||
gearsetinfo.SubStatFourTypeValidator = gearsetinfoDescSubStatFourType.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescAccountCode is the schema descriptor for account_code field.
|
||||
gearsetinfoDescAccountCode := gearsetinfoFields[16].Descriptor()
|
||||
// gearsetinfo.AccountCodeValidator is a validator for the "account_code" field. It is called by the builders before save.
|
||||
gearsetinfo.AccountCodeValidator = gearsetinfoDescAccountCode.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescCreator is the schema descriptor for creator field.
|
||||
gearsetinfoDescCreator := gearsetinfoFields[17].Descriptor()
|
||||
// gearsetinfo.CreatorValidator is a validator for the "creator" field. It is called by the builders before save.
|
||||
gearsetinfo.CreatorValidator = gearsetinfoDescCreator.Validators[0].(func(string) error)
|
||||
// gearsetinfoDescUpdater is the schema descriptor for updater field.
|
||||
gearsetinfoDescUpdater := gearsetinfoFields[19].Descriptor()
|
||||
// gearsetinfo.UpdaterValidator is a validator for the "updater" field. It is called by the builders before save.
|
||||
gearsetinfo.UpdaterValidator = gearsetinfoDescUpdater.Validators[0].(func(string) error)
|
||||
}
|
||||
10
internal/ent/runtime/runtime.go
Normal file
10
internal/ent/runtime/runtime.go
Normal file
@@ -0,0 +1,10 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package runtime
|
||||
|
||||
// The schema-stitching logic is generated in epic-ent/internal/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.14.5" // Version of ent codegen.
|
||||
Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen.
|
||||
)
|
||||
234
internal/ent/tx.go
Normal file
234
internal/ent/tx.go
Normal file
@@ -0,0 +1,234 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"entgo.io/ent/dialect"
|
||||
)
|
||||
|
||||
// Tx is a transactional client that is created by calling Client.Tx().
|
||||
type Tx struct {
|
||||
config
|
||||
// EpicArtifactInfo is the client for interacting with the EpicArtifactInfo builders.
|
||||
EpicArtifactInfo *EpicArtifactInfoClient
|
||||
// EpicGvgAttackTeams is the client for interacting with the EpicGvgAttackTeams builders.
|
||||
EpicGvgAttackTeams *EpicGvgAttackTeamsClient
|
||||
// EpicGvgDefenseAttackMapping is the client for interacting with the EpicGvgDefenseAttackMapping builders.
|
||||
EpicGvgDefenseAttackMapping *EpicGvgDefenseAttackMappingClient
|
||||
// EpicGvgDefenseTeams is the client for interacting with the EpicGvgDefenseTeams builders.
|
||||
EpicGvgDefenseTeams *EpicGvgDefenseTeamsClient
|
||||
// EpicHeroInfo is the client for interacting with the EpicHeroInfo builders.
|
||||
EpicHeroInfo *EpicHeroInfoClient
|
||||
// EpicHeroUserBuild is the client for interacting with the EpicHeroUserBuild builders.
|
||||
EpicHeroUserBuild *EpicHeroUserBuildClient
|
||||
// EpicI18NMappings is the client for interacting with the EpicI18NMappings builders.
|
||||
EpicI18NMappings *EpicI18NMappingsClient
|
||||
// FribbleHeroSet is the client for interacting with the FribbleHeroSet builders.
|
||||
FribbleHeroSet *FribbleHeroSetClient
|
||||
// GearSetInfo is the client for interacting with the GearSetInfo builders.
|
||||
GearSetInfo *GearSetInfoClient
|
||||
|
||||
// lazily loaded.
|
||||
client *Client
|
||||
clientOnce sync.Once
|
||||
// ctx lives for the life of the transaction. It is
|
||||
// the same context used by the underlying connection.
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
type (
|
||||
// Committer is the interface that wraps the Commit method.
|
||||
Committer interface {
|
||||
Commit(context.Context, *Tx) error
|
||||
}
|
||||
|
||||
// The CommitFunc type is an adapter to allow the use of ordinary
|
||||
// function as a Committer. If f is a function with the appropriate
|
||||
// signature, CommitFunc(f) is a Committer that calls f.
|
||||
CommitFunc func(context.Context, *Tx) error
|
||||
|
||||
// CommitHook defines the "commit middleware". A function that gets a Committer
|
||||
// and returns a Committer. For example:
|
||||
//
|
||||
// hook := func(next ent.Committer) ent.Committer {
|
||||
// return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
|
||||
// // Do some stuff before.
|
||||
// if err := next.Commit(ctx, tx); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// // Do some stuff after.
|
||||
// return nil
|
||||
// })
|
||||
// }
|
||||
//
|
||||
CommitHook func(Committer) Committer
|
||||
)
|
||||
|
||||
// Commit calls f(ctx, m).
|
||||
func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error {
|
||||
return f(ctx, tx)
|
||||
}
|
||||
|
||||
// Commit commits the transaction.
|
||||
func (tx *Tx) Commit() error {
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
var fn Committer = CommitFunc(func(context.Context, *Tx) error {
|
||||
return txDriver.tx.Commit()
|
||||
})
|
||||
txDriver.mu.Lock()
|
||||
hooks := append([]CommitHook(nil), txDriver.onCommit...)
|
||||
txDriver.mu.Unlock()
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
fn = hooks[i](fn)
|
||||
}
|
||||
return fn.Commit(tx.ctx, tx)
|
||||
}
|
||||
|
||||
// OnCommit adds a hook to call on commit.
|
||||
func (tx *Tx) OnCommit(f CommitHook) {
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
txDriver.mu.Lock()
|
||||
txDriver.onCommit = append(txDriver.onCommit, f)
|
||||
txDriver.mu.Unlock()
|
||||
}
|
||||
|
||||
type (
|
||||
// Rollbacker is the interface that wraps the Rollback method.
|
||||
Rollbacker interface {
|
||||
Rollback(context.Context, *Tx) error
|
||||
}
|
||||
|
||||
// The RollbackFunc type is an adapter to allow the use of ordinary
|
||||
// function as a Rollbacker. If f is a function with the appropriate
|
||||
// signature, RollbackFunc(f) is a Rollbacker that calls f.
|
||||
RollbackFunc func(context.Context, *Tx) error
|
||||
|
||||
// RollbackHook defines the "rollback middleware". A function that gets a Rollbacker
|
||||
// and returns a Rollbacker. For example:
|
||||
//
|
||||
// hook := func(next ent.Rollbacker) ent.Rollbacker {
|
||||
// return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
|
||||
// // Do some stuff before.
|
||||
// if err := next.Rollback(ctx, tx); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// // Do some stuff after.
|
||||
// return nil
|
||||
// })
|
||||
// }
|
||||
//
|
||||
RollbackHook func(Rollbacker) Rollbacker
|
||||
)
|
||||
|
||||
// Rollback calls f(ctx, m).
|
||||
func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error {
|
||||
return f(ctx, tx)
|
||||
}
|
||||
|
||||
// Rollback rollbacks the transaction.
|
||||
func (tx *Tx) Rollback() error {
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error {
|
||||
return txDriver.tx.Rollback()
|
||||
})
|
||||
txDriver.mu.Lock()
|
||||
hooks := append([]RollbackHook(nil), txDriver.onRollback...)
|
||||
txDriver.mu.Unlock()
|
||||
for i := len(hooks) - 1; i >= 0; i-- {
|
||||
fn = hooks[i](fn)
|
||||
}
|
||||
return fn.Rollback(tx.ctx, tx)
|
||||
}
|
||||
|
||||
// OnRollback adds a hook to call on rollback.
|
||||
func (tx *Tx) OnRollback(f RollbackHook) {
|
||||
txDriver := tx.config.driver.(*txDriver)
|
||||
txDriver.mu.Lock()
|
||||
txDriver.onRollback = append(txDriver.onRollback, f)
|
||||
txDriver.mu.Unlock()
|
||||
}
|
||||
|
||||
// Client returns a Client that binds to current transaction.
|
||||
func (tx *Tx) Client() *Client {
|
||||
tx.clientOnce.Do(func() {
|
||||
tx.client = &Client{config: tx.config}
|
||||
tx.client.init()
|
||||
})
|
||||
return tx.client
|
||||
}
|
||||
|
||||
func (tx *Tx) init() {
|
||||
tx.EpicArtifactInfo = NewEpicArtifactInfoClient(tx.config)
|
||||
tx.EpicGvgAttackTeams = NewEpicGvgAttackTeamsClient(tx.config)
|
||||
tx.EpicGvgDefenseAttackMapping = NewEpicGvgDefenseAttackMappingClient(tx.config)
|
||||
tx.EpicGvgDefenseTeams = NewEpicGvgDefenseTeamsClient(tx.config)
|
||||
tx.EpicHeroInfo = NewEpicHeroInfoClient(tx.config)
|
||||
tx.EpicHeroUserBuild = NewEpicHeroUserBuildClient(tx.config)
|
||||
tx.EpicI18NMappings = NewEpicI18NMappingsClient(tx.config)
|
||||
tx.FribbleHeroSet = NewFribbleHeroSetClient(tx.config)
|
||||
tx.GearSetInfo = NewGearSetInfoClient(tx.config)
|
||||
}
|
||||
|
||||
// txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation.
|
||||
// The idea is to support transactions without adding any extra code to the builders.
|
||||
// When a builder calls to driver.Tx(), it gets the same dialect.Tx instance.
|
||||
// Commit and Rollback are nop for the internal builders and the user must call one
|
||||
// of them in order to commit or rollback the transaction.
|
||||
//
|
||||
// If a closed transaction is embedded in one of the generated entities, and the entity
|
||||
// applies a query, for example: EpicArtifactInfo.QueryXXX(), the query will be executed
|
||||
// through the driver which created this transaction.
|
||||
//
|
||||
// Note that txDriver is not goroutine safe.
|
||||
type txDriver struct {
|
||||
// the driver we started the transaction from.
|
||||
drv dialect.Driver
|
||||
// tx is the underlying transaction.
|
||||
tx dialect.Tx
|
||||
// completion hooks.
|
||||
mu sync.Mutex
|
||||
onCommit []CommitHook
|
||||
onRollback []RollbackHook
|
||||
}
|
||||
|
||||
// newTx creates a new transactional driver.
|
||||
func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {
|
||||
tx, err := drv.Tx(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &txDriver{tx: tx, drv: drv}, nil
|
||||
}
|
||||
|
||||
// Tx returns the transaction wrapper (txDriver) to avoid Commit or Rollback calls
|
||||
// from the internal builders. Should be called only by the internal builders.
|
||||
func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil }
|
||||
|
||||
// Dialect returns the dialect of the driver we started the transaction from.
|
||||
func (tx *txDriver) Dialect() string { return tx.drv.Dialect() }
|
||||
|
||||
// Close is a nop close.
|
||||
func (*txDriver) Close() error { return nil }
|
||||
|
||||
// Commit is a nop commit for the internal builders.
|
||||
// User must call `Tx.Commit` in order to commit the transaction.
|
||||
func (*txDriver) Commit() error { return nil }
|
||||
|
||||
// Rollback is a nop rollback for the internal builders.
|
||||
// User must call `Tx.Rollback` in order to rollback the transaction.
|
||||
func (*txDriver) Rollback() error { return nil }
|
||||
|
||||
// Exec calls tx.Exec.
|
||||
func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Exec(ctx, query, args, v)
|
||||
}
|
||||
|
||||
// Query calls tx.Query.
|
||||
func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Query(ctx, query, args, v)
|
||||
}
|
||||
|
||||
var _ dialect.Driver = (*txDriver)(nil)
|
||||
@@ -1,14 +1,24 @@
|
||||
package exception
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
"epic-ent/internal/domain/vo"
|
||||
)
|
||||
|
||||
func RegisterErrorHandler(e *echo.Echo) {
|
||||
e.HTTPErrorHandler = func(err error, c echo.Context) {
|
||||
_ = c.JSON(500, map[string]any{
|
||||
"code": "INTERNAL_ERROR",
|
||||
"message": err.Error(),
|
||||
})
|
||||
code := http.StatusInternalServerError
|
||||
msg := err.Error()
|
||||
if he, ok := err.(*echo.HTTPError); ok {
|
||||
code = he.Code
|
||||
if he.Message != nil {
|
||||
msg = he.Message.(string)
|
||||
}
|
||||
}
|
||||
|
||||
_ = c.JSON(code, vo.Error(msg))
|
||||
}
|
||||
}
|
||||
|
||||
25
internal/infra/db/ent.go
Normal file
25
internal/infra/db/ent.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.uber.org/fx"
|
||||
|
||||
"epic-ent/internal/config"
|
||||
"epic-ent/internal/ent"
|
||||
)
|
||||
|
||||
func NewEntClient(lc fx.Lifecycle, cfg *config.Config) (*ent.Client, error) {
|
||||
client, err := ent.Open("mysql", cfg.MySQL.DSN)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lc.Append(fx.Hook{
|
||||
OnStop: func(ctx context.Context) error {
|
||||
return client.Close()
|
||||
},
|
||||
})
|
||||
|
||||
return client, nil
|
||||
}
|
||||
@@ -14,6 +14,7 @@ var Module = fx.Options(
|
||||
fx.Provide(
|
||||
infraLog.NewLogger,
|
||||
db.NewMySQL,
|
||||
db.NewEntClient,
|
||||
cache.NewRedis,
|
||||
http.NewEcho,
|
||||
),
|
||||
|
||||
218
internal/repository/hero_repo.go
Normal file
218
internal/repository/hero_repo.go
Normal file
@@ -0,0 +1,218 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"epic-ent/internal/domain/dto"
|
||||
"epic-ent/internal/domain/vo"
|
||||
"epic-ent/internal/ent"
|
||||
"epic-ent/internal/ent/epicheroinfo"
|
||||
)
|
||||
|
||||
type HeroRepository struct {
|
||||
client *ent.Client
|
||||
}
|
||||
|
||||
func NewHeroRepository(client *ent.Client) *HeroRepository {
|
||||
return &HeroRepository{client: client}
|
||||
}
|
||||
|
||||
func (r *HeroRepository) Create(ctx context.Context, req dto.HeroCreateRequest) (vo.Hero, error) {
|
||||
create := r.client.EpicHeroInfo.Create().
|
||||
SetHeroName(valueOrEmpty(req.HeroName)).
|
||||
SetHeroCode(valueOrEmpty(req.HeroCode)).
|
||||
SetHeroAttrLv60(valueOrEmpty(req.HeroAttrLv60)).
|
||||
SetCreator(valueOrEmpty(req.Creator)).
|
||||
SetUpdater(valueOrEmpty(req.Updater)).
|
||||
SetDeleted(valueOrFalse(req.Deleted)).
|
||||
SetNickName(valueOrEmpty(req.NickName)).
|
||||
SetRarity(valueOrEmpty(req.Rarity)).
|
||||
SetRole(valueOrEmpty(req.Role)).
|
||||
SetZodiac(valueOrEmpty(req.Zodiac)).
|
||||
SetHeadImgURL(valueOrEmpty(req.HeadImgURL)).
|
||||
SetAttribute(valueOrEmpty(req.Attribute)).
|
||||
SetRemark(valueOrEmpty(req.Remark)).
|
||||
SetRawJSON(valueOrEmpty(req.RawJSON)).
|
||||
SetSetContentJSON(valueOrEmpty(req.SetContentJSON))
|
||||
|
||||
if req.CreateTime != nil {
|
||||
create.SetCreateTime(*req.CreateTime)
|
||||
}
|
||||
if req.UpdateTime != nil {
|
||||
create.SetUpdateTime(*req.UpdateTime)
|
||||
}
|
||||
if req.SetUpdateTime != nil {
|
||||
create.SetSetUpdateTime(*req.SetUpdateTime)
|
||||
}
|
||||
|
||||
hero, err := create.Save(ctx)
|
||||
if err != nil {
|
||||
return vo.Hero{}, err
|
||||
}
|
||||
|
||||
return toVO(hero), nil
|
||||
}
|
||||
|
||||
func (r *HeroRepository) GetByID(ctx context.Context, id int64) (vo.Hero, error) {
|
||||
hero, err := r.client.EpicHeroInfo.Query().
|
||||
Where(
|
||||
epicheroinfo.IDEQ(id),
|
||||
epicheroinfo.DeletedEQ(false),
|
||||
).
|
||||
Only(ctx)
|
||||
if err != nil {
|
||||
return vo.Hero{}, err
|
||||
}
|
||||
|
||||
return toVO(hero), nil
|
||||
}
|
||||
|
||||
func (r *HeroRepository) Update(ctx context.Context, id int64, req dto.HeroUpdateRequest) (vo.Hero, error) {
|
||||
updated := false
|
||||
update := r.client.EpicHeroInfo.Update().
|
||||
Where(
|
||||
epicheroinfo.IDEQ(id),
|
||||
epicheroinfo.DeletedEQ(false),
|
||||
)
|
||||
if req.HeroName != nil {
|
||||
update.SetHeroName(*req.HeroName)
|
||||
updated = true
|
||||
}
|
||||
if req.HeroCode != nil {
|
||||
update.SetHeroCode(*req.HeroCode)
|
||||
updated = true
|
||||
}
|
||||
if req.HeroAttrLv60 != nil {
|
||||
update.SetHeroAttrLv60(*req.HeroAttrLv60)
|
||||
updated = true
|
||||
}
|
||||
if req.Updater != nil {
|
||||
update.SetUpdater(*req.Updater)
|
||||
updated = true
|
||||
}
|
||||
if req.UpdateTime != nil {
|
||||
update.SetUpdateTime(*req.UpdateTime)
|
||||
updated = true
|
||||
}
|
||||
if req.Deleted != nil {
|
||||
update.SetDeleted(*req.Deleted)
|
||||
updated = true
|
||||
}
|
||||
if req.NickName != nil {
|
||||
update.SetNickName(*req.NickName)
|
||||
updated = true
|
||||
}
|
||||
if req.Rarity != nil {
|
||||
update.SetRarity(*req.Rarity)
|
||||
updated = true
|
||||
}
|
||||
if req.Role != nil {
|
||||
update.SetRole(*req.Role)
|
||||
updated = true
|
||||
}
|
||||
if req.Zodiac != nil {
|
||||
update.SetZodiac(*req.Zodiac)
|
||||
updated = true
|
||||
}
|
||||
if req.HeadImgURL != nil {
|
||||
update.SetHeadImgURL(*req.HeadImgURL)
|
||||
updated = true
|
||||
}
|
||||
if req.Attribute != nil {
|
||||
update.SetAttribute(*req.Attribute)
|
||||
updated = true
|
||||
}
|
||||
if req.Remark != nil {
|
||||
update.SetRemark(*req.Remark)
|
||||
updated = true
|
||||
}
|
||||
if req.RawJSON != nil {
|
||||
update.SetRawJSON(*req.RawJSON)
|
||||
updated = true
|
||||
}
|
||||
if req.SetContentJSON != nil {
|
||||
update.SetSetContentJSON(*req.SetContentJSON)
|
||||
updated = true
|
||||
}
|
||||
if req.SetUpdateTime != nil {
|
||||
update.SetSetUpdateTime(*req.SetUpdateTime)
|
||||
updated = true
|
||||
}
|
||||
|
||||
if !updated {
|
||||
return r.GetByID(ctx, id)
|
||||
}
|
||||
|
||||
if req.UpdateTime == nil {
|
||||
update.SetUpdateTime(time.Now())
|
||||
}
|
||||
|
||||
affected, err := update.Save(ctx)
|
||||
if err != nil {
|
||||
return vo.Hero{}, err
|
||||
}
|
||||
if affected == 0 {
|
||||
return vo.Hero{}, sql.ErrNoRows
|
||||
}
|
||||
|
||||
return r.GetByID(ctx, id)
|
||||
}
|
||||
|
||||
func (r *HeroRepository) Delete(ctx context.Context, id int64) error {
|
||||
affected, err := r.client.EpicHeroInfo.Update().
|
||||
Where(
|
||||
epicheroinfo.IDEQ(id),
|
||||
epicheroinfo.DeletedEQ(false),
|
||||
).
|
||||
SetDeleted(true).
|
||||
SetUpdateTime(time.Now()).
|
||||
Save(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if affected == 0 {
|
||||
return sql.ErrNoRows
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func toVO(hero *ent.EpicHeroInfo) vo.Hero {
|
||||
return vo.Hero{
|
||||
ID: hero.ID,
|
||||
HeroName: hero.HeroName,
|
||||
HeroCode: hero.HeroCode,
|
||||
HeroAttrLv60: hero.HeroAttrLv60,
|
||||
Creator: hero.Creator,
|
||||
CreateTime: hero.CreateTime,
|
||||
Updater: hero.Updater,
|
||||
UpdateTime: hero.UpdateTime,
|
||||
Deleted: hero.Deleted,
|
||||
NickName: hero.NickName,
|
||||
Rarity: hero.Rarity,
|
||||
Role: hero.Role,
|
||||
Zodiac: hero.Zodiac,
|
||||
HeadImgURL: hero.HeadImgURL,
|
||||
Attribute: hero.Attribute,
|
||||
Remark: hero.Remark,
|
||||
RawJSON: hero.RawJSON,
|
||||
SetContentJSON: hero.SetContentJSON,
|
||||
SetUpdateTime: hero.SetUpdateTime,
|
||||
}
|
||||
}
|
||||
|
||||
func valueOrEmpty(v *string) string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
return *v
|
||||
}
|
||||
|
||||
func valueOrFalse(v *bool) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
return *v
|
||||
}
|
||||
@@ -5,5 +5,6 @@ import "go.uber.org/fx"
|
||||
var Module = fx.Options(
|
||||
fx.Provide(
|
||||
NewHealthRepository,
|
||||
NewHeroRepository,
|
||||
),
|
||||
)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user