From fe67f09e72d61fdd0f94c561f66d1f60bf79ce61 Mon Sep 17 00:00:00 2001 From: kever Date: Thu, 15 Jan 2026 22:11:33 +0800 Subject: [PATCH] add initial application structure with configuration, logging, and health check endpoints --- go.mod | 31 +++-- go.sum | 67 ++++++---- internal/domain/dto/health.go | 5 - internal/domain/dto/hero.go | 8 +- internal/domain/entity/doc.go | 3 + internal/domain/entity/epic_hero_info.go | 4 +- internal/domain/vo/hero.go | 4 +- internal/ent/epicheroinfo.go | 34 ++--- internal/ent/epicheroinfo/epicheroinfo.go | 28 ++-- internal/ent/epicheroinfo/where.go | 150 +++++++++++----------- internal/ent/epicheroinfo_create.go | 40 +++--- internal/ent/epicheroinfo_update.go | 96 +++++++------- internal/ent/migrate/schema.go | 4 +- internal/ent/mutation.go | 128 +++++++++--------- internal/ent/runtime.go | 8 +- internal/repository/health_repo.go | 15 --- internal/repository/hero_repo.go | 18 +-- internal/repository/module.go | 1 - tools.go | 7 + 19 files changed, 333 insertions(+), 318 deletions(-) delete mode 100644 internal/domain/dto/health.go create mode 100644 internal/domain/entity/doc.go delete mode 100644 internal/repository/health_repo.go create mode 100644 tools.go diff --git a/go.mod b/go.mod index 53a1c5b..03ef6e8 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,8 @@ module epic-ent -go 1.24.0 +go 1.24.11 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 @@ -14,7 +13,19 @@ require ( ) require ( - ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/spf13/cobra v1.7.0 // indirect + golang.org/x/sync v0.19.0 // indirect + golang.org/x/tools v0.41.0 // indirect + golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +require ( + ariga.io/atlas v1.0.0 // indirect + entgo.io/ent v0.14.5 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 @@ -22,11 +33,11 @@ require ( 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-openapi/inflect v0.21.5 // 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/google/go-cmp v0.7.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/hcl/v2 v2.24.0 // indirect github.com/labstack/gommon v0.4.2 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -39,13 +50,13 @@ require ( 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 + github.com/zclconf/go-cty v1.17.0 // indirect + github.com/zclconf/go-cty-yaml v1.2.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/mod v0.32.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 diff --git a/go.sum b/go.sum index 92c1524..adc3dd6 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -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= +ariga.io/atlas v1.0.0 h1:v9DQH49xK+SM2kKwk4OQBjfz/KNRMUR+pvDiEIxSJto= +ariga.io/atlas v1.0.0/go.mod h1:esBbk3F+pi/mM2PvbCymDm+kWhaOk4PaaiegQdNELk8= 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= @@ -18,6 +18,7 @@ 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/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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= @@ -26,26 +27,26 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk 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-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= -github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= +github.com/go-openapi/inflect v0.21.5 h1:M2RCq6PPS3YbIaL7CXosGL3BbzAcmfBAT0nC3YfesZA= +github.com/go-openapi/inflect v0.21.5/go.mod h1:GypUyi6bU880NYurWaEH2CmH84zFDNd+EhhmzroHmB4= 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/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/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQxvE= +github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 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= @@ -54,12 +55,14 @@ 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/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= +github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= -github.com/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/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -70,14 +73,16 @@ 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/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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/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/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= @@ -90,10 +95,12 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw 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= +github.com/zclconf/go-cty v1.17.0 h1:seZvECve6XX4tmnvRzWtJNHdscMtYEx5R7bnnVyd/d0= +github.com/zclconf/go-cty v1.17.0/go.mod h1:wqFzcImaLTI6A5HfsRwB0nj5n0MRZFwmey8YoFPPs3U= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= +github.com/zclconf/go-cty-yaml v1.2.0 h1:GDyL4+e/Qe/S0B7YaecMLbVvAR/Mp21CXMOSiCTOi1M= +github.com/zclconf/go-cty-yaml v1.2.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.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -108,17 +115,25 @@ 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/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= +golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= 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/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= 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= +golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= +golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= +golang.org/x/tools/go/expect v0.1.0-deprecated h1:jY2C5HGYR5lqex3gEniOQL0r7Dq5+VGVgY1nudX5lXY= +golang.org/x/tools/go/expect v0.1.0-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= 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/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/domain/dto/health.go b/internal/domain/dto/health.go deleted file mode 100644 index fdfda22..0000000 --- a/internal/domain/dto/health.go +++ /dev/null @@ -1,5 +0,0 @@ -package dto - -type HealthRequest struct { - Ping string `json:"ping"` -} diff --git a/internal/domain/dto/hero.go b/internal/domain/dto/hero.go index 7ce5a16..da48fc1 100644 --- a/internal/domain/dto/hero.go +++ b/internal/domain/dto/hero.go @@ -19,8 +19,8 @@ type HeroCreateRequest struct { Attribute *string `json:"attribute"` Remark *string `json:"remark"` RawJSON *string `json:"rawJson"` - SetContentJSON *string `json:"setContentJson"` - SetUpdateTime *time.Time `json:"setUpdateTime"` + ContentJSONSet *string `json:"contentJsonSet"` + UpdateTimeSet *time.Time `json:"updateTimeSet"` } type HeroUpdateRequest struct { @@ -38,6 +38,6 @@ type HeroUpdateRequest struct { Attribute *string `json:"attribute"` Remark *string `json:"remark"` RawJSON *string `json:"rawJson"` - SetContentJSON *string `json:"setContentJson"` - SetUpdateTime *time.Time `json:"setUpdateTime"` + ContentJSONSet *string `json:"contentJsonSet"` + UpdateTimeSet *time.Time `json:"updateTimeSet"` } diff --git a/internal/domain/entity/doc.go b/internal/domain/entity/doc.go new file mode 100644 index 0000000..27cdb68 --- /dev/null +++ b/internal/domain/entity/doc.go @@ -0,0 +1,3 @@ +package entity + +//go:generate go run entgo.io/ent/cmd/ent@v0.14.5 generate ./internal/domain/entity --target ./internal/ent diff --git a/internal/domain/entity/epic_hero_info.go b/internal/domain/entity/epic_hero_info.go index 7dd9beb..51f4d41 100644 --- a/internal/domain/entity/epic_hero_info.go +++ b/internal/domain/entity/epic_hero_info.go @@ -32,7 +32,7 @@ func (EpicHeroInfo) Fields() []ent.Field { 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(), + field.String("content_json_set").MaxLen(255), + field.Time("update_time_set").Optional().Nillable(), } } diff --git a/internal/domain/vo/hero.go b/internal/domain/vo/hero.go index ce3ceb9..50905b2 100644 --- a/internal/domain/vo/hero.go +++ b/internal/domain/vo/hero.go @@ -20,6 +20,6 @@ type Hero struct { Attribute string `json:"attribute"` Remark string `json:"remark"` RawJSON string `json:"rawJson"` - SetContentJSON string `json:"setContentJson"` - SetUpdateTime *time.Time `json:"setUpdateTime"` + ContentJSONSet string `json:"contentJsonSet"` + UpdateTimeSet *time.Time `json:"updateTimeSet"` } diff --git a/internal/ent/epicheroinfo.go b/internal/ent/epicheroinfo.go index 73d479b..f0c5dfc 100644 --- a/internal/ent/epicheroinfo.go +++ b/internal/ent/epicheroinfo.go @@ -49,10 +49,10 @@ type EpicHeroInfo struct { 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"` + // ContentJSONSet holds the value of the "content_json_set" field. + ContentJSONSet string `json:"content_json_set,omitempty"` + // UpdateTimeSet holds the value of the "update_time_set" field. + UpdateTimeSet *time.Time `json:"update_time_set,omitempty"` selectValues sql.SelectValues } @@ -65,9 +65,9 @@ func (*EpicHeroInfo) scanValues(columns []string) ([]any, error) { 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: + 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.FieldContentJSONSet: values[i] = new(sql.NullString) - case epicheroinfo.FieldCreateTime, epicheroinfo.FieldUpdateTime, epicheroinfo.FieldSetUpdateTime: + case epicheroinfo.FieldCreateTime, epicheroinfo.FieldUpdateTime, epicheroinfo.FieldUpdateTimeSet: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) @@ -188,18 +188,18 @@ func (_m *EpicHeroInfo) assignValues(columns []string, values []any) error { } else if value.Valid { _m.RawJSON = value.String } - case epicheroinfo.FieldSetContentJSON: + case epicheroinfo.FieldContentJSONSet: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field set_content_json", values[i]) + return fmt.Errorf("unexpected type %T for field content_json_set", values[i]) } else if value.Valid { - _m.SetContentJSON = value.String + _m.ContentJSONSet = value.String } - case epicheroinfo.FieldSetUpdateTime: + case epicheroinfo.FieldUpdateTimeSet: if value, ok := values[i].(*sql.NullTime); !ok { - return fmt.Errorf("unexpected type %T for field set_update_time", values[i]) + return fmt.Errorf("unexpected type %T for field update_time_set", values[i]) } else if value.Valid { - _m.SetUpdateTime = new(time.Time) - *_m.SetUpdateTime = value.Time + _m.UpdateTimeSet = new(time.Time) + *_m.UpdateTimeSet = value.Time } default: _m.selectValues.Set(columns[i], values[i]) @@ -289,11 +289,11 @@ func (_m *EpicHeroInfo) String() string { builder.WriteString("raw_json=") builder.WriteString(_m.RawJSON) builder.WriteString(", ") - builder.WriteString("set_content_json=") - builder.WriteString(_m.SetContentJSON) + builder.WriteString("content_json_set=") + builder.WriteString(_m.ContentJSONSet) builder.WriteString(", ") - if v := _m.SetUpdateTime; v != nil { - builder.WriteString("set_update_time=") + if v := _m.UpdateTimeSet; v != nil { + builder.WriteString("update_time_set=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteByte(')') diff --git a/internal/ent/epicheroinfo/epicheroinfo.go b/internal/ent/epicheroinfo/epicheroinfo.go index 045051b..d8ba67b 100644 --- a/internal/ent/epicheroinfo/epicheroinfo.go +++ b/internal/ent/epicheroinfo/epicheroinfo.go @@ -43,10 +43,10 @@ const ( 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" + // FieldContentJSONSet holds the string denoting the content_json_set field in the database. + FieldContentJSONSet = "content_json_set" + // FieldUpdateTimeSet holds the string denoting the update_time_set field in the database. + FieldUpdateTimeSet = "update_time_set" // Table holds the table name of the epicheroinfo in the database. Table = "epic_hero_infos" ) @@ -70,8 +70,8 @@ var Columns = []string{ FieldAttribute, FieldRemark, FieldRawJSON, - FieldSetContentJSON, - FieldSetUpdateTime, + FieldContentJSONSet, + FieldUpdateTimeSet, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -111,8 +111,8 @@ var ( 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 + // ContentJSONSetValidator is a validator for the "content_json_set" field. It is called by the builders before save. + ContentJSONSetValidator func(string) error ) // OrderOption defines the ordering options for the EpicHeroInfo queries. @@ -203,12 +203,12 @@ 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() +// ByContentJSONSet orders the results by the content_json_set field. +func ByContentJSONSet(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldContentJSONSet, opts...).ToFunc() } -// BySetUpdateTime orders the results by the set_update_time field. -func BySetUpdateTime(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSetUpdateTime, opts...).ToFunc() +// ByUpdateTimeSet orders the results by the update_time_set field. +func ByUpdateTimeSet(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdateTimeSet, opts...).ToFunc() } diff --git a/internal/ent/epicheroinfo/where.go b/internal/ent/epicheroinfo/where.go index 6533d20..bc56e6e 100644 --- a/internal/ent/epicheroinfo/where.go +++ b/internal/ent/epicheroinfo/where.go @@ -134,14 +134,14 @@ func RawJSON(v string) predicate.EpicHeroInfo { return predicate.EpicHeroInfo(sql.FieldEQ(FieldRawJSON, v)) } -// SetContentJSON applies equality check predicate on the "set_content_json" field. It's identical to SetContentJSONEQ. -func SetContentJSON(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetContentJSON, v)) +// ContentJSONSet applies equality check predicate on the "content_json_set" field. It's identical to ContentJSONSetEQ. +func ContentJSONSet(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldEQ(FieldContentJSONSet, v)) } -// SetUpdateTime applies equality check predicate on the "set_update_time" field. It's identical to SetUpdateTimeEQ. -func SetUpdateTime(v time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetUpdateTime, v)) +// UpdateTimeSet applies equality check predicate on the "update_time_set" field. It's identical to UpdateTimeSetEQ. +func UpdateTimeSet(v time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldEQ(FieldUpdateTimeSet, v)) } // HeroNameEQ applies the EQ predicate on the "hero_name" field. @@ -1099,119 +1099,119 @@ func RawJSONContainsFold(v string) predicate.EpicHeroInfo { return predicate.EpicHeroInfo(sql.FieldContainsFold(FieldRawJSON, v)) } -// SetContentJSONEQ applies the EQ predicate on the "set_content_json" field. -func SetContentJSONEQ(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetContentJSON, v)) +// ContentJSONSetEQ applies the EQ predicate on the "content_json_set" field. +func ContentJSONSetEQ(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldEQ(FieldContentJSONSet, v)) } -// SetContentJSONNEQ applies the NEQ predicate on the "set_content_json" field. -func SetContentJSONNEQ(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldNEQ(FieldSetContentJSON, v)) +// ContentJSONSetNEQ applies the NEQ predicate on the "content_json_set" field. +func ContentJSONSetNEQ(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldNEQ(FieldContentJSONSet, v)) } -// SetContentJSONIn applies the In predicate on the "set_content_json" field. -func SetContentJSONIn(vs ...string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldIn(FieldSetContentJSON, vs...)) +// ContentJSONSetIn applies the In predicate on the "content_json_set" field. +func ContentJSONSetIn(vs ...string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldIn(FieldContentJSONSet, vs...)) } -// SetContentJSONNotIn applies the NotIn predicate on the "set_content_json" field. -func SetContentJSONNotIn(vs ...string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldNotIn(FieldSetContentJSON, vs...)) +// ContentJSONSetNotIn applies the NotIn predicate on the "content_json_set" field. +func ContentJSONSetNotIn(vs ...string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldNotIn(FieldContentJSONSet, vs...)) } -// SetContentJSONGT applies the GT predicate on the "set_content_json" field. -func SetContentJSONGT(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldGT(FieldSetContentJSON, v)) +// ContentJSONSetGT applies the GT predicate on the "content_json_set" field. +func ContentJSONSetGT(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldGT(FieldContentJSONSet, v)) } -// SetContentJSONGTE applies the GTE predicate on the "set_content_json" field. -func SetContentJSONGTE(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldGTE(FieldSetContentJSON, v)) +// ContentJSONSetGTE applies the GTE predicate on the "content_json_set" field. +func ContentJSONSetGTE(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldGTE(FieldContentJSONSet, v)) } -// SetContentJSONLT applies the LT predicate on the "set_content_json" field. -func SetContentJSONLT(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldLT(FieldSetContentJSON, v)) +// ContentJSONSetLT applies the LT predicate on the "content_json_set" field. +func ContentJSONSetLT(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldLT(FieldContentJSONSet, v)) } -// SetContentJSONLTE applies the LTE predicate on the "set_content_json" field. -func SetContentJSONLTE(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldLTE(FieldSetContentJSON, v)) +// ContentJSONSetLTE applies the LTE predicate on the "content_json_set" field. +func ContentJSONSetLTE(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldLTE(FieldContentJSONSet, v)) } -// SetContentJSONContains applies the Contains predicate on the "set_content_json" field. -func SetContentJSONContains(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldContains(FieldSetContentJSON, v)) +// ContentJSONSetContains applies the Contains predicate on the "content_json_set" field. +func ContentJSONSetContains(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldContains(FieldContentJSONSet, v)) } -// SetContentJSONHasPrefix applies the HasPrefix predicate on the "set_content_json" field. -func SetContentJSONHasPrefix(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldHasPrefix(FieldSetContentJSON, v)) +// ContentJSONSetHasPrefix applies the HasPrefix predicate on the "content_json_set" field. +func ContentJSONSetHasPrefix(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldHasPrefix(FieldContentJSONSet, v)) } -// SetContentJSONHasSuffix applies the HasSuffix predicate on the "set_content_json" field. -func SetContentJSONHasSuffix(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldHasSuffix(FieldSetContentJSON, v)) +// ContentJSONSetHasSuffix applies the HasSuffix predicate on the "content_json_set" field. +func ContentJSONSetHasSuffix(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldHasSuffix(FieldContentJSONSet, v)) } -// SetContentJSONEqualFold applies the EqualFold predicate on the "set_content_json" field. -func SetContentJSONEqualFold(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldEqualFold(FieldSetContentJSON, v)) +// ContentJSONSetEqualFold applies the EqualFold predicate on the "content_json_set" field. +func ContentJSONSetEqualFold(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldEqualFold(FieldContentJSONSet, v)) } -// SetContentJSONContainsFold applies the ContainsFold predicate on the "set_content_json" field. -func SetContentJSONContainsFold(v string) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldContainsFold(FieldSetContentJSON, v)) +// ContentJSONSetContainsFold applies the ContainsFold predicate on the "content_json_set" field. +func ContentJSONSetContainsFold(v string) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldContainsFold(FieldContentJSONSet, v)) } -// SetUpdateTimeEQ applies the EQ predicate on the "set_update_time" field. -func SetUpdateTimeEQ(v time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetUpdateTime, v)) +// UpdateTimeSetEQ applies the EQ predicate on the "update_time_set" field. +func UpdateTimeSetEQ(v time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldEQ(FieldUpdateTimeSet, v)) } -// SetUpdateTimeNEQ applies the NEQ predicate on the "set_update_time" field. -func SetUpdateTimeNEQ(v time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldNEQ(FieldSetUpdateTime, v)) +// UpdateTimeSetNEQ applies the NEQ predicate on the "update_time_set" field. +func UpdateTimeSetNEQ(v time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldNEQ(FieldUpdateTimeSet, v)) } -// SetUpdateTimeIn applies the In predicate on the "set_update_time" field. -func SetUpdateTimeIn(vs ...time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldIn(FieldSetUpdateTime, vs...)) +// UpdateTimeSetIn applies the In predicate on the "update_time_set" field. +func UpdateTimeSetIn(vs ...time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldIn(FieldUpdateTimeSet, vs...)) } -// SetUpdateTimeNotIn applies the NotIn predicate on the "set_update_time" field. -func SetUpdateTimeNotIn(vs ...time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldNotIn(FieldSetUpdateTime, vs...)) +// UpdateTimeSetNotIn applies the NotIn predicate on the "update_time_set" field. +func UpdateTimeSetNotIn(vs ...time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldNotIn(FieldUpdateTimeSet, vs...)) } -// SetUpdateTimeGT applies the GT predicate on the "set_update_time" field. -func SetUpdateTimeGT(v time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldGT(FieldSetUpdateTime, v)) +// UpdateTimeSetGT applies the GT predicate on the "update_time_set" field. +func UpdateTimeSetGT(v time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldGT(FieldUpdateTimeSet, v)) } -// SetUpdateTimeGTE applies the GTE predicate on the "set_update_time" field. -func SetUpdateTimeGTE(v time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldGTE(FieldSetUpdateTime, v)) +// UpdateTimeSetGTE applies the GTE predicate on the "update_time_set" field. +func UpdateTimeSetGTE(v time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldGTE(FieldUpdateTimeSet, v)) } -// SetUpdateTimeLT applies the LT predicate on the "set_update_time" field. -func SetUpdateTimeLT(v time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldLT(FieldSetUpdateTime, v)) +// UpdateTimeSetLT applies the LT predicate on the "update_time_set" field. +func UpdateTimeSetLT(v time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldLT(FieldUpdateTimeSet, v)) } -// SetUpdateTimeLTE applies the LTE predicate on the "set_update_time" field. -func SetUpdateTimeLTE(v time.Time) predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldLTE(FieldSetUpdateTime, v)) +// UpdateTimeSetLTE applies the LTE predicate on the "update_time_set" field. +func UpdateTimeSetLTE(v time.Time) predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldLTE(FieldUpdateTimeSet, v)) } -// SetUpdateTimeIsNil applies the IsNil predicate on the "set_update_time" field. -func SetUpdateTimeIsNil() predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldIsNull(FieldSetUpdateTime)) +// UpdateTimeSetIsNil applies the IsNil predicate on the "update_time_set" field. +func UpdateTimeSetIsNil() predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldIsNull(FieldUpdateTimeSet)) } -// SetUpdateTimeNotNil applies the NotNil predicate on the "set_update_time" field. -func SetUpdateTimeNotNil() predicate.EpicHeroInfo { - return predicate.EpicHeroInfo(sql.FieldNotNull(FieldSetUpdateTime)) +// UpdateTimeSetNotNil applies the NotNil predicate on the "update_time_set" field. +func UpdateTimeSetNotNil() predicate.EpicHeroInfo { + return predicate.EpicHeroInfo(sql.FieldNotNull(FieldUpdateTimeSet)) } // And groups predicates with the AND operator between them. diff --git a/internal/ent/epicheroinfo_create.go b/internal/ent/epicheroinfo_create.go index 8fc410b..c42b8b6 100644 --- a/internal/ent/epicheroinfo_create.go +++ b/internal/ent/epicheroinfo_create.go @@ -132,22 +132,22 @@ func (_c *EpicHeroInfoCreate) SetRawJSON(v string) *EpicHeroInfoCreate { return _c } -// SetSetContentJSON sets the "set_content_json" field. -func (_c *EpicHeroInfoCreate) SetSetContentJSON(v string) *EpicHeroInfoCreate { - _c.mutation.SetSetContentJSON(v) +// SetContentJSONSet sets the "content_json_set" field. +func (_c *EpicHeroInfoCreate) SetContentJSONSet(v string) *EpicHeroInfoCreate { + _c.mutation.SetContentJSONSet(v) return _c } -// SetSetUpdateTime sets the "set_update_time" field. -func (_c *EpicHeroInfoCreate) SetSetUpdateTime(v time.Time) *EpicHeroInfoCreate { - _c.mutation.SetSetUpdateTime(v) +// SetUpdateTimeSet sets the "update_time_set" field. +func (_c *EpicHeroInfoCreate) SetUpdateTimeSet(v time.Time) *EpicHeroInfoCreate { + _c.mutation.SetUpdateTimeSet(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 { +// SetNillableUpdateTimeSet sets the "update_time_set" field if the given value is not nil. +func (_c *EpicHeroInfoCreate) SetNillableUpdateTimeSet(v *time.Time) *EpicHeroInfoCreate { if v != nil { - _c.SetSetUpdateTime(*v) + _c.SetUpdateTimeSet(*v) } return _c } @@ -299,12 +299,12 @@ func (_c *EpicHeroInfoCreate) check() error { 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 _, ok := _c.mutation.ContentJSONSet(); !ok { + return &ValidationError{Name: "content_json_set", err: errors.New(`ent: missing required field "EpicHeroInfo.content_json_set"`)} } - 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)} + if v, ok := _c.mutation.ContentJSONSet(); ok { + if err := epicheroinfo.ContentJSONSetValidator(v); err != nil { + return &ValidationError{Name: "content_json_set", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.content_json_set": %w`, err)} } } return nil @@ -403,13 +403,13 @@ func (_c *EpicHeroInfoCreate) createSpec() (*EpicHeroInfo, *sqlgraph.CreateSpec) _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.ContentJSONSet(); ok { + _spec.SetField(epicheroinfo.FieldContentJSONSet, field.TypeString, value) + _node.ContentJSONSet = value } - if value, ok := _c.mutation.SetUpdateTime(); ok { - _spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value) - _node.SetUpdateTime = &value + if value, ok := _c.mutation.UpdateTimeSet(); ok { + _spec.SetField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime, value) + _node.UpdateTimeSet = &value } return _node, _spec } diff --git a/internal/ent/epicheroinfo_update.go b/internal/ent/epicheroinfo_update.go index 702b411..7764113 100644 --- a/internal/ent/epicheroinfo_update.go +++ b/internal/ent/epicheroinfo_update.go @@ -264,37 +264,37 @@ func (_u *EpicHeroInfoUpdate) SetNillableRawJSON(v *string) *EpicHeroInfoUpdate return _u } -// SetSetContentJSON sets the "set_content_json" field. -func (_u *EpicHeroInfoUpdate) SetSetContentJSON(v string) *EpicHeroInfoUpdate { - _u.mutation.SetSetContentJSON(v) +// SetContentJSONSet sets the "content_json_set" field. +func (_u *EpicHeroInfoUpdate) SetContentJSONSet(v string) *EpicHeroInfoUpdate { + _u.mutation.SetContentJSONSet(v) return _u } -// SetNillableSetContentJSON sets the "set_content_json" field if the given value is not nil. -func (_u *EpicHeroInfoUpdate) SetNillableSetContentJSON(v *string) *EpicHeroInfoUpdate { +// SetNillableContentJSONSet sets the "content_json_set" field if the given value is not nil. +func (_u *EpicHeroInfoUpdate) SetNillableContentJSONSet(v *string) *EpicHeroInfoUpdate { if v != nil { - _u.SetSetContentJSON(*v) + _u.SetContentJSONSet(*v) } return _u } -// SetSetUpdateTime sets the "set_update_time" field. -func (_u *EpicHeroInfoUpdate) SetSetUpdateTime(v time.Time) *EpicHeroInfoUpdate { - _u.mutation.SetSetUpdateTime(v) +// SetUpdateTimeSet sets the "update_time_set" field. +func (_u *EpicHeroInfoUpdate) SetUpdateTimeSet(v time.Time) *EpicHeroInfoUpdate { + _u.mutation.SetUpdateTimeSet(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 { +// SetNillableUpdateTimeSet sets the "update_time_set" field if the given value is not nil. +func (_u *EpicHeroInfoUpdate) SetNillableUpdateTimeSet(v *time.Time) *EpicHeroInfoUpdate { if v != nil { - _u.SetSetUpdateTime(*v) + _u.SetUpdateTimeSet(*v) } return _u } -// ClearSetUpdateTime clears the value of the "set_update_time" field. -func (_u *EpicHeroInfoUpdate) ClearSetUpdateTime() *EpicHeroInfoUpdate { - _u.mutation.ClearSetUpdateTime() +// ClearUpdateTimeSet clears the value of the "update_time_set" field. +func (_u *EpicHeroInfoUpdate) ClearUpdateTimeSet() *EpicHeroInfoUpdate { + _u.mutation.ClearUpdateTimeSet() return _u } @@ -397,9 +397,9 @@ func (_u *EpicHeroInfoUpdate) check() error { 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)} + if v, ok := _u.mutation.ContentJSONSet(); ok { + if err := epicheroinfo.ContentJSONSetValidator(v); err != nil { + return &ValidationError{Name: "content_json_set", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.content_json_set": %w`, err)} } } return nil @@ -471,14 +471,14 @@ func (_u *EpicHeroInfoUpdate) sqlSave(ctx context.Context) (_node int, err error 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.ContentJSONSet(); ok { + _spec.SetField(epicheroinfo.FieldContentJSONSet, field.TypeString, value) } - if value, ok := _u.mutation.SetUpdateTime(); ok { - _spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value) + if value, ok := _u.mutation.UpdateTimeSet(); ok { + _spec.SetField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime, value) } - if _u.mutation.SetUpdateTimeCleared() { - _spec.ClearField(epicheroinfo.FieldSetUpdateTime, field.TypeTime) + if _u.mutation.UpdateTimeSetCleared() { + _spec.ClearField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime) } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { @@ -736,37 +736,37 @@ func (_u *EpicHeroInfoUpdateOne) SetNillableRawJSON(v *string) *EpicHeroInfoUpda return _u } -// SetSetContentJSON sets the "set_content_json" field. -func (_u *EpicHeroInfoUpdateOne) SetSetContentJSON(v string) *EpicHeroInfoUpdateOne { - _u.mutation.SetSetContentJSON(v) +// SetContentJSONSet sets the "content_json_set" field. +func (_u *EpicHeroInfoUpdateOne) SetContentJSONSet(v string) *EpicHeroInfoUpdateOne { + _u.mutation.SetContentJSONSet(v) return _u } -// SetNillableSetContentJSON sets the "set_content_json" field if the given value is not nil. -func (_u *EpicHeroInfoUpdateOne) SetNillableSetContentJSON(v *string) *EpicHeroInfoUpdateOne { +// SetNillableContentJSONSet sets the "content_json_set" field if the given value is not nil. +func (_u *EpicHeroInfoUpdateOne) SetNillableContentJSONSet(v *string) *EpicHeroInfoUpdateOne { if v != nil { - _u.SetSetContentJSON(*v) + _u.SetContentJSONSet(*v) } return _u } -// SetSetUpdateTime sets the "set_update_time" field. -func (_u *EpicHeroInfoUpdateOne) SetSetUpdateTime(v time.Time) *EpicHeroInfoUpdateOne { - _u.mutation.SetSetUpdateTime(v) +// SetUpdateTimeSet sets the "update_time_set" field. +func (_u *EpicHeroInfoUpdateOne) SetUpdateTimeSet(v time.Time) *EpicHeroInfoUpdateOne { + _u.mutation.SetUpdateTimeSet(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 { +// SetNillableUpdateTimeSet sets the "update_time_set" field if the given value is not nil. +func (_u *EpicHeroInfoUpdateOne) SetNillableUpdateTimeSet(v *time.Time) *EpicHeroInfoUpdateOne { if v != nil { - _u.SetSetUpdateTime(*v) + _u.SetUpdateTimeSet(*v) } return _u } -// ClearSetUpdateTime clears the value of the "set_update_time" field. -func (_u *EpicHeroInfoUpdateOne) ClearSetUpdateTime() *EpicHeroInfoUpdateOne { - _u.mutation.ClearSetUpdateTime() +// ClearUpdateTimeSet clears the value of the "update_time_set" field. +func (_u *EpicHeroInfoUpdateOne) ClearUpdateTimeSet() *EpicHeroInfoUpdateOne { + _u.mutation.ClearUpdateTimeSet() return _u } @@ -882,9 +882,9 @@ func (_u *EpicHeroInfoUpdateOne) check() error { 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)} + if v, ok := _u.mutation.ContentJSONSet(); ok { + if err := epicheroinfo.ContentJSONSetValidator(v); err != nil { + return &ValidationError{Name: "content_json_set", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.content_json_set": %w`, err)} } } return nil @@ -973,14 +973,14 @@ func (_u *EpicHeroInfoUpdateOne) sqlSave(ctx context.Context) (_node *EpicHeroIn 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.ContentJSONSet(); ok { + _spec.SetField(epicheroinfo.FieldContentJSONSet, field.TypeString, value) } - if value, ok := _u.mutation.SetUpdateTime(); ok { - _spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value) + if value, ok := _u.mutation.UpdateTimeSet(); ok { + _spec.SetField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime, value) } - if _u.mutation.SetUpdateTimeCleared() { - _spec.ClearField(epicheroinfo.FieldSetUpdateTime, field.TypeTime) + if _u.mutation.UpdateTimeSetCleared() { + _spec.ClearField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime) } _node = &EpicHeroInfo{config: _u.config} _spec.Assign = _node.assignValues diff --git a/internal/ent/migrate/schema.go b/internal/ent/migrate/schema.go index 0e80fe5..bbba931 100644 --- a/internal/ent/migrate/schema.go +++ b/internal/ent/migrate/schema.go @@ -105,8 +105,8 @@ var ( {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}, + {Name: "content_json_set", Type: field.TypeString, Size: 255}, + {Name: "update_time_set", Type: field.TypeTime, Nullable: true}, } // EpicHeroInfosTable holds the schema information for the "epic_hero_infos" table. EpicHeroInfosTable = &schema.Table{ diff --git a/internal/ent/mutation.go b/internal/ent/mutation.go index f64787f..874f9c6 100644 --- a/internal/ent/mutation.go +++ b/internal/ent/mutation.go @@ -3564,8 +3564,8 @@ type EpicHeroInfoMutation struct { attribute *string remark *string raw_json *string - set_content_json *string - set_update_time *time.Time + content_json_set *string + update_time_set *time.Time clearedFields map[string]struct{} done bool oldValue func(context.Context) (*EpicHeroInfo, error) @@ -4278,89 +4278,89 @@ func (m *EpicHeroInfoMutation) ResetRawJSON() { m.raw_json = nil } -// SetSetContentJSON sets the "set_content_json" field. -func (m *EpicHeroInfoMutation) SetSetContentJSON(s string) { - m.set_content_json = &s +// SetContentJSONSet sets the "content_json_set" field. +func (m *EpicHeroInfoMutation) SetContentJSONSet(s string) { + m.content_json_set = &s } -// SetContentJSON returns the value of the "set_content_json" field in the mutation. -func (m *EpicHeroInfoMutation) SetContentJSON() (r string, exists bool) { - v := m.set_content_json +// ContentJSONSet returns the value of the "content_json_set" field in the mutation. +func (m *EpicHeroInfoMutation) ContentJSONSet() (r string, exists bool) { + v := m.content_json_set if v == nil { return } return *v, true } -// OldSetContentJSON returns the old "set_content_json" field's value of the EpicHeroInfo entity. +// OldContentJSONSet returns the old "content_json_set" field's value of the EpicHeroInfo entity. // If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *EpicHeroInfoMutation) OldSetContentJSON(ctx context.Context) (v string, err error) { +func (m *EpicHeroInfoMutation) OldContentJSONSet(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSetContentJSON is only allowed on UpdateOne operations") + return v, errors.New("OldContentJSONSet is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSetContentJSON requires an ID field in the mutation") + return v, errors.New("OldContentJSONSet requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldSetContentJSON: %w", err) + return v, fmt.Errorf("querying old value for OldContentJSONSet: %w", err) } - return oldValue.SetContentJSON, nil + return oldValue.ContentJSONSet, nil } -// ResetSetContentJSON resets all changes to the "set_content_json" field. -func (m *EpicHeroInfoMutation) ResetSetContentJSON() { - m.set_content_json = nil +// ResetContentJSONSet resets all changes to the "content_json_set" field. +func (m *EpicHeroInfoMutation) ResetContentJSONSet() { + m.content_json_set = nil } -// SetSetUpdateTime sets the "set_update_time" field. -func (m *EpicHeroInfoMutation) SetSetUpdateTime(t time.Time) { - m.set_update_time = &t +// SetUpdateTimeSet sets the "update_time_set" field. +func (m *EpicHeroInfoMutation) SetUpdateTimeSet(t time.Time) { + m.update_time_set = &t } -// SetUpdateTime returns the value of the "set_update_time" field in the mutation. -func (m *EpicHeroInfoMutation) SetUpdateTime() (r time.Time, exists bool) { - v := m.set_update_time +// UpdateTimeSet returns the value of the "update_time_set" field in the mutation. +func (m *EpicHeroInfoMutation) UpdateTimeSet() (r time.Time, exists bool) { + v := m.update_time_set if v == nil { return } return *v, true } -// OldSetUpdateTime returns the old "set_update_time" field's value of the EpicHeroInfo entity. +// OldUpdateTimeSet returns the old "update_time_set" field's value of the EpicHeroInfo entity. // If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *EpicHeroInfoMutation) OldSetUpdateTime(ctx context.Context) (v *time.Time, err error) { +func (m *EpicHeroInfoMutation) OldUpdateTimeSet(ctx context.Context) (v *time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSetUpdateTime is only allowed on UpdateOne operations") + return v, errors.New("OldUpdateTimeSet is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSetUpdateTime requires an ID field in the mutation") + return v, errors.New("OldUpdateTimeSet requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldSetUpdateTime: %w", err) + return v, fmt.Errorf("querying old value for OldUpdateTimeSet: %w", err) } - return oldValue.SetUpdateTime, nil + return oldValue.UpdateTimeSet, nil } -// ClearSetUpdateTime clears the value of the "set_update_time" field. -func (m *EpicHeroInfoMutation) ClearSetUpdateTime() { - m.set_update_time = nil - m.clearedFields[epicheroinfo.FieldSetUpdateTime] = struct{}{} +// ClearUpdateTimeSet clears the value of the "update_time_set" field. +func (m *EpicHeroInfoMutation) ClearUpdateTimeSet() { + m.update_time_set = nil + m.clearedFields[epicheroinfo.FieldUpdateTimeSet] = struct{}{} } -// SetUpdateTimeCleared returns if the "set_update_time" field was cleared in this mutation. -func (m *EpicHeroInfoMutation) SetUpdateTimeCleared() bool { - _, ok := m.clearedFields[epicheroinfo.FieldSetUpdateTime] +// UpdateTimeSetCleared returns if the "update_time_set" field was cleared in this mutation. +func (m *EpicHeroInfoMutation) UpdateTimeSetCleared() bool { + _, ok := m.clearedFields[epicheroinfo.FieldUpdateTimeSet] return ok } -// ResetSetUpdateTime resets all changes to the "set_update_time" field. -func (m *EpicHeroInfoMutation) ResetSetUpdateTime() { - m.set_update_time = nil - delete(m.clearedFields, epicheroinfo.FieldSetUpdateTime) +// ResetUpdateTimeSet resets all changes to the "update_time_set" field. +func (m *EpicHeroInfoMutation) ResetUpdateTimeSet() { + m.update_time_set = nil + delete(m.clearedFields, epicheroinfo.FieldUpdateTimeSet) } // Where appends a list predicates to the EpicHeroInfoMutation builder. @@ -4446,11 +4446,11 @@ func (m *EpicHeroInfoMutation) Fields() []string { if m.raw_json != nil { fields = append(fields, epicheroinfo.FieldRawJSON) } - if m.set_content_json != nil { - fields = append(fields, epicheroinfo.FieldSetContentJSON) + if m.content_json_set != nil { + fields = append(fields, epicheroinfo.FieldContentJSONSet) } - if m.set_update_time != nil { - fields = append(fields, epicheroinfo.FieldSetUpdateTime) + if m.update_time_set != nil { + fields = append(fields, epicheroinfo.FieldUpdateTimeSet) } return fields } @@ -4492,10 +4492,10 @@ func (m *EpicHeroInfoMutation) Field(name string) (ent.Value, bool) { return m.Remark() case epicheroinfo.FieldRawJSON: return m.RawJSON() - case epicheroinfo.FieldSetContentJSON: - return m.SetContentJSON() - case epicheroinfo.FieldSetUpdateTime: - return m.SetUpdateTime() + case epicheroinfo.FieldContentJSONSet: + return m.ContentJSONSet() + case epicheroinfo.FieldUpdateTimeSet: + return m.UpdateTimeSet() } return nil, false } @@ -4537,10 +4537,10 @@ func (m *EpicHeroInfoMutation) OldField(ctx context.Context, name string) (ent.V return m.OldRemark(ctx) case epicheroinfo.FieldRawJSON: return m.OldRawJSON(ctx) - case epicheroinfo.FieldSetContentJSON: - return m.OldSetContentJSON(ctx) - case epicheroinfo.FieldSetUpdateTime: - return m.OldSetUpdateTime(ctx) + case epicheroinfo.FieldContentJSONSet: + return m.OldContentJSONSet(ctx) + case epicheroinfo.FieldUpdateTimeSet: + return m.OldUpdateTimeSet(ctx) } return nil, fmt.Errorf("unknown EpicHeroInfo field %s", name) } @@ -4662,19 +4662,19 @@ func (m *EpicHeroInfoMutation) SetField(name string, value ent.Value) error { } m.SetRawJSON(v) return nil - case epicheroinfo.FieldSetContentJSON: + case epicheroinfo.FieldContentJSONSet: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetSetContentJSON(v) + m.SetContentJSONSet(v) return nil - case epicheroinfo.FieldSetUpdateTime: + case epicheroinfo.FieldUpdateTimeSet: v, ok := value.(time.Time) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetSetUpdateTime(v) + m.SetUpdateTimeSet(v) return nil } return fmt.Errorf("unknown EpicHeroInfo field %s", name) @@ -4712,8 +4712,8 @@ func (m *EpicHeroInfoMutation) ClearedFields() []string { if m.FieldCleared(epicheroinfo.FieldUpdateTime) { fields = append(fields, epicheroinfo.FieldUpdateTime) } - if m.FieldCleared(epicheroinfo.FieldSetUpdateTime) { - fields = append(fields, epicheroinfo.FieldSetUpdateTime) + if m.FieldCleared(epicheroinfo.FieldUpdateTimeSet) { + fields = append(fields, epicheroinfo.FieldUpdateTimeSet) } return fields } @@ -4735,8 +4735,8 @@ func (m *EpicHeroInfoMutation) ClearField(name string) error { case epicheroinfo.FieldUpdateTime: m.ClearUpdateTime() return nil - case epicheroinfo.FieldSetUpdateTime: - m.ClearSetUpdateTime() + case epicheroinfo.FieldUpdateTimeSet: + m.ClearUpdateTimeSet() return nil } return fmt.Errorf("unknown EpicHeroInfo nullable field %s", name) @@ -4794,11 +4794,11 @@ func (m *EpicHeroInfoMutation) ResetField(name string) error { case epicheroinfo.FieldRawJSON: m.ResetRawJSON() return nil - case epicheroinfo.FieldSetContentJSON: - m.ResetSetContentJSON() + case epicheroinfo.FieldContentJSONSet: + m.ResetContentJSONSet() return nil - case epicheroinfo.FieldSetUpdateTime: - m.ResetSetUpdateTime() + case epicheroinfo.FieldUpdateTimeSet: + m.ResetUpdateTimeSet() return nil } return fmt.Errorf("unknown EpicHeroInfo field %s", name) diff --git a/internal/ent/runtime.go b/internal/ent/runtime.go index 9e53fc7..f8d4546 100644 --- a/internal/ent/runtime.go +++ b/internal/ent/runtime.go @@ -165,10 +165,10 @@ func init() { 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) + // epicheroinfoDescContentJSONSet is the schema descriptor for content_json_set field. + epicheroinfoDescContentJSONSet := epicheroinfoFields[17].Descriptor() + // epicheroinfo.ContentJSONSetValidator is a validator for the "content_json_set" field. It is called by the builders before save. + epicheroinfo.ContentJSONSetValidator = epicheroinfoDescContentJSONSet.Validators[0].(func(string) error) epicherouserbuildFields := entity.EpicHeroUserBuild{}.Fields() _ = epicherouserbuildFields // epicherouserbuildDescArtifactCode is the schema descriptor for artifact_code field. diff --git a/internal/repository/health_repo.go b/internal/repository/health_repo.go deleted file mode 100644 index 6d103e3..0000000 --- a/internal/repository/health_repo.go +++ /dev/null @@ -1,15 +0,0 @@ -package repository - -import ( - "epic-ent/internal/domain/vo" -) - -type HealthRepository struct{} - -func NewHealthRepository() *HealthRepository { - return &HealthRepository{} -} - -func (r *HealthRepository) Check() vo.HealthStatus { - return vo.HealthStatus{Status: "ok"} -} diff --git a/internal/repository/hero_repo.go b/internal/repository/hero_repo.go index 0ca2adf..a7a81e0 100644 --- a/internal/repository/hero_repo.go +++ b/internal/repository/hero_repo.go @@ -35,7 +35,7 @@ func (r *HeroRepository) Create(ctx context.Context, req dto.HeroCreateRequest) SetAttribute(valueOrEmpty(req.Attribute)). SetRemark(valueOrEmpty(req.Remark)). SetRawJSON(valueOrEmpty(req.RawJSON)). - SetSetContentJSON(valueOrEmpty(req.SetContentJSON)) + SetContentJSONSet(valueOrEmpty(req.ContentJSONSet)) if req.CreateTime != nil { create.SetCreateTime(*req.CreateTime) @@ -43,8 +43,8 @@ func (r *HeroRepository) Create(ctx context.Context, req dto.HeroCreateRequest) if req.UpdateTime != nil { create.SetUpdateTime(*req.UpdateTime) } - if req.SetUpdateTime != nil { - create.SetSetUpdateTime(*req.SetUpdateTime) + if req.UpdateTimeSet != nil { + create.SetUpdateTimeSet(*req.UpdateTimeSet) } hero, err := create.Save(ctx) @@ -132,12 +132,12 @@ func (r *HeroRepository) Update(ctx context.Context, id int64, req dto.HeroUpdat update.SetRawJSON(*req.RawJSON) updated = true } - if req.SetContentJSON != nil { - update.SetSetContentJSON(*req.SetContentJSON) + if req.ContentJSONSet != nil { + update.SetContentJSONSet(*req.ContentJSONSet) updated = true } - if req.SetUpdateTime != nil { - update.SetSetUpdateTime(*req.SetUpdateTime) + if req.UpdateTimeSet != nil { + update.SetUpdateTimeSet(*req.UpdateTimeSet) updated = true } @@ -198,8 +198,8 @@ func toVO(hero *ent.EpicHeroInfo) vo.Hero { Attribute: hero.Attribute, Remark: hero.Remark, RawJSON: hero.RawJSON, - SetContentJSON: hero.SetContentJSON, - SetUpdateTime: hero.SetUpdateTime, + ContentJSONSet: hero.ContentJSONSet, + UpdateTimeSet: hero.UpdateTimeSet, } } diff --git a/internal/repository/module.go b/internal/repository/module.go index 0c01e12..91dd3fa 100644 --- a/internal/repository/module.go +++ b/internal/repository/module.go @@ -4,7 +4,6 @@ import "go.uber.org/fx" var Module = fx.Options( fx.Provide( - NewHealthRepository, NewHeroRepository, ), ) diff --git a/tools.go b/tools.go new file mode 100644 index 0000000..edacf8c --- /dev/null +++ b/tools.go @@ -0,0 +1,7 @@ +//go:build tools + +package tools + +import ( + _ "entgo.io/ent/cmd/ent" +)