From c0e8e340655860f5bd3e92397a10ef844320eb11 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:30:49 -0600 Subject: [PATCH] chore: bump all go dependencies (#614) * bump all * code-generation --- backend/go.mod | 53 ++--- backend/go.sum | 56 +++++ backend/internal/data/ent/attachment/where.go | 23 +- .../internal/data/ent/attachment_create.go | 4 + backend/internal/data/ent/authroles/where.go | 23 +- backend/internal/data/ent/authroles_create.go | 4 + backend/internal/data/ent/authtokens/where.go | 23 +- .../internal/data/ent/authtokens_create.go | 4 + backend/internal/data/ent/client.go | 212 +++++++++++++++++- backend/internal/data/ent/document/where.go | 23 +- backend/internal/data/ent/document_create.go | 4 + backend/internal/data/ent/document_update.go | 32 +++ backend/internal/data/ent/group/where.go | 23 +- backend/internal/data/ent/group_create.go | 4 + backend/internal/data/ent/group_update.go | 16 ++ .../data/ent/groupinvitationtoken/where.go | 23 +- .../data/ent/groupinvitationtoken_create.go | 4 + backend/internal/data/ent/item/where.go | 23 +- backend/internal/data/ent/item_create.go | 4 + backend/internal/data/ent/item_update.go | 16 ++ backend/internal/data/ent/itemfield/where.go | 23 +- backend/internal/data/ent/itemfield_create.go | 4 + backend/internal/data/ent/itemfield_update.go | 32 +++ backend/internal/data/ent/label/where.go | 23 +- backend/internal/data/ent/label_create.go | 4 + backend/internal/data/ent/label_update.go | 16 ++ backend/internal/data/ent/location/where.go | 23 +- backend/internal/data/ent/location_create.go | 4 + backend/internal/data/ent/location_update.go | 16 ++ .../data/ent/maintenanceentry/where.go | 23 +- .../data/ent/maintenanceentry_create.go | 4 + .../data/ent/maintenanceentry_update.go | 32 +++ backend/internal/data/ent/mutation.go | 3 + backend/internal/data/ent/notifier/where.go | 23 +- backend/internal/data/ent/notifier_create.go | 4 + backend/internal/data/ent/notifier_update.go | 64 ++++++ backend/internal/data/ent/runtime/runtime.go | 4 +- backend/internal/data/ent/user/where.go | 23 +- backend/internal/data/ent/user_create.go | 4 + backend/internal/data/ent/user_update.go | 48 ++++ 40 files changed, 659 insertions(+), 292 deletions(-) diff --git a/backend/go.mod b/backend/go.mod index d8bc592..4c252de 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -3,17 +3,17 @@ module github.com/hay-kot/homebox/backend go 1.20 require ( - ariga.io/atlas v0.12.0 - entgo.io/ent v0.12.3 - github.com/ardanlabs/conf/v3 v3.1.6 + ariga.io/atlas v0.15.0 + entgo.io/ent v0.12.5 + github.com/ardanlabs/conf/v3 v3.1.7 github.com/containrrr/shoutrrr v0.8.0 github.com/go-chi/chi/v5 v5.0.10 - github.com/go-playground/validator/v10 v10.15.5 + github.com/go-playground/validator/v10 v10.16.0 github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d - github.com/google/uuid v1.3.1 - github.com/gorilla/schema v1.2.0 + github.com/google/uuid v1.4.0 + github.com/gorilla/schema v1.2.1 github.com/hay-kot/httpkit v0.0.3 - github.com/mattn/go-sqlite3 v1.14.17 + github.com/mattn/go-sqlite3 v1.14.18 github.com/olahol/melody v1.1.4 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.31.0 @@ -22,19 +22,20 @@ require ( github.com/swaggo/swag v1.16.2 github.com/yeqown/go-qrcode/v2 v2.2.2 github.com/yeqown/go-qrcode/writer/standard v1.2.2 - golang.org/x/crypto v0.14.0 - modernc.org/sqlite v1.26.0 + golang.org/x/crypto v0.15.0 + modernc.org/sqlite v1.27.0 ) require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/fogleman/gg v1.3.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/go-openapi/inflect v0.19.0 // indirect github.com/go-openapi/jsonpointer v0.20.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect @@ -43,36 +44,36 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/hashicorp/hcl/v2 v2.17.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/gorilla/websocket v1.5.1 // indirect + github.com/hashicorp/hcl/v2 v2.19.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/leodido/go-urn v1.2.4 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/swaggo/files v1.0.1 // indirect github.com/yeqown/reedsolomon v1.0.0 // indirect - github.com/zclconf/go-cty v1.13.2 // indirect - golang.org/x/image v0.9.0 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.11.0 // indirect + github.com/zclconf/go-cty v1.14.1 // indirect + golang.org/x/image v0.14.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.3.0 // indirect modernc.org/cc/v3 v3.41.0 // indirect - modernc.org/ccgo/v3 v3.16.14 // indirect - modernc.org/libc v1.24.1 // indirect + modernc.org/ccgo/v3 v3.16.15 // indirect + modernc.org/libc v1.34.4 // indirect modernc.org/mathutil v1.6.0 // indirect - modernc.org/memory v1.6.0 // indirect + modernc.org/memory v1.7.2 // indirect modernc.org/opt v0.1.3 // indirect - modernc.org/strutil v1.1.3 // indirect + modernc.org/strutil v1.2.0 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/backend/go.sum b/backend/go.sum index f0cae63..b599067 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -1,7 +1,11 @@ ariga.io/atlas v0.12.0 h1:jDfjxT3ppKhzqLS26lZv9ni7p9TVNrhy7SQquaF7bPs= ariga.io/atlas v0.12.0/go.mod h1:+TR129FJZ5Lvzms6dvCeGWh1yR6hMvmXBhug4hrNIGk= +ariga.io/atlas v0.15.0 h1:9lwSVcO/D3WgaCzstSGqR1hEDtsGibu6JqUofEI/0sY= +ariga.io/atlas v0.15.0/go.mod h1:isZrlzJ5cpoCoKFoY9knZug7Lq4pP1cm8g3XciLZ0Pw= entgo.io/ent v0.12.3 h1:N5lO2EOrHpCH5HYfiMOCHYbo+oh5M8GjT0/cx5x6xkk= entgo.io/ent v0.12.3/go.mod h1:AigGGx+tbrBBYHAzGOg8ND661E5cxx1Uiu5o/otJ6Yg= +entgo.io/ent v0.12.5 h1:KREM5E4CSoej4zeGa88Ou/gfturAnpUv0mzAjch1sj4= +entgo.io/ent v0.12.5/go.mod h1:Y3JVAjtlIk8xVZYSn3t3mf8xlZIn5SAOXZQxD6kKI+Q= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= @@ -9,8 +13,12 @@ github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7l github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/ardanlabs/conf/v3 v3.1.6 h1:t6AkG131ncy21ko18KQvBIc6+fWGZHTho12fd8JaUo8= github.com/ardanlabs/conf/v3 v3.1.6/go.mod h1:zclexWKe0NVj6LHQ8NgDDZ7bQ1spE0KeKPFficdtAjU= +github.com/ardanlabs/conf/v3 v3.1.7 h1:p232cF68TafoA5U9ZlbxUIhGJtGNdKHBXF80Fdqb5t0= +github.com/ardanlabs/conf/v3 v3.1.7/go.mod h1:zclexWKe0NVj6LHQ8NgDDZ7bQ1spE0KeKPFficdtAjU= github.com/containrrr/shoutrrr v0.8.0 h1:mfG2ATzIS7NR2Ec6XL+xyoHzN97H8WPjir8aYzJUSec= github.com/containrrr/shoutrrr v0.8.0/go.mod h1:ioyQAyu1LJY6sILuNyKaQaw+9Ttik5QePU8atnAdO2o= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -22,10 +30,14 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= @@ -53,6 +65,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE= +github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d h1:KbPOUXFUDJxwZ04vbmDOc3yuruGvVO+LOa7cVER3yWw= @@ -64,15 +78,27 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +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/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= +github.com/gorilla/schema v1.2.1 h1:tjDxcmdb+siIqkTNoV+qRH2mjYdr2hHe5MKXbp61ziM= +github.com/gorilla/schema v1.2.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl/v2 v2.17.0 h1:z1XvSUyXd1HP10U4lrLg5e0JMVz6CPaJvAgxM0KNZVY= github.com/hashicorp/hcl/v2 v2.17.0/go.mod h1:gJyW2PTShkJqQBKpAmPO3yxMxIuoXkOF2TpqXzrQyx4= +github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= +github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hay-kot/httpkit v0.0.3 h1:QYq01J5Jrn+ie0s1ptavNSEyydkOHqsrw4RLp+2LeJQ= github.com/hay-kot/httpkit v0.0.3/go.mod h1:1s/OJwWRyH6tBtTw76jTp6kwBYvjswziXaokPQH7eKQ= github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc= @@ -100,10 +126,14 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.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.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI= +github.com/mattn/go-sqlite3 v1.14.18/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/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= @@ -155,16 +185,24 @@ github.com/yeqown/reedsolomon v1.0.0/go.mod h1:P76zpcn2TCuL0ul1Fso373qHRc69LKwAw github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0= github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= +github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= +github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g= golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0= +golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4= +golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -172,6 +210,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -187,6 +227,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -197,12 +239,16 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -223,20 +269,30 @@ modernc.org/cc/v3 v3.41.0 h1:QoR1Sn3YWlmA1T4vLaKZfawdVtSiGx8H+cEojbC7v1Q= modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y= modernc.org/ccgo/v3 v3.16.14 h1:af6KNtFgsVmnDYrWk3PQCS9XT6BXe7o3ZFJKkIKvXNQ= modernc.org/ccgo/v3 v3.16.14/go.mod h1:mPDSujUIaTNWQSG4eqKw+atqLOEbma6Ncsa94WbC9zo= +modernc.org/ccgo/v3 v3.16.15 h1:KbDR3ZAVU+wiLyMESPtbtE/Add4elztFyfsWoNTgxS0= +modernc.org/ccgo/v3 v3.16.15/go.mod h1:yT7B+/E2m43tmMOT51GMoM98/MtHIcQQSleGnddkUNI= modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= +modernc.org/libc v1.34.4 h1:r9+5s4wNeoCsB8CuJE67UB4N07ernbvrcry9O3MLWtQ= +modernc.org/libc v1.34.4/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.6.0 h1:i6mzavxrE9a30whzMfwf7XWVODx2r5OYXvU46cirX7o= modernc.org/memory v1.6.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= +modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/sqlite v1.26.0 h1:SocQdLRSYlA8W99V8YH0NES75thx19d9sB/aFc4R8Lw= modernc.org/sqlite v1.26.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU= +modernc.org/sqlite v1.27.0 h1:MpKAHoyYB7xqcwnUwkuD+npwEa0fojF0B5QRbN+auJ8= +modernc.org/sqlite v1.27.0/go.mod h1:Qxpazz0zH8Z1xCFyi5GSL3FzbtZ3fvbjmywNogldEW0= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= +modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= +modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/backend/internal/data/ent/attachment/where.go b/backend/internal/data/ent/attachment/where.go index b911718..f6950f3 100644 --- a/backend/internal/data/ent/attachment/where.go +++ b/backend/internal/data/ent/attachment/where.go @@ -229,32 +229,15 @@ func HasDocumentWith(preds ...predicate.Document) predicate.Attachment { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Attachment) predicate.Attachment { - return predicate.Attachment(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Attachment(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Attachment) predicate.Attachment { - return predicate.Attachment(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Attachment(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Attachment) predicate.Attachment { - return predicate.Attachment(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Attachment(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/attachment_create.go b/backend/internal/data/ent/attachment_create.go index fd89284..d1a0b5b 100644 --- a/backend/internal/data/ent/attachment_create.go +++ b/backend/internal/data/ent/attachment_create.go @@ -288,11 +288,15 @@ func (ac *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) { // AttachmentCreateBulk is the builder for creating many Attachment entities in bulk. type AttachmentCreateBulk struct { config + err error builders []*AttachmentCreate } // Save creates the Attachment entities in the database. func (acb *AttachmentCreateBulk) Save(ctx context.Context) ([]*Attachment, error) { + if acb.err != nil { + return nil, acb.err + } specs := make([]*sqlgraph.CreateSpec, len(acb.builders)) nodes := make([]*Attachment, len(acb.builders)) mutators := make([]Mutator, len(acb.builders)) diff --git a/backend/internal/data/ent/authroles/where.go b/backend/internal/data/ent/authroles/where.go index 218aa54..bb5b54a 100644 --- a/backend/internal/data/ent/authroles/where.go +++ b/backend/internal/data/ent/authroles/where.go @@ -98,32 +98,15 @@ func HasTokenWith(preds ...predicate.AuthTokens) predicate.AuthRoles { // And groups predicates with the AND operator between them. func And(predicates ...predicate.AuthRoles) predicate.AuthRoles { - return predicate.AuthRoles(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.AuthRoles(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.AuthRoles) predicate.AuthRoles { - return predicate.AuthRoles(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.AuthRoles(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.AuthRoles) predicate.AuthRoles { - return predicate.AuthRoles(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.AuthRoles(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/authroles_create.go b/backend/internal/data/ent/authroles_create.go index 614e4fd..19e594f 100644 --- a/backend/internal/data/ent/authroles_create.go +++ b/backend/internal/data/ent/authroles_create.go @@ -158,11 +158,15 @@ func (arc *AuthRolesCreate) createSpec() (*AuthRoles, *sqlgraph.CreateSpec) { // AuthRolesCreateBulk is the builder for creating many AuthRoles entities in bulk. type AuthRolesCreateBulk struct { config + err error builders []*AuthRolesCreate } // Save creates the AuthRoles entities in the database. func (arcb *AuthRolesCreateBulk) Save(ctx context.Context) ([]*AuthRoles, error) { + if arcb.err != nil { + return nil, arcb.err + } specs := make([]*sqlgraph.CreateSpec, len(arcb.builders)) nodes := make([]*AuthRoles, len(arcb.builders)) mutators := make([]Mutator, len(arcb.builders)) diff --git a/backend/internal/data/ent/authtokens/where.go b/backend/internal/data/ent/authtokens/where.go index 6c6f960..d3642d8 100644 --- a/backend/internal/data/ent/authtokens/where.go +++ b/backend/internal/data/ent/authtokens/where.go @@ -284,32 +284,15 @@ func HasRolesWith(preds ...predicate.AuthRoles) predicate.AuthTokens { // And groups predicates with the AND operator between them. func And(predicates ...predicate.AuthTokens) predicate.AuthTokens { - return predicate.AuthTokens(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.AuthTokens(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.AuthTokens) predicate.AuthTokens { - return predicate.AuthTokens(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.AuthTokens(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.AuthTokens) predicate.AuthTokens { - return predicate.AuthTokens(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.AuthTokens(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/authtokens_create.go b/backend/internal/data/ent/authtokens_create.go index 78b4909..afddb3b 100644 --- a/backend/internal/data/ent/authtokens_create.go +++ b/backend/internal/data/ent/authtokens_create.go @@ -280,11 +280,15 @@ func (atc *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) { // AuthTokensCreateBulk is the builder for creating many AuthTokens entities in bulk. type AuthTokensCreateBulk struct { config + err error builders []*AuthTokensCreate } // Save creates the AuthTokens entities in the database. func (atcb *AuthTokensCreateBulk) Save(ctx context.Context) ([]*AuthTokens, error) { + if atcb.err != nil { + return nil, atcb.err + } specs := make([]*sqlgraph.CreateSpec, len(atcb.builders)) nodes := make([]*AuthTokens, len(atcb.builders)) mutators := make([]Mutator, len(atcb.builders)) diff --git a/backend/internal/data/ent/client.go b/backend/internal/data/ent/client.go index 6b4fbe3..2fb9b53 100644 --- a/backend/internal/data/ent/client.go +++ b/backend/internal/data/ent/client.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "log" + "reflect" "github.com/google/uuid" "github.com/hay-kot/homebox/backend/internal/data/ent/migrate" @@ -65,9 +66,7 @@ type Client struct { // NewClient creates a new client configured with the given options. func NewClient(opts ...Option) *Client { - cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}} - cfg.options(opts...) - client := &Client{config: cfg} + client := &Client{config: newConfig(opts...)} client.init() return client } @@ -107,6 +106,13 @@ type ( Option func(*config) ) +// newConfig creates a new config for the client. +func newConfig(opts ...Option) config { + cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}} + cfg.options(opts...) + return cfg +} + // options applies the options on the config object. func (c *config) options(opts ...Option) { for _, opt := range opts { @@ -154,11 +160,14 @@ func Open(driverName, dataSourceName string, options ...Option) (*Client, error) } } +// ErrTxStarted is returned when trying to start a new transaction from a transactional client. +var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction") + // Tx returns a new transactional client. The provided context // is used until the transaction is committed or rolled back. func (c *Client) Tx(ctx context.Context) (*Tx, error) { if _, ok := c.driver.(*txDriver); ok { - return nil, errors.New("ent: cannot start a transaction within a transaction") + return nil, ErrTxStarted } tx, err := newTx(ctx, c.driver) if err != nil { @@ -330,6 +339,21 @@ func (c *AttachmentClient) CreateBulk(builders ...*AttachmentCreate) *Attachment return &AttachmentCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *AttachmentClient) MapCreateBulk(slice any, setFunc func(*AttachmentCreate, int)) *AttachmentCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &AttachmentCreateBulk{err: fmt.Errorf("calling to AttachmentClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*AttachmentCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &AttachmentCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Attachment. func (c *AttachmentClient) Update() *AttachmentUpdate { mutation := newAttachmentMutation(c.config, OpUpdate) @@ -480,6 +504,21 @@ func (c *AuthRolesClient) CreateBulk(builders ...*AuthRolesCreate) *AuthRolesCre return &AuthRolesCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *AuthRolesClient) MapCreateBulk(slice any, setFunc func(*AuthRolesCreate, int)) *AuthRolesCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &AuthRolesCreateBulk{err: fmt.Errorf("calling to AuthRolesClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*AuthRolesCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &AuthRolesCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for AuthRoles. func (c *AuthRolesClient) Update() *AuthRolesUpdate { mutation := newAuthRolesMutation(c.config, OpUpdate) @@ -614,6 +653,21 @@ func (c *AuthTokensClient) CreateBulk(builders ...*AuthTokensCreate) *AuthTokens return &AuthTokensCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *AuthTokensClient) MapCreateBulk(slice any, setFunc func(*AuthTokensCreate, int)) *AuthTokensCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &AuthTokensCreateBulk{err: fmt.Errorf("calling to AuthTokensClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*AuthTokensCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &AuthTokensCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for AuthTokens. func (c *AuthTokensClient) Update() *AuthTokensUpdate { mutation := newAuthTokensMutation(c.config, OpUpdate) @@ -764,6 +818,21 @@ func (c *DocumentClient) CreateBulk(builders ...*DocumentCreate) *DocumentCreate return &DocumentCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *DocumentClient) MapCreateBulk(slice any, setFunc func(*DocumentCreate, int)) *DocumentCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &DocumentCreateBulk{err: fmt.Errorf("calling to DocumentClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*DocumentCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &DocumentCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Document. func (c *DocumentClient) Update() *DocumentUpdate { mutation := newDocumentMutation(c.config, OpUpdate) @@ -914,6 +983,21 @@ func (c *GroupClient) CreateBulk(builders ...*GroupCreate) *GroupCreateBulk { return &GroupCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *GroupClient) MapCreateBulk(slice any, setFunc func(*GroupCreate, int)) *GroupCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &GroupCreateBulk{err: fmt.Errorf("calling to GroupClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*GroupCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &GroupCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Group. func (c *GroupClient) Update() *GroupUpdate { mutation := newGroupMutation(c.config, OpUpdate) @@ -1144,6 +1228,21 @@ func (c *GroupInvitationTokenClient) CreateBulk(builders ...*GroupInvitationToke return &GroupInvitationTokenCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *GroupInvitationTokenClient) MapCreateBulk(slice any, setFunc func(*GroupInvitationTokenCreate, int)) *GroupInvitationTokenCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &GroupInvitationTokenCreateBulk{err: fmt.Errorf("calling to GroupInvitationTokenClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*GroupInvitationTokenCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &GroupInvitationTokenCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for GroupInvitationToken. func (c *GroupInvitationTokenClient) Update() *GroupInvitationTokenUpdate { mutation := newGroupInvitationTokenMutation(c.config, OpUpdate) @@ -1278,6 +1377,21 @@ func (c *ItemClient) CreateBulk(builders ...*ItemCreate) *ItemCreateBulk { return &ItemCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *ItemClient) MapCreateBulk(slice any, setFunc func(*ItemCreate, int)) *ItemCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &ItemCreateBulk{err: fmt.Errorf("calling to ItemClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*ItemCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &ItemCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Item. func (c *ItemClient) Update() *ItemUpdate { mutation := newItemMutation(c.config, OpUpdate) @@ -1524,6 +1638,21 @@ func (c *ItemFieldClient) CreateBulk(builders ...*ItemFieldCreate) *ItemFieldCre return &ItemFieldCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *ItemFieldClient) MapCreateBulk(slice any, setFunc func(*ItemFieldCreate, int)) *ItemFieldCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &ItemFieldCreateBulk{err: fmt.Errorf("calling to ItemFieldClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*ItemFieldCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &ItemFieldCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for ItemField. func (c *ItemFieldClient) Update() *ItemFieldUpdate { mutation := newItemFieldMutation(c.config, OpUpdate) @@ -1658,6 +1787,21 @@ func (c *LabelClient) CreateBulk(builders ...*LabelCreate) *LabelCreateBulk { return &LabelCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *LabelClient) MapCreateBulk(slice any, setFunc func(*LabelCreate, int)) *LabelCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &LabelCreateBulk{err: fmt.Errorf("calling to LabelClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*LabelCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &LabelCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Label. func (c *LabelClient) Update() *LabelUpdate { mutation := newLabelMutation(c.config, OpUpdate) @@ -1808,6 +1952,21 @@ func (c *LocationClient) CreateBulk(builders ...*LocationCreate) *LocationCreate return &LocationCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *LocationClient) MapCreateBulk(slice any, setFunc func(*LocationCreate, int)) *LocationCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &LocationCreateBulk{err: fmt.Errorf("calling to LocationClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*LocationCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &LocationCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Location. func (c *LocationClient) Update() *LocationUpdate { mutation := newLocationMutation(c.config, OpUpdate) @@ -1990,6 +2149,21 @@ func (c *MaintenanceEntryClient) CreateBulk(builders ...*MaintenanceEntryCreate) return &MaintenanceEntryCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *MaintenanceEntryClient) MapCreateBulk(slice any, setFunc func(*MaintenanceEntryCreate, int)) *MaintenanceEntryCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &MaintenanceEntryCreateBulk{err: fmt.Errorf("calling to MaintenanceEntryClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*MaintenanceEntryCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &MaintenanceEntryCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for MaintenanceEntry. func (c *MaintenanceEntryClient) Update() *MaintenanceEntryUpdate { mutation := newMaintenanceEntryMutation(c.config, OpUpdate) @@ -2124,6 +2298,21 @@ func (c *NotifierClient) CreateBulk(builders ...*NotifierCreate) *NotifierCreate return &NotifierCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *NotifierClient) MapCreateBulk(slice any, setFunc func(*NotifierCreate, int)) *NotifierCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &NotifierCreateBulk{err: fmt.Errorf("calling to NotifierClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*NotifierCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &NotifierCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Notifier. func (c *NotifierClient) Update() *NotifierUpdate { mutation := newNotifierMutation(c.config, OpUpdate) @@ -2274,6 +2463,21 @@ func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk { return &UserCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &UserCreateBulk{err: fmt.Errorf("calling to UserClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*UserCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &UserCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for User. func (c *UserClient) Update() *UserUpdate { mutation := newUserMutation(c.config, OpUpdate) diff --git a/backend/internal/data/ent/document/where.go b/backend/internal/data/ent/document/where.go index 315e2d8..3e491ad 100644 --- a/backend/internal/data/ent/document/where.go +++ b/backend/internal/data/ent/document/where.go @@ -334,32 +334,15 @@ func HasAttachmentsWith(preds ...predicate.Attachment) predicate.Document { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Document) predicate.Document { - return predicate.Document(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Document(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Document) predicate.Document { - return predicate.Document(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Document(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Document) predicate.Document { - return predicate.Document(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Document(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/document_create.go b/backend/internal/data/ent/document_create.go index f304560..fe61e98 100644 --- a/backend/internal/data/ent/document_create.go +++ b/backend/internal/data/ent/document_create.go @@ -269,11 +269,15 @@ func (dc *DocumentCreate) createSpec() (*Document, *sqlgraph.CreateSpec) { // DocumentCreateBulk is the builder for creating many Document entities in bulk. type DocumentCreateBulk struct { config + err error builders []*DocumentCreate } // Save creates the Document entities in the database. func (dcb *DocumentCreateBulk) Save(ctx context.Context) ([]*Document, error) { + if dcb.err != nil { + return nil, dcb.err + } specs := make([]*sqlgraph.CreateSpec, len(dcb.builders)) nodes := make([]*Document, len(dcb.builders)) mutators := make([]Mutator, len(dcb.builders)) diff --git a/backend/internal/data/ent/document_update.go b/backend/internal/data/ent/document_update.go index 96a2f04..23e6d9c 100644 --- a/backend/internal/data/ent/document_update.go +++ b/backend/internal/data/ent/document_update.go @@ -43,12 +43,28 @@ func (du *DocumentUpdate) SetTitle(s string) *DocumentUpdate { return du } +// SetNillableTitle sets the "title" field if the given value is not nil. +func (du *DocumentUpdate) SetNillableTitle(s *string) *DocumentUpdate { + if s != nil { + du.SetTitle(*s) + } + return du +} + // SetPath sets the "path" field. func (du *DocumentUpdate) SetPath(s string) *DocumentUpdate { du.mutation.SetPath(s) return du } +// SetNillablePath sets the "path" field if the given value is not nil. +func (du *DocumentUpdate) SetNillablePath(s *string) *DocumentUpdate { + if s != nil { + du.SetPath(*s) + } + return du +} + // SetGroupID sets the "group" edge to the Group entity by ID. func (du *DocumentUpdate) SetGroupID(id uuid.UUID) *DocumentUpdate { du.mutation.SetGroupID(id) @@ -288,12 +304,28 @@ func (duo *DocumentUpdateOne) SetTitle(s string) *DocumentUpdateOne { return duo } +// SetNillableTitle sets the "title" field if the given value is not nil. +func (duo *DocumentUpdateOne) SetNillableTitle(s *string) *DocumentUpdateOne { + if s != nil { + duo.SetTitle(*s) + } + return duo +} + // SetPath sets the "path" field. func (duo *DocumentUpdateOne) SetPath(s string) *DocumentUpdateOne { duo.mutation.SetPath(s) return duo } +// SetNillablePath sets the "path" field if the given value is not nil. +func (duo *DocumentUpdateOne) SetNillablePath(s *string) *DocumentUpdateOne { + if s != nil { + duo.SetPath(*s) + } + return duo +} + // SetGroupID sets the "group" edge to the Group entity by ID. func (duo *DocumentUpdateOne) SetGroupID(id uuid.UUID) *DocumentUpdateOne { duo.mutation.SetGroupID(id) diff --git a/backend/internal/data/ent/group/where.go b/backend/internal/data/ent/group/where.go index f4a10b6..5f1bc06 100644 --- a/backend/internal/data/ent/group/where.go +++ b/backend/internal/data/ent/group/where.go @@ -399,32 +399,15 @@ func HasNotifiersWith(preds ...predicate.Notifier) predicate.Group { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Group) predicate.Group { - return predicate.Group(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Group(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Group) predicate.Group { - return predicate.Group(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Group(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Group) predicate.Group { - return predicate.Group(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Group(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/group_create.go b/backend/internal/data/ent/group_create.go index 047d41d..8ccd05b 100644 --- a/backend/internal/data/ent/group_create.go +++ b/backend/internal/data/ent/group_create.go @@ -441,11 +441,15 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { // GroupCreateBulk is the builder for creating many Group entities in bulk. type GroupCreateBulk struct { config + err error builders []*GroupCreate } // Save creates the Group entities in the database. func (gcb *GroupCreateBulk) Save(ctx context.Context) ([]*Group, error) { + if gcb.err != nil { + return nil, gcb.err + } specs := make([]*sqlgraph.CreateSpec, len(gcb.builders)) nodes := make([]*Group, len(gcb.builders)) mutators := make([]Mutator, len(gcb.builders)) diff --git a/backend/internal/data/ent/group_update.go b/backend/internal/data/ent/group_update.go index 68864b6..872ee08 100644 --- a/backend/internal/data/ent/group_update.go +++ b/backend/internal/data/ent/group_update.go @@ -48,6 +48,14 @@ func (gu *GroupUpdate) SetName(s string) *GroupUpdate { return gu } +// SetNillableName sets the "name" field if the given value is not nil. +func (gu *GroupUpdate) SetNillableName(s *string) *GroupUpdate { + if s != nil { + gu.SetName(*s) + } + return gu +} + // SetCurrency sets the "currency" field. func (gu *GroupUpdate) SetCurrency(gr group.Currency) *GroupUpdate { gu.mutation.SetCurrency(gr) @@ -738,6 +746,14 @@ func (guo *GroupUpdateOne) SetName(s string) *GroupUpdateOne { return guo } +// SetNillableName sets the "name" field if the given value is not nil. +func (guo *GroupUpdateOne) SetNillableName(s *string) *GroupUpdateOne { + if s != nil { + guo.SetName(*s) + } + return guo +} + // SetCurrency sets the "currency" field. func (guo *GroupUpdateOne) SetCurrency(gr group.Currency) *GroupUpdateOne { guo.mutation.SetCurrency(gr) diff --git a/backend/internal/data/ent/groupinvitationtoken/where.go b/backend/internal/data/ent/groupinvitationtoken/where.go index 046392a..d462df0 100644 --- a/backend/internal/data/ent/groupinvitationtoken/where.go +++ b/backend/internal/data/ent/groupinvitationtoken/where.go @@ -306,32 +306,15 @@ func HasGroupWith(preds ...predicate.Group) predicate.GroupInvitationToken { // And groups predicates with the AND operator between them. func And(predicates ...predicate.GroupInvitationToken) predicate.GroupInvitationToken { - return predicate.GroupInvitationToken(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.GroupInvitationToken(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.GroupInvitationToken) predicate.GroupInvitationToken { - return predicate.GroupInvitationToken(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.GroupInvitationToken(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.GroupInvitationToken) predicate.GroupInvitationToken { - return predicate.GroupInvitationToken(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.GroupInvitationToken(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/groupinvitationtoken_create.go b/backend/internal/data/ent/groupinvitationtoken_create.go index 03a8dd5..1d5859f 100644 --- a/backend/internal/data/ent/groupinvitationtoken_create.go +++ b/backend/internal/data/ent/groupinvitationtoken_create.go @@ -269,11 +269,15 @@ func (gitc *GroupInvitationTokenCreate) createSpec() (*GroupInvitationToken, *sq // GroupInvitationTokenCreateBulk is the builder for creating many GroupInvitationToken entities in bulk. type GroupInvitationTokenCreateBulk struct { config + err error builders []*GroupInvitationTokenCreate } // Save creates the GroupInvitationToken entities in the database. func (gitcb *GroupInvitationTokenCreateBulk) Save(ctx context.Context) ([]*GroupInvitationToken, error) { + if gitcb.err != nil { + return nil, gitcb.err + } specs := make([]*sqlgraph.CreateSpec, len(gitcb.builders)) nodes := make([]*GroupInvitationToken, len(gitcb.builders)) mutators := make([]Mutator, len(gitcb.builders)) diff --git a/backend/internal/data/ent/item/where.go b/backend/internal/data/ent/item/where.go index df83cb7..7504e6a 100644 --- a/backend/internal/data/ent/item/where.go +++ b/backend/internal/data/ent/item/where.go @@ -1592,32 +1592,15 @@ func HasAttachmentsWith(preds ...predicate.Attachment) predicate.Item { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Item) predicate.Item { - return predicate.Item(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Item(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Item) predicate.Item { - return predicate.Item(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Item(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Item) predicate.Item { - return predicate.Item(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Item(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/item_create.go b/backend/internal/data/ent/item_create.go index 203f8df..9eb1cb6 100644 --- a/backend/internal/data/ent/item_create.go +++ b/backend/internal/data/ent/item_create.go @@ -900,11 +900,15 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { // ItemCreateBulk is the builder for creating many Item entities in bulk. type ItemCreateBulk struct { config + err error builders []*ItemCreate } // Save creates the Item entities in the database. func (icb *ItemCreateBulk) Save(ctx context.Context) ([]*Item, error) { + if icb.err != nil { + return nil, icb.err + } specs := make([]*sqlgraph.CreateSpec, len(icb.builders)) nodes := make([]*Item, len(icb.builders)) mutators := make([]Mutator, len(icb.builders)) diff --git a/backend/internal/data/ent/item_update.go b/backend/internal/data/ent/item_update.go index cfe27a8..8cd4722 100644 --- a/backend/internal/data/ent/item_update.go +++ b/backend/internal/data/ent/item_update.go @@ -47,6 +47,14 @@ func (iu *ItemUpdate) SetName(s string) *ItemUpdate { return iu } +// SetNillableName sets the "name" field if the given value is not nil. +func (iu *ItemUpdate) SetNillableName(s *string) *ItemUpdate { + if s != nil { + iu.SetName(*s) + } + return iu +} + // SetDescription sets the "description" field. func (iu *ItemUpdate) SetDescription(s string) *ItemUpdate { iu.mutation.SetDescription(s) @@ -1247,6 +1255,14 @@ func (iuo *ItemUpdateOne) SetName(s string) *ItemUpdateOne { return iuo } +// SetNillableName sets the "name" field if the given value is not nil. +func (iuo *ItemUpdateOne) SetNillableName(s *string) *ItemUpdateOne { + if s != nil { + iuo.SetName(*s) + } + return iuo +} + // SetDescription sets the "description" field. func (iuo *ItemUpdateOne) SetDescription(s string) *ItemUpdateOne { iuo.mutation.SetDescription(s) diff --git a/backend/internal/data/ent/itemfield/where.go b/backend/internal/data/ent/itemfield/where.go index 6c786bb..8a2d4aa 100644 --- a/backend/internal/data/ent/itemfield/where.go +++ b/backend/internal/data/ent/itemfield/where.go @@ -536,32 +536,15 @@ func HasItemWith(preds ...predicate.Item) predicate.ItemField { // And groups predicates with the AND operator between them. func And(predicates ...predicate.ItemField) predicate.ItemField { - return predicate.ItemField(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.ItemField(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.ItemField) predicate.ItemField { - return predicate.ItemField(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.ItemField(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.ItemField) predicate.ItemField { - return predicate.ItemField(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.ItemField(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/itemfield_create.go b/backend/internal/data/ent/itemfield_create.go index ff40846..65a22fb 100644 --- a/backend/internal/data/ent/itemfield_create.go +++ b/backend/internal/data/ent/itemfield_create.go @@ -356,11 +356,15 @@ func (ifc *ItemFieldCreate) createSpec() (*ItemField, *sqlgraph.CreateSpec) { // ItemFieldCreateBulk is the builder for creating many ItemField entities in bulk. type ItemFieldCreateBulk struct { config + err error builders []*ItemFieldCreate } // Save creates the ItemField entities in the database. func (ifcb *ItemFieldCreateBulk) Save(ctx context.Context) ([]*ItemField, error) { + if ifcb.err != nil { + return nil, ifcb.err + } specs := make([]*sqlgraph.CreateSpec, len(ifcb.builders)) nodes := make([]*ItemField, len(ifcb.builders)) mutators := make([]Mutator, len(ifcb.builders)) diff --git a/backend/internal/data/ent/itemfield_update.go b/backend/internal/data/ent/itemfield_update.go index 4d1d818..3f44dc1 100644 --- a/backend/internal/data/ent/itemfield_update.go +++ b/backend/internal/data/ent/itemfield_update.go @@ -42,6 +42,14 @@ func (ifu *ItemFieldUpdate) SetName(s string) *ItemFieldUpdate { return ifu } +// SetNillableName sets the "name" field if the given value is not nil. +func (ifu *ItemFieldUpdate) SetNillableName(s *string) *ItemFieldUpdate { + if s != nil { + ifu.SetName(*s) + } + return ifu +} + // SetDescription sets the "description" field. func (ifu *ItemFieldUpdate) SetDescription(s string) *ItemFieldUpdate { ifu.mutation.SetDescription(s) @@ -68,6 +76,14 @@ func (ifu *ItemFieldUpdate) SetType(i itemfield.Type) *ItemFieldUpdate { return ifu } +// SetNillableType sets the "type" field if the given value is not nil. +func (ifu *ItemFieldUpdate) SetNillableType(i *itemfield.Type) *ItemFieldUpdate { + if i != nil { + ifu.SetType(*i) + } + return ifu +} + // SetTextValue sets the "text_value" field. func (ifu *ItemFieldUpdate) SetTextValue(s string) *ItemFieldUpdate { ifu.mutation.SetTextValue(s) @@ -343,6 +359,14 @@ func (ifuo *ItemFieldUpdateOne) SetName(s string) *ItemFieldUpdateOne { return ifuo } +// SetNillableName sets the "name" field if the given value is not nil. +func (ifuo *ItemFieldUpdateOne) SetNillableName(s *string) *ItemFieldUpdateOne { + if s != nil { + ifuo.SetName(*s) + } + return ifuo +} + // SetDescription sets the "description" field. func (ifuo *ItemFieldUpdateOne) SetDescription(s string) *ItemFieldUpdateOne { ifuo.mutation.SetDescription(s) @@ -369,6 +393,14 @@ func (ifuo *ItemFieldUpdateOne) SetType(i itemfield.Type) *ItemFieldUpdateOne { return ifuo } +// SetNillableType sets the "type" field if the given value is not nil. +func (ifuo *ItemFieldUpdateOne) SetNillableType(i *itemfield.Type) *ItemFieldUpdateOne { + if i != nil { + ifuo.SetType(*i) + } + return ifuo +} + // SetTextValue sets the "text_value" field. func (ifuo *ItemFieldUpdateOne) SetTextValue(s string) *ItemFieldUpdateOne { ifuo.mutation.SetTextValue(s) diff --git a/backend/internal/data/ent/label/where.go b/backend/internal/data/ent/label/where.go index 29a0846..3754ac7 100644 --- a/backend/internal/data/ent/label/where.go +++ b/backend/internal/data/ent/label/where.go @@ -424,32 +424,15 @@ func HasItemsWith(preds ...predicate.Item) predicate.Label { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Label) predicate.Label { - return predicate.Label(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Label(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Label) predicate.Label { - return predicate.Label(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Label(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Label) predicate.Label { - return predicate.Label(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Label(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/label_create.go b/backend/internal/data/ent/label_create.go index ca6c019..0ad6469 100644 --- a/backend/internal/data/ent/label_create.go +++ b/backend/internal/data/ent/label_create.go @@ -297,11 +297,15 @@ func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) { // LabelCreateBulk is the builder for creating many Label entities in bulk. type LabelCreateBulk struct { config + err error builders []*LabelCreate } // Save creates the Label entities in the database. func (lcb *LabelCreateBulk) Save(ctx context.Context) ([]*Label, error) { + if lcb.err != nil { + return nil, lcb.err + } specs := make([]*sqlgraph.CreateSpec, len(lcb.builders)) nodes := make([]*Label, len(lcb.builders)) mutators := make([]Mutator, len(lcb.builders)) diff --git a/backend/internal/data/ent/label_update.go b/backend/internal/data/ent/label_update.go index 906cb6a..0862d22 100644 --- a/backend/internal/data/ent/label_update.go +++ b/backend/internal/data/ent/label_update.go @@ -43,6 +43,14 @@ func (lu *LabelUpdate) SetName(s string) *LabelUpdate { return lu } +// SetNillableName sets the "name" field if the given value is not nil. +func (lu *LabelUpdate) SetNillableName(s *string) *LabelUpdate { + if s != nil { + lu.SetName(*s) + } + return lu +} + // SetDescription sets the "description" field. func (lu *LabelUpdate) SetDescription(s string) *LabelUpdate { lu.mutation.SetDescription(s) @@ -336,6 +344,14 @@ func (luo *LabelUpdateOne) SetName(s string) *LabelUpdateOne { return luo } +// SetNillableName sets the "name" field if the given value is not nil. +func (luo *LabelUpdateOne) SetNillableName(s *string) *LabelUpdateOne { + if s != nil { + luo.SetName(*s) + } + return luo +} + // SetDescription sets the "description" field. func (luo *LabelUpdateOne) SetDescription(s string) *LabelUpdateOne { luo.mutation.SetDescription(s) diff --git a/backend/internal/data/ent/location/where.go b/backend/internal/data/ent/location/where.go index de5e8cf..a89ef4d 100644 --- a/backend/internal/data/ent/location/where.go +++ b/backend/internal/data/ent/location/where.go @@ -390,32 +390,15 @@ func HasItemsWith(preds ...predicate.Item) predicate.Location { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Location) predicate.Location { - return predicate.Location(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Location(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Location) predicate.Location { - return predicate.Location(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Location(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Location) predicate.Location { - return predicate.Location(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Location(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/location_create.go b/backend/internal/data/ent/location_create.go index 416ffe1..98f0f7a 100644 --- a/backend/internal/data/ent/location_create.go +++ b/backend/internal/data/ent/location_create.go @@ -341,11 +341,15 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) { // LocationCreateBulk is the builder for creating many Location entities in bulk. type LocationCreateBulk struct { config + err error builders []*LocationCreate } // Save creates the Location entities in the database. func (lcb *LocationCreateBulk) Save(ctx context.Context) ([]*Location, error) { + if lcb.err != nil { + return nil, lcb.err + } specs := make([]*sqlgraph.CreateSpec, len(lcb.builders)) nodes := make([]*Location, len(lcb.builders)) mutators := make([]Mutator, len(lcb.builders)) diff --git a/backend/internal/data/ent/location_update.go b/backend/internal/data/ent/location_update.go index 986dbc4..d569b21 100644 --- a/backend/internal/data/ent/location_update.go +++ b/backend/internal/data/ent/location_update.go @@ -43,6 +43,14 @@ func (lu *LocationUpdate) SetName(s string) *LocationUpdate { return lu } +// SetNillableName sets the "name" field if the given value is not nil. +func (lu *LocationUpdate) SetNillableName(s *string) *LocationUpdate { + if s != nil { + lu.SetName(*s) + } + return lu +} + // SetDescription sets the "description" field. func (lu *LocationUpdate) SetDescription(s string) *LocationUpdate { lu.mutation.SetDescription(s) @@ -440,6 +448,14 @@ func (luo *LocationUpdateOne) SetName(s string) *LocationUpdateOne { return luo } +// SetNillableName sets the "name" field if the given value is not nil. +func (luo *LocationUpdateOne) SetNillableName(s *string) *LocationUpdateOne { + if s != nil { + luo.SetName(*s) + } + return luo +} + // SetDescription sets the "description" field. func (luo *LocationUpdateOne) SetDescription(s string) *LocationUpdateOne { luo.mutation.SetDescription(s) diff --git a/backend/internal/data/ent/maintenanceentry/where.go b/backend/internal/data/ent/maintenanceentry/where.go index 6e92c77..85e736d 100644 --- a/backend/internal/data/ent/maintenanceentry/where.go +++ b/backend/internal/data/ent/maintenanceentry/where.go @@ -501,32 +501,15 @@ func HasItemWith(preds ...predicate.Item) predicate.MaintenanceEntry { // And groups predicates with the AND operator between them. func And(predicates ...predicate.MaintenanceEntry) predicate.MaintenanceEntry { - return predicate.MaintenanceEntry(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.MaintenanceEntry(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.MaintenanceEntry) predicate.MaintenanceEntry { - return predicate.MaintenanceEntry(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.MaintenanceEntry(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.MaintenanceEntry) predicate.MaintenanceEntry { - return predicate.MaintenanceEntry(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.MaintenanceEntry(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/maintenanceentry_create.go b/backend/internal/data/ent/maintenanceentry_create.go index 0e6144b..ea71a4d 100644 --- a/backend/internal/data/ent/maintenanceentry_create.go +++ b/backend/internal/data/ent/maintenanceentry_create.go @@ -306,11 +306,15 @@ func (mec *MaintenanceEntryCreate) createSpec() (*MaintenanceEntry, *sqlgraph.Cr // MaintenanceEntryCreateBulk is the builder for creating many MaintenanceEntry entities in bulk. type MaintenanceEntryCreateBulk struct { config + err error builders []*MaintenanceEntryCreate } // Save creates the MaintenanceEntry entities in the database. func (mecb *MaintenanceEntryCreateBulk) Save(ctx context.Context) ([]*MaintenanceEntry, error) { + if mecb.err != nil { + return nil, mecb.err + } specs := make([]*sqlgraph.CreateSpec, len(mecb.builders)) nodes := make([]*MaintenanceEntry, len(mecb.builders)) mutators := make([]Mutator, len(mecb.builders)) diff --git a/backend/internal/data/ent/maintenanceentry_update.go b/backend/internal/data/ent/maintenanceentry_update.go index 18447d1..3616d32 100644 --- a/backend/internal/data/ent/maintenanceentry_update.go +++ b/backend/internal/data/ent/maintenanceentry_update.go @@ -42,6 +42,14 @@ func (meu *MaintenanceEntryUpdate) SetItemID(u uuid.UUID) *MaintenanceEntryUpdat return meu } +// SetNillableItemID sets the "item_id" field if the given value is not nil. +func (meu *MaintenanceEntryUpdate) SetNillableItemID(u *uuid.UUID) *MaintenanceEntryUpdate { + if u != nil { + meu.SetItemID(*u) + } + return meu +} + // SetDate sets the "date" field. func (meu *MaintenanceEntryUpdate) SetDate(t time.Time) *MaintenanceEntryUpdate { meu.mutation.SetDate(t) @@ -88,6 +96,14 @@ func (meu *MaintenanceEntryUpdate) SetName(s string) *MaintenanceEntryUpdate { return meu } +// SetNillableName sets the "name" field if the given value is not nil. +func (meu *MaintenanceEntryUpdate) SetNillableName(s *string) *MaintenanceEntryUpdate { + if s != nil { + meu.SetName(*s) + } + return meu +} + // SetDescription sets the "description" field. func (meu *MaintenanceEntryUpdate) SetDescription(s string) *MaintenanceEntryUpdate { meu.mutation.SetDescription(s) @@ -302,6 +318,14 @@ func (meuo *MaintenanceEntryUpdateOne) SetItemID(u uuid.UUID) *MaintenanceEntryU return meuo } +// SetNillableItemID sets the "item_id" field if the given value is not nil. +func (meuo *MaintenanceEntryUpdateOne) SetNillableItemID(u *uuid.UUID) *MaintenanceEntryUpdateOne { + if u != nil { + meuo.SetItemID(*u) + } + return meuo +} + // SetDate sets the "date" field. func (meuo *MaintenanceEntryUpdateOne) SetDate(t time.Time) *MaintenanceEntryUpdateOne { meuo.mutation.SetDate(t) @@ -348,6 +372,14 @@ func (meuo *MaintenanceEntryUpdateOne) SetName(s string) *MaintenanceEntryUpdate return meuo } +// SetNillableName sets the "name" field if the given value is not nil. +func (meuo *MaintenanceEntryUpdateOne) SetNillableName(s *string) *MaintenanceEntryUpdateOne { + if s != nil { + meuo.SetName(*s) + } + return meuo +} + // SetDescription sets the "description" field. func (meuo *MaintenanceEntryUpdateOne) SetDescription(s string) *MaintenanceEntryUpdateOne { meuo.mutation.SetDescription(s) diff --git a/backend/internal/data/ent/mutation.go b/backend/internal/data/ent/mutation.go index 496437d..5873a3c 100644 --- a/backend/internal/data/ent/mutation.go +++ b/backend/internal/data/ent/mutation.go @@ -9529,6 +9529,7 @@ func (m *MaintenanceEntryMutation) ResetCost() { // ClearItem clears the "item" edge to the Item entity. func (m *MaintenanceEntryMutation) ClearItem() { m.cleareditem = true + m.clearedFields[maintenanceentry.FieldItemID] = struct{}{} } // ItemCleared reports if the "item" edge to the Item entity was cleared. @@ -10292,6 +10293,7 @@ func (m *NotifierMutation) ResetIsActive() { // ClearGroup clears the "group" edge to the Group entity. func (m *NotifierMutation) ClearGroup() { m.clearedgroup = true + m.clearedFields[notifier.FieldGroupID] = struct{}{} } // GroupCleared reports if the "group" edge to the Group entity was cleared. @@ -10318,6 +10320,7 @@ func (m *NotifierMutation) ResetGroup() { // ClearUser clears the "user" edge to the User entity. func (m *NotifierMutation) ClearUser() { m.cleareduser = true + m.clearedFields[notifier.FieldUserID] = struct{}{} } // UserCleared reports if the "user" edge to the User entity was cleared. diff --git a/backend/internal/data/ent/notifier/where.go b/backend/internal/data/ent/notifier/where.go index f38192d..fa9b3bc 100644 --- a/backend/internal/data/ent/notifier/where.go +++ b/backend/internal/data/ent/notifier/where.go @@ -399,32 +399,15 @@ func HasUserWith(preds ...predicate.User) predicate.Notifier { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Notifier) predicate.Notifier { - return predicate.Notifier(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Notifier(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Notifier) predicate.Notifier { - return predicate.Notifier(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Notifier(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Notifier) predicate.Notifier { - return predicate.Notifier(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Notifier(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/notifier_create.go b/backend/internal/data/ent/notifier_create.go index 89d8b5f..42265e2 100644 --- a/backend/internal/data/ent/notifier_create.go +++ b/backend/internal/data/ent/notifier_create.go @@ -300,11 +300,15 @@ func (nc *NotifierCreate) createSpec() (*Notifier, *sqlgraph.CreateSpec) { // NotifierCreateBulk is the builder for creating many Notifier entities in bulk. type NotifierCreateBulk struct { config + err error builders []*NotifierCreate } // Save creates the Notifier entities in the database. func (ncb *NotifierCreateBulk) Save(ctx context.Context) ([]*Notifier, error) { + if ncb.err != nil { + return nil, ncb.err + } specs := make([]*sqlgraph.CreateSpec, len(ncb.builders)) nodes := make([]*Notifier, len(ncb.builders)) mutators := make([]Mutator, len(ncb.builders)) diff --git a/backend/internal/data/ent/notifier_update.go b/backend/internal/data/ent/notifier_update.go index a7712bf..ea28f32 100644 --- a/backend/internal/data/ent/notifier_update.go +++ b/backend/internal/data/ent/notifier_update.go @@ -43,24 +43,56 @@ func (nu *NotifierUpdate) SetGroupID(u uuid.UUID) *NotifierUpdate { return nu } +// SetNillableGroupID sets the "group_id" field if the given value is not nil. +func (nu *NotifierUpdate) SetNillableGroupID(u *uuid.UUID) *NotifierUpdate { + if u != nil { + nu.SetGroupID(*u) + } + return nu +} + // SetUserID sets the "user_id" field. func (nu *NotifierUpdate) SetUserID(u uuid.UUID) *NotifierUpdate { nu.mutation.SetUserID(u) return nu } +// SetNillableUserID sets the "user_id" field if the given value is not nil. +func (nu *NotifierUpdate) SetNillableUserID(u *uuid.UUID) *NotifierUpdate { + if u != nil { + nu.SetUserID(*u) + } + return nu +} + // SetName sets the "name" field. func (nu *NotifierUpdate) SetName(s string) *NotifierUpdate { nu.mutation.SetName(s) return nu } +// SetNillableName sets the "name" field if the given value is not nil. +func (nu *NotifierUpdate) SetNillableName(s *string) *NotifierUpdate { + if s != nil { + nu.SetName(*s) + } + return nu +} + // SetURL sets the "url" field. func (nu *NotifierUpdate) SetURL(s string) *NotifierUpdate { nu.mutation.SetURL(s) return nu } +// SetNillableURL sets the "url" field if the given value is not nil. +func (nu *NotifierUpdate) SetNillableURL(s *string) *NotifierUpdate { + if s != nil { + nu.SetURL(*s) + } + return nu +} + // SetIsActive sets the "is_active" field. func (nu *NotifierUpdate) SetIsActive(b bool) *NotifierUpdate { nu.mutation.SetIsActive(b) @@ -273,24 +305,56 @@ func (nuo *NotifierUpdateOne) SetGroupID(u uuid.UUID) *NotifierUpdateOne { return nuo } +// SetNillableGroupID sets the "group_id" field if the given value is not nil. +func (nuo *NotifierUpdateOne) SetNillableGroupID(u *uuid.UUID) *NotifierUpdateOne { + if u != nil { + nuo.SetGroupID(*u) + } + return nuo +} + // SetUserID sets the "user_id" field. func (nuo *NotifierUpdateOne) SetUserID(u uuid.UUID) *NotifierUpdateOne { nuo.mutation.SetUserID(u) return nuo } +// SetNillableUserID sets the "user_id" field if the given value is not nil. +func (nuo *NotifierUpdateOne) SetNillableUserID(u *uuid.UUID) *NotifierUpdateOne { + if u != nil { + nuo.SetUserID(*u) + } + return nuo +} + // SetName sets the "name" field. func (nuo *NotifierUpdateOne) SetName(s string) *NotifierUpdateOne { nuo.mutation.SetName(s) return nuo } +// SetNillableName sets the "name" field if the given value is not nil. +func (nuo *NotifierUpdateOne) SetNillableName(s *string) *NotifierUpdateOne { + if s != nil { + nuo.SetName(*s) + } + return nuo +} + // SetURL sets the "url" field. func (nuo *NotifierUpdateOne) SetURL(s string) *NotifierUpdateOne { nuo.mutation.SetURL(s) return nuo } +// SetNillableURL sets the "url" field if the given value is not nil. +func (nuo *NotifierUpdateOne) SetNillableURL(s *string) *NotifierUpdateOne { + if s != nil { + nuo.SetURL(*s) + } + return nuo +} + // SetIsActive sets the "is_active" field. func (nuo *NotifierUpdateOne) SetIsActive(b bool) *NotifierUpdateOne { nuo.mutation.SetIsActive(b) diff --git a/backend/internal/data/ent/runtime/runtime.go b/backend/internal/data/ent/runtime/runtime.go index 154cfdb..b5773b1 100644 --- a/backend/internal/data/ent/runtime/runtime.go +++ b/backend/internal/data/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/internal/data/ent/runtime.go const ( - Version = "v0.12.3" // Version of ent codegen. - Sum = "h1:N5lO2EOrHpCH5HYfiMOCHYbo+oh5M8GjT0/cx5x6xkk=" // Sum of ent codegen. + Version = "v0.12.5" // Version of ent codegen. + Sum = "h1:KREM5E4CSoej4zeGa88Ou/gfturAnpUv0mzAjch1sj4=" // Sum of ent codegen. ) diff --git a/backend/internal/data/ent/user/where.go b/backend/internal/data/ent/user/where.go index f56d400..8686e73 100644 --- a/backend/internal/data/ent/user/where.go +++ b/backend/internal/data/ent/user/where.go @@ -532,32 +532,15 @@ func HasNotifiersWith(preds ...predicate.Notifier) predicate.User { // And groups predicates with the AND operator between them. func And(predicates ...predicate.User) predicate.User { - return predicate.User(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.User(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.User) predicate.User { - return predicate.User(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.User(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.User) predicate.User { - return predicate.User(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.User(sql.NotPredicates(p)) } diff --git a/backend/internal/data/ent/user_create.go b/backend/internal/data/ent/user_create.go index 97077f5..2cfe2d1 100644 --- a/backend/internal/data/ent/user_create.go +++ b/backend/internal/data/ent/user_create.go @@ -417,11 +417,15 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { // UserCreateBulk is the builder for creating many User entities in bulk. type UserCreateBulk struct { config + err error builders []*UserCreate } // Save creates the User entities in the database. func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error) { + if ucb.err != nil { + return nil, ucb.err + } specs := make([]*sqlgraph.CreateSpec, len(ucb.builders)) nodes := make([]*User, len(ucb.builders)) mutators := make([]Mutator, len(ucb.builders)) diff --git a/backend/internal/data/ent/user_update.go b/backend/internal/data/ent/user_update.go index 0fa13b7..0e4c01a 100644 --- a/backend/internal/data/ent/user_update.go +++ b/backend/internal/data/ent/user_update.go @@ -44,18 +44,42 @@ func (uu *UserUpdate) SetName(s string) *UserUpdate { return uu } +// SetNillableName sets the "name" field if the given value is not nil. +func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate { + if s != nil { + uu.SetName(*s) + } + return uu +} + // SetEmail sets the "email" field. func (uu *UserUpdate) SetEmail(s string) *UserUpdate { uu.mutation.SetEmail(s) return uu } +// SetNillableEmail sets the "email" field if the given value is not nil. +func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate { + if s != nil { + uu.SetEmail(*s) + } + return uu +} + // SetPassword sets the "password" field. func (uu *UserUpdate) SetPassword(s string) *UserUpdate { uu.mutation.SetPassword(s) return uu } +// SetNillablePassword sets the "password" field if the given value is not nil. +func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate { + if s != nil { + uu.SetPassword(*s) + } + return uu +} + // SetIsSuperuser sets the "is_superuser" field. func (uu *UserUpdate) SetIsSuperuser(b bool) *UserUpdate { uu.mutation.SetIsSuperuser(b) @@ -466,18 +490,42 @@ func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne { return uuo } +// SetNillableName sets the "name" field if the given value is not nil. +func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne { + if s != nil { + uuo.SetName(*s) + } + return uuo +} + // SetEmail sets the "email" field. func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne { uuo.mutation.SetEmail(s) return uuo } +// SetNillableEmail sets the "email" field if the given value is not nil. +func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne { + if s != nil { + uuo.SetEmail(*s) + } + return uuo +} + // SetPassword sets the "password" field. func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne { uuo.mutation.SetPassword(s) return uuo } +// SetNillablePassword sets the "password" field if the given value is not nil. +func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne { + if s != nil { + uuo.SetPassword(*s) + } + return uuo +} + // SetIsSuperuser sets the "is_superuser" field. func (uuo *UserUpdateOne) SetIsSuperuser(b bool) *UserUpdateOne { uuo.mutation.SetIsSuperuser(b)