From a331a5b41f50f148d2d65af9df5cf81a12483df0 Mon Sep 17 00:00:00 2001 From: Simon Ding Date: Mon, 1 Sep 2025 01:46:58 +0800 Subject: [PATCH] fix goreleaser --- .goreleaser.yaml | 13 ++++++++++--- ent/blacklist_query.go | 21 +++++++++++---------- ent/downloadclients_query.go | 21 +++++++++++---------- ent/ent.go | 2 +- ent/enttest/enttest.go | 1 + ent/episode_query.go | 21 +++++++++++---------- ent/history_query.go | 21 +++++++++++---------- ent/importlist_query.go | 21 +++++++++++---------- ent/indexers_query.go | 21 +++++++++++---------- ent/media_query.go | 21 +++++++++++---------- ent/notificationclient_query.go | 21 +++++++++++---------- ent/runtime/runtime.go | 4 ++-- ent/settings_query.go | 21 +++++++++++---------- ent/storage_query.go | 21 +++++++++++---------- 14 files changed, 124 insertions(+), 106 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4fb371f..f58cbea 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -25,13 +25,13 @@ builds: - freebsd main: ./cmd/polaris ldflags: - - -X polaris/db.Version=$(git describe --tags --long) -X polaris/db.DefaultTmdbApiKey=$(echo $TMDB_API_KEY) + - -X polaris/db.Version=os -X polaris/db.DefaultTmdbApiKey={{ .Env.TMDB_API_KEY }} goarch: - amd64 - arm64 archives: - - format: tar.gz + - formats: [tar.gz] # this name template makes the OS and Arch compatible with the results of `uname`. name_template: >- {{ .ProjectName }}_ @@ -43,7 +43,7 @@ archives: # use zip for windows archives format_overrides: - goos: windows - format: zip + formats: [zip] changelog: sort: asc @@ -51,3 +51,10 @@ changelog: exclude: - "^docs:" - "^test:" + +release: + footer: >- + + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). diff --git a/ent/blacklist_query.go b/ent/blacklist_query.go index 2c9474d..23d7a53 100644 --- a/ent/blacklist_query.go +++ b/ent/blacklist_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/blacklist" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (bq *BlacklistQuery) Order(o ...blacklist.OrderOption) *BlacklistQuery { // First returns the first Blacklist entity from the query. // Returns a *NotFoundError when no Blacklist was found. func (bq *BlacklistQuery) First(ctx context.Context) (*Blacklist, error) { - nodes, err := bq.Limit(1).All(setContextOp(ctx, bq.ctx, "First")) + nodes, err := bq.Limit(1).All(setContextOp(ctx, bq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (bq *BlacklistQuery) FirstX(ctx context.Context) *Blacklist { // Returns a *NotFoundError when no Blacklist ID was found. func (bq *BlacklistQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = bq.Limit(1).IDs(setContextOp(ctx, bq.ctx, "FirstID")); err != nil { + if ids, err = bq.Limit(1).IDs(setContextOp(ctx, bq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (bq *BlacklistQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one Blacklist entity is found. // Returns a *NotFoundError when no Blacklist entities are found. func (bq *BlacklistQuery) Only(ctx context.Context) (*Blacklist, error) { - nodes, err := bq.Limit(2).All(setContextOp(ctx, bq.ctx, "Only")) + nodes, err := bq.Limit(2).All(setContextOp(ctx, bq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (bq *BlacklistQuery) OnlyX(ctx context.Context) *Blacklist { // Returns a *NotFoundError when no entities are found. func (bq *BlacklistQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = bq.Limit(2).IDs(setContextOp(ctx, bq.ctx, "OnlyID")); err != nil { + if ids, err = bq.Limit(2).IDs(setContextOp(ctx, bq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (bq *BlacklistQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of Blacklists. func (bq *BlacklistQuery) All(ctx context.Context) ([]*Blacklist, error) { - ctx = setContextOp(ctx, bq.ctx, "All") + ctx = setContextOp(ctx, bq.ctx, ent.OpQueryAll) if err := bq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (bq *BlacklistQuery) IDs(ctx context.Context) (ids []int, err error) { if bq.ctx.Unique == nil && bq.path != nil { bq.Unique(true) } - ctx = setContextOp(ctx, bq.ctx, "IDs") + ctx = setContextOp(ctx, bq.ctx, ent.OpQueryIDs) if err = bq.Select(blacklist.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (bq *BlacklistQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (bq *BlacklistQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, bq.ctx, "Count") + ctx = setContextOp(ctx, bq.ctx, ent.OpQueryCount) if err := bq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (bq *BlacklistQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (bq *BlacklistQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, bq.ctx, "Exist") + ctx = setContextOp(ctx, bq.ctx, ent.OpQueryExist) switch _, err := bq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (bgb *BlacklistGroupBy) Aggregate(fns ...AggregateFunc) *BlacklistGroupBy { // Scan applies the selector query and scans the result into the given value. func (bgb *BlacklistGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, bgb.build.ctx, ent.OpQueryGroupBy) if err := bgb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (bs *BlacklistSelect) Aggregate(fns ...AggregateFunc) *BlacklistSelect { // Scan applies the selector query and scans the result into the given value. func (bs *BlacklistSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bs.ctx, "Select") + ctx = setContextOp(ctx, bs.ctx, ent.OpQuerySelect) if err := bs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/downloadclients_query.go b/ent/downloadclients_query.go index 4760e7c..c2f6167 100644 --- a/ent/downloadclients_query.go +++ b/ent/downloadclients_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/downloadclients" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (dcq *DownloadClientsQuery) Order(o ...downloadclients.OrderOption) *Downlo // First returns the first DownloadClients entity from the query. // Returns a *NotFoundError when no DownloadClients was found. func (dcq *DownloadClientsQuery) First(ctx context.Context) (*DownloadClients, error) { - nodes, err := dcq.Limit(1).All(setContextOp(ctx, dcq.ctx, "First")) + nodes, err := dcq.Limit(1).All(setContextOp(ctx, dcq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (dcq *DownloadClientsQuery) FirstX(ctx context.Context) *DownloadClients { // Returns a *NotFoundError when no DownloadClients ID was found. func (dcq *DownloadClientsQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = dcq.Limit(1).IDs(setContextOp(ctx, dcq.ctx, "FirstID")); err != nil { + if ids, err = dcq.Limit(1).IDs(setContextOp(ctx, dcq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (dcq *DownloadClientsQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one DownloadClients entity is found. // Returns a *NotFoundError when no DownloadClients entities are found. func (dcq *DownloadClientsQuery) Only(ctx context.Context) (*DownloadClients, error) { - nodes, err := dcq.Limit(2).All(setContextOp(ctx, dcq.ctx, "Only")) + nodes, err := dcq.Limit(2).All(setContextOp(ctx, dcq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (dcq *DownloadClientsQuery) OnlyX(ctx context.Context) *DownloadClients { // Returns a *NotFoundError when no entities are found. func (dcq *DownloadClientsQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = dcq.Limit(2).IDs(setContextOp(ctx, dcq.ctx, "OnlyID")); err != nil { + if ids, err = dcq.Limit(2).IDs(setContextOp(ctx, dcq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (dcq *DownloadClientsQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of DownloadClientsSlice. func (dcq *DownloadClientsQuery) All(ctx context.Context) ([]*DownloadClients, error) { - ctx = setContextOp(ctx, dcq.ctx, "All") + ctx = setContextOp(ctx, dcq.ctx, ent.OpQueryAll) if err := dcq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (dcq *DownloadClientsQuery) IDs(ctx context.Context) (ids []int, err error) if dcq.ctx.Unique == nil && dcq.path != nil { dcq.Unique(true) } - ctx = setContextOp(ctx, dcq.ctx, "IDs") + ctx = setContextOp(ctx, dcq.ctx, ent.OpQueryIDs) if err = dcq.Select(downloadclients.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (dcq *DownloadClientsQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (dcq *DownloadClientsQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, dcq.ctx, "Count") + ctx = setContextOp(ctx, dcq.ctx, ent.OpQueryCount) if err := dcq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (dcq *DownloadClientsQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (dcq *DownloadClientsQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, dcq.ctx, "Exist") + ctx = setContextOp(ctx, dcq.ctx, ent.OpQueryExist) switch _, err := dcq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (dcgb *DownloadClientsGroupBy) Aggregate(fns ...AggregateFunc) *DownloadCli // Scan applies the selector query and scans the result into the given value. func (dcgb *DownloadClientsGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, dcgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, dcgb.build.ctx, ent.OpQueryGroupBy) if err := dcgb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (dcs *DownloadClientsSelect) Aggregate(fns ...AggregateFunc) *DownloadClien // Scan applies the selector query and scans the result into the given value. func (dcs *DownloadClientsSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, dcs.ctx, "Select") + ctx = setContextOp(ctx, dcs.ctx, ent.OpQuerySelect) if err := dcs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/ent.go b/ent/ent.go index d3676fe..bb81777 100644 --- a/ent/ent.go +++ b/ent/ent.go @@ -78,7 +78,7 @@ var ( columnCheck sql.ColumnCheck ) -// columnChecker checks if the column exists in the given table. +// checkColumn checks if the column exists in the given table. func checkColumn(table, column string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ diff --git a/ent/enttest/enttest.go b/ent/enttest/enttest.go index fc0eb7a..b2240b1 100644 --- a/ent/enttest/enttest.go +++ b/ent/enttest/enttest.go @@ -4,6 +4,7 @@ package enttest import ( "context" + "polaris/ent" // required by schema hooks. _ "polaris/ent/runtime" diff --git a/ent/episode_query.go b/ent/episode_query.go index fb003c4..638c081 100644 --- a/ent/episode_query.go +++ b/ent/episode_query.go @@ -10,6 +10,7 @@ import ( "polaris/ent/media" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -84,7 +85,7 @@ func (eq *EpisodeQuery) QueryMedia() *MediaQuery { // First returns the first Episode entity from the query. // Returns a *NotFoundError when no Episode was found. func (eq *EpisodeQuery) First(ctx context.Context) (*Episode, error) { - nodes, err := eq.Limit(1).All(setContextOp(ctx, eq.ctx, "First")) + nodes, err := eq.Limit(1).All(setContextOp(ctx, eq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -107,7 +108,7 @@ func (eq *EpisodeQuery) FirstX(ctx context.Context) *Episode { // Returns a *NotFoundError when no Episode ID was found. func (eq *EpisodeQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = eq.Limit(1).IDs(setContextOp(ctx, eq.ctx, "FirstID")); err != nil { + if ids, err = eq.Limit(1).IDs(setContextOp(ctx, eq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -130,7 +131,7 @@ func (eq *EpisodeQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one Episode entity is found. // Returns a *NotFoundError when no Episode entities are found. func (eq *EpisodeQuery) Only(ctx context.Context) (*Episode, error) { - nodes, err := eq.Limit(2).All(setContextOp(ctx, eq.ctx, "Only")) + nodes, err := eq.Limit(2).All(setContextOp(ctx, eq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -158,7 +159,7 @@ func (eq *EpisodeQuery) OnlyX(ctx context.Context) *Episode { // Returns a *NotFoundError when no entities are found. func (eq *EpisodeQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = eq.Limit(2).IDs(setContextOp(ctx, eq.ctx, "OnlyID")); err != nil { + if ids, err = eq.Limit(2).IDs(setContextOp(ctx, eq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -183,7 +184,7 @@ func (eq *EpisodeQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of Episodes. func (eq *EpisodeQuery) All(ctx context.Context) ([]*Episode, error) { - ctx = setContextOp(ctx, eq.ctx, "All") + ctx = setContextOp(ctx, eq.ctx, ent.OpQueryAll) if err := eq.prepareQuery(ctx); err != nil { return nil, err } @@ -205,7 +206,7 @@ func (eq *EpisodeQuery) IDs(ctx context.Context) (ids []int, err error) { if eq.ctx.Unique == nil && eq.path != nil { eq.Unique(true) } - ctx = setContextOp(ctx, eq.ctx, "IDs") + ctx = setContextOp(ctx, eq.ctx, ent.OpQueryIDs) if err = eq.Select(episode.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -223,7 +224,7 @@ func (eq *EpisodeQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (eq *EpisodeQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, eq.ctx, "Count") + ctx = setContextOp(ctx, eq.ctx, ent.OpQueryCount) if err := eq.prepareQuery(ctx); err != nil { return 0, err } @@ -241,7 +242,7 @@ func (eq *EpisodeQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (eq *EpisodeQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, eq.ctx, "Exist") + ctx = setContextOp(ctx, eq.ctx, ent.OpQueryExist) switch _, err := eq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -528,7 +529,7 @@ func (egb *EpisodeGroupBy) Aggregate(fns ...AggregateFunc) *EpisodeGroupBy { // Scan applies the selector query and scans the result into the given value. func (egb *EpisodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, egb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, egb.build.ctx, ent.OpQueryGroupBy) if err := egb.build.prepareQuery(ctx); err != nil { return err } @@ -576,7 +577,7 @@ func (es *EpisodeSelect) Aggregate(fns ...AggregateFunc) *EpisodeSelect { // Scan applies the selector query and scans the result into the given value. func (es *EpisodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, es.ctx, "Select") + ctx = setContextOp(ctx, es.ctx, ent.OpQuerySelect) if err := es.prepareQuery(ctx); err != nil { return err } diff --git a/ent/history_query.go b/ent/history_query.go index 0cbb1df..bd3b5ba 100644 --- a/ent/history_query.go +++ b/ent/history_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/history" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (hq *HistoryQuery) Order(o ...history.OrderOption) *HistoryQuery { // First returns the first History entity from the query. // Returns a *NotFoundError when no History was found. func (hq *HistoryQuery) First(ctx context.Context) (*History, error) { - nodes, err := hq.Limit(1).All(setContextOp(ctx, hq.ctx, "First")) + nodes, err := hq.Limit(1).All(setContextOp(ctx, hq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (hq *HistoryQuery) FirstX(ctx context.Context) *History { // Returns a *NotFoundError when no History ID was found. func (hq *HistoryQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = hq.Limit(1).IDs(setContextOp(ctx, hq.ctx, "FirstID")); err != nil { + if ids, err = hq.Limit(1).IDs(setContextOp(ctx, hq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (hq *HistoryQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one History entity is found. // Returns a *NotFoundError when no History entities are found. func (hq *HistoryQuery) Only(ctx context.Context) (*History, error) { - nodes, err := hq.Limit(2).All(setContextOp(ctx, hq.ctx, "Only")) + nodes, err := hq.Limit(2).All(setContextOp(ctx, hq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (hq *HistoryQuery) OnlyX(ctx context.Context) *History { // Returns a *NotFoundError when no entities are found. func (hq *HistoryQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = hq.Limit(2).IDs(setContextOp(ctx, hq.ctx, "OnlyID")); err != nil { + if ids, err = hq.Limit(2).IDs(setContextOp(ctx, hq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (hq *HistoryQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of Histories. func (hq *HistoryQuery) All(ctx context.Context) ([]*History, error) { - ctx = setContextOp(ctx, hq.ctx, "All") + ctx = setContextOp(ctx, hq.ctx, ent.OpQueryAll) if err := hq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (hq *HistoryQuery) IDs(ctx context.Context) (ids []int, err error) { if hq.ctx.Unique == nil && hq.path != nil { hq.Unique(true) } - ctx = setContextOp(ctx, hq.ctx, "IDs") + ctx = setContextOp(ctx, hq.ctx, ent.OpQueryIDs) if err = hq.Select(history.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (hq *HistoryQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (hq *HistoryQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, hq.ctx, "Count") + ctx = setContextOp(ctx, hq.ctx, ent.OpQueryCount) if err := hq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (hq *HistoryQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (hq *HistoryQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, hq.ctx, "Exist") + ctx = setContextOp(ctx, hq.ctx, ent.OpQueryExist) switch _, err := hq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (hgb *HistoryGroupBy) Aggregate(fns ...AggregateFunc) *HistoryGroupBy { // Scan applies the selector query and scans the result into the given value. func (hgb *HistoryGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, hgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, hgb.build.ctx, ent.OpQueryGroupBy) if err := hgb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (hs *HistorySelect) Aggregate(fns ...AggregateFunc) *HistorySelect { // Scan applies the selector query and scans the result into the given value. func (hs *HistorySelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, hs.ctx, "Select") + ctx = setContextOp(ctx, hs.ctx, ent.OpQuerySelect) if err := hs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/importlist_query.go b/ent/importlist_query.go index 23dc547..b5a2cb4 100644 --- a/ent/importlist_query.go +++ b/ent/importlist_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/importlist" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (ilq *ImportListQuery) Order(o ...importlist.OrderOption) *ImportListQuery // First returns the first ImportList entity from the query. // Returns a *NotFoundError when no ImportList was found. func (ilq *ImportListQuery) First(ctx context.Context) (*ImportList, error) { - nodes, err := ilq.Limit(1).All(setContextOp(ctx, ilq.ctx, "First")) + nodes, err := ilq.Limit(1).All(setContextOp(ctx, ilq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (ilq *ImportListQuery) FirstX(ctx context.Context) *ImportList { // Returns a *NotFoundError when no ImportList ID was found. func (ilq *ImportListQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ilq.Limit(1).IDs(setContextOp(ctx, ilq.ctx, "FirstID")); err != nil { + if ids, err = ilq.Limit(1).IDs(setContextOp(ctx, ilq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (ilq *ImportListQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one ImportList entity is found. // Returns a *NotFoundError when no ImportList entities are found. func (ilq *ImportListQuery) Only(ctx context.Context) (*ImportList, error) { - nodes, err := ilq.Limit(2).All(setContextOp(ctx, ilq.ctx, "Only")) + nodes, err := ilq.Limit(2).All(setContextOp(ctx, ilq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (ilq *ImportListQuery) OnlyX(ctx context.Context) *ImportList { // Returns a *NotFoundError when no entities are found. func (ilq *ImportListQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ilq.Limit(2).IDs(setContextOp(ctx, ilq.ctx, "OnlyID")); err != nil { + if ids, err = ilq.Limit(2).IDs(setContextOp(ctx, ilq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (ilq *ImportListQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of ImportLists. func (ilq *ImportListQuery) All(ctx context.Context) ([]*ImportList, error) { - ctx = setContextOp(ctx, ilq.ctx, "All") + ctx = setContextOp(ctx, ilq.ctx, ent.OpQueryAll) if err := ilq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (ilq *ImportListQuery) IDs(ctx context.Context) (ids []int, err error) { if ilq.ctx.Unique == nil && ilq.path != nil { ilq.Unique(true) } - ctx = setContextOp(ctx, ilq.ctx, "IDs") + ctx = setContextOp(ctx, ilq.ctx, ent.OpQueryIDs) if err = ilq.Select(importlist.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (ilq *ImportListQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (ilq *ImportListQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, ilq.ctx, "Count") + ctx = setContextOp(ctx, ilq.ctx, ent.OpQueryCount) if err := ilq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (ilq *ImportListQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (ilq *ImportListQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, ilq.ctx, "Exist") + ctx = setContextOp(ctx, ilq.ctx, ent.OpQueryExist) switch _, err := ilq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (ilgb *ImportListGroupBy) Aggregate(fns ...AggregateFunc) *ImportListGroupB // Scan applies the selector query and scans the result into the given value. func (ilgb *ImportListGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ilgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, ilgb.build.ctx, ent.OpQueryGroupBy) if err := ilgb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (ils *ImportListSelect) Aggregate(fns ...AggregateFunc) *ImportListSelect { // Scan applies the selector query and scans the result into the given value. func (ils *ImportListSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ils.ctx, "Select") + ctx = setContextOp(ctx, ils.ctx, ent.OpQuerySelect) if err := ils.prepareQuery(ctx); err != nil { return err } diff --git a/ent/indexers_query.go b/ent/indexers_query.go index 4bfd3f1..d0654f3 100644 --- a/ent/indexers_query.go +++ b/ent/indexers_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/indexers" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (iq *IndexersQuery) Order(o ...indexers.OrderOption) *IndexersQuery { // First returns the first Indexers entity from the query. // Returns a *NotFoundError when no Indexers was found. func (iq *IndexersQuery) First(ctx context.Context) (*Indexers, error) { - nodes, err := iq.Limit(1).All(setContextOp(ctx, iq.ctx, "First")) + nodes, err := iq.Limit(1).All(setContextOp(ctx, iq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (iq *IndexersQuery) FirstX(ctx context.Context) *Indexers { // Returns a *NotFoundError when no Indexers ID was found. func (iq *IndexersQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = iq.Limit(1).IDs(setContextOp(ctx, iq.ctx, "FirstID")); err != nil { + if ids, err = iq.Limit(1).IDs(setContextOp(ctx, iq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (iq *IndexersQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one Indexers entity is found. // Returns a *NotFoundError when no Indexers entities are found. func (iq *IndexersQuery) Only(ctx context.Context) (*Indexers, error) { - nodes, err := iq.Limit(2).All(setContextOp(ctx, iq.ctx, "Only")) + nodes, err := iq.Limit(2).All(setContextOp(ctx, iq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (iq *IndexersQuery) OnlyX(ctx context.Context) *Indexers { // Returns a *NotFoundError when no entities are found. func (iq *IndexersQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = iq.Limit(2).IDs(setContextOp(ctx, iq.ctx, "OnlyID")); err != nil { + if ids, err = iq.Limit(2).IDs(setContextOp(ctx, iq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (iq *IndexersQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of IndexersSlice. func (iq *IndexersQuery) All(ctx context.Context) ([]*Indexers, error) { - ctx = setContextOp(ctx, iq.ctx, "All") + ctx = setContextOp(ctx, iq.ctx, ent.OpQueryAll) if err := iq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (iq *IndexersQuery) IDs(ctx context.Context) (ids []int, err error) { if iq.ctx.Unique == nil && iq.path != nil { iq.Unique(true) } - ctx = setContextOp(ctx, iq.ctx, "IDs") + ctx = setContextOp(ctx, iq.ctx, ent.OpQueryIDs) if err = iq.Select(indexers.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (iq *IndexersQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (iq *IndexersQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, iq.ctx, "Count") + ctx = setContextOp(ctx, iq.ctx, ent.OpQueryCount) if err := iq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (iq *IndexersQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (iq *IndexersQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, iq.ctx, "Exist") + ctx = setContextOp(ctx, iq.ctx, ent.OpQueryExist) switch _, err := iq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (igb *IndexersGroupBy) Aggregate(fns ...AggregateFunc) *IndexersGroupBy { // Scan applies the selector query and scans the result into the given value. func (igb *IndexersGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, igb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, igb.build.ctx, ent.OpQueryGroupBy) if err := igb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (is *IndexersSelect) Aggregate(fns ...AggregateFunc) *IndexersSelect { // Scan applies the selector query and scans the result into the given value. func (is *IndexersSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, is.ctx, "Select") + ctx = setContextOp(ctx, is.ctx, ent.OpQuerySelect) if err := is.prepareQuery(ctx); err != nil { return err } diff --git a/ent/media_query.go b/ent/media_query.go index 829364f..e31e570 100644 --- a/ent/media_query.go +++ b/ent/media_query.go @@ -11,6 +11,7 @@ import ( "polaris/ent/media" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -85,7 +86,7 @@ func (mq *MediaQuery) QueryEpisodes() *EpisodeQuery { // First returns the first Media entity from the query. // Returns a *NotFoundError when no Media was found. func (mq *MediaQuery) First(ctx context.Context) (*Media, error) { - nodes, err := mq.Limit(1).All(setContextOp(ctx, mq.ctx, "First")) + nodes, err := mq.Limit(1).All(setContextOp(ctx, mq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -108,7 +109,7 @@ func (mq *MediaQuery) FirstX(ctx context.Context) *Media { // Returns a *NotFoundError when no Media ID was found. func (mq *MediaQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(1).IDs(setContextOp(ctx, mq.ctx, "FirstID")); err != nil { + if ids, err = mq.Limit(1).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -131,7 +132,7 @@ func (mq *MediaQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one Media entity is found. // Returns a *NotFoundError when no Media entities are found. func (mq *MediaQuery) Only(ctx context.Context) (*Media, error) { - nodes, err := mq.Limit(2).All(setContextOp(ctx, mq.ctx, "Only")) + nodes, err := mq.Limit(2).All(setContextOp(ctx, mq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -159,7 +160,7 @@ func (mq *MediaQuery) OnlyX(ctx context.Context) *Media { // Returns a *NotFoundError when no entities are found. func (mq *MediaQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = mq.Limit(2).IDs(setContextOp(ctx, mq.ctx, "OnlyID")); err != nil { + if ids, err = mq.Limit(2).IDs(setContextOp(ctx, mq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -184,7 +185,7 @@ func (mq *MediaQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of MediaSlice. func (mq *MediaQuery) All(ctx context.Context) ([]*Media, error) { - ctx = setContextOp(ctx, mq.ctx, "All") + ctx = setContextOp(ctx, mq.ctx, ent.OpQueryAll) if err := mq.prepareQuery(ctx); err != nil { return nil, err } @@ -206,7 +207,7 @@ func (mq *MediaQuery) IDs(ctx context.Context) (ids []int, err error) { if mq.ctx.Unique == nil && mq.path != nil { mq.Unique(true) } - ctx = setContextOp(ctx, mq.ctx, "IDs") + ctx = setContextOp(ctx, mq.ctx, ent.OpQueryIDs) if err = mq.Select(media.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -224,7 +225,7 @@ func (mq *MediaQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (mq *MediaQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, mq.ctx, "Count") + ctx = setContextOp(ctx, mq.ctx, ent.OpQueryCount) if err := mq.prepareQuery(ctx); err != nil { return 0, err } @@ -242,7 +243,7 @@ func (mq *MediaQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (mq *MediaQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, mq.ctx, "Exist") + ctx = setContextOp(ctx, mq.ctx, ent.OpQueryExist) switch _, err := mq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -528,7 +529,7 @@ func (mgb *MediaGroupBy) Aggregate(fns ...AggregateFunc) *MediaGroupBy { // Scan applies the selector query and scans the result into the given value. func (mgb *MediaGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, mgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, mgb.build.ctx, ent.OpQueryGroupBy) if err := mgb.build.prepareQuery(ctx); err != nil { return err } @@ -576,7 +577,7 @@ func (ms *MediaSelect) Aggregate(fns ...AggregateFunc) *MediaSelect { // Scan applies the selector query and scans the result into the given value. func (ms *MediaSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ms.ctx, "Select") + ctx = setContextOp(ctx, ms.ctx, ent.OpQuerySelect) if err := ms.prepareQuery(ctx); err != nil { return err } diff --git a/ent/notificationclient_query.go b/ent/notificationclient_query.go index 7381002..8537d1a 100644 --- a/ent/notificationclient_query.go +++ b/ent/notificationclient_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/notificationclient" "polaris/ent/predicate" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (ncq *NotificationClientQuery) Order(o ...notificationclient.OrderOption) * // First returns the first NotificationClient entity from the query. // Returns a *NotFoundError when no NotificationClient was found. func (ncq *NotificationClientQuery) First(ctx context.Context) (*NotificationClient, error) { - nodes, err := ncq.Limit(1).All(setContextOp(ctx, ncq.ctx, "First")) + nodes, err := ncq.Limit(1).All(setContextOp(ctx, ncq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (ncq *NotificationClientQuery) FirstX(ctx context.Context) *NotificationCli // Returns a *NotFoundError when no NotificationClient ID was found. func (ncq *NotificationClientQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ncq.Limit(1).IDs(setContextOp(ctx, ncq.ctx, "FirstID")); err != nil { + if ids, err = ncq.Limit(1).IDs(setContextOp(ctx, ncq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (ncq *NotificationClientQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one NotificationClient entity is found. // Returns a *NotFoundError when no NotificationClient entities are found. func (ncq *NotificationClientQuery) Only(ctx context.Context) (*NotificationClient, error) { - nodes, err := ncq.Limit(2).All(setContextOp(ctx, ncq.ctx, "Only")) + nodes, err := ncq.Limit(2).All(setContextOp(ctx, ncq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (ncq *NotificationClientQuery) OnlyX(ctx context.Context) *NotificationClie // Returns a *NotFoundError when no entities are found. func (ncq *NotificationClientQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = ncq.Limit(2).IDs(setContextOp(ctx, ncq.ctx, "OnlyID")); err != nil { + if ids, err = ncq.Limit(2).IDs(setContextOp(ctx, ncq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (ncq *NotificationClientQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of NotificationClients. func (ncq *NotificationClientQuery) All(ctx context.Context) ([]*NotificationClient, error) { - ctx = setContextOp(ctx, ncq.ctx, "All") + ctx = setContextOp(ctx, ncq.ctx, ent.OpQueryAll) if err := ncq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (ncq *NotificationClientQuery) IDs(ctx context.Context) (ids []int, err err if ncq.ctx.Unique == nil && ncq.path != nil { ncq.Unique(true) } - ctx = setContextOp(ctx, ncq.ctx, "IDs") + ctx = setContextOp(ctx, ncq.ctx, ent.OpQueryIDs) if err = ncq.Select(notificationclient.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (ncq *NotificationClientQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (ncq *NotificationClientQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, ncq.ctx, "Count") + ctx = setContextOp(ctx, ncq.ctx, ent.OpQueryCount) if err := ncq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (ncq *NotificationClientQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (ncq *NotificationClientQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, ncq.ctx, "Exist") + ctx = setContextOp(ctx, ncq.ctx, ent.OpQueryExist) switch _, err := ncq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (ncgb *NotificationClientGroupBy) Aggregate(fns ...AggregateFunc) *Notifica // Scan applies the selector query and scans the result into the given value. func (ncgb *NotificationClientGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ncgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, ncgb.build.ctx, ent.OpQueryGroupBy) if err := ncgb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (ncs *NotificationClientSelect) Aggregate(fns ...AggregateFunc) *Notificati // Scan applies the selector query and scans the result into the given value. func (ncs *NotificationClientSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ncs.ctx, "Select") + ctx = setContextOp(ctx, ncs.ctx, ent.OpQuerySelect) if err := ncs.prepareQuery(ctx); err != nil { return err } diff --git a/ent/runtime/runtime.go b/ent/runtime/runtime.go index d793458..41c0ddc 100644 --- a/ent/runtime/runtime.go +++ b/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in polaris/ent/runtime.go const ( - Version = "v0.13.1" // Version of ent codegen. - Sum = "h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE=" // Sum of ent codegen. + Version = "v0.14.4" // Version of ent codegen. + Sum = "h1:/DhDraSLXIkBhyiVoJeSshr4ZYi7femzhj6/TckzZuI=" // Sum of ent codegen. ) diff --git a/ent/settings_query.go b/ent/settings_query.go index 999e92a..aa91483 100644 --- a/ent/settings_query.go +++ b/ent/settings_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/predicate" "polaris/ent/settings" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (sq *SettingsQuery) Order(o ...settings.OrderOption) *SettingsQuery { // First returns the first Settings entity from the query. // Returns a *NotFoundError when no Settings was found. func (sq *SettingsQuery) First(ctx context.Context) (*Settings, error) { - nodes, err := sq.Limit(1).All(setContextOp(ctx, sq.ctx, "First")) + nodes, err := sq.Limit(1).All(setContextOp(ctx, sq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (sq *SettingsQuery) FirstX(ctx context.Context) *Settings { // Returns a *NotFoundError when no Settings ID was found. func (sq *SettingsQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = sq.Limit(1).IDs(setContextOp(ctx, sq.ctx, "FirstID")); err != nil { + if ids, err = sq.Limit(1).IDs(setContextOp(ctx, sq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (sq *SettingsQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one Settings entity is found. // Returns a *NotFoundError when no Settings entities are found. func (sq *SettingsQuery) Only(ctx context.Context) (*Settings, error) { - nodes, err := sq.Limit(2).All(setContextOp(ctx, sq.ctx, "Only")) + nodes, err := sq.Limit(2).All(setContextOp(ctx, sq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (sq *SettingsQuery) OnlyX(ctx context.Context) *Settings { // Returns a *NotFoundError when no entities are found. func (sq *SettingsQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = sq.Limit(2).IDs(setContextOp(ctx, sq.ctx, "OnlyID")); err != nil { + if ids, err = sq.Limit(2).IDs(setContextOp(ctx, sq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (sq *SettingsQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of SettingsSlice. func (sq *SettingsQuery) All(ctx context.Context) ([]*Settings, error) { - ctx = setContextOp(ctx, sq.ctx, "All") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryAll) if err := sq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (sq *SettingsQuery) IDs(ctx context.Context) (ids []int, err error) { if sq.ctx.Unique == nil && sq.path != nil { sq.Unique(true) } - ctx = setContextOp(ctx, sq.ctx, "IDs") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryIDs) if err = sq.Select(settings.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (sq *SettingsQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (sq *SettingsQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, sq.ctx, "Count") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryCount) if err := sq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (sq *SettingsQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (sq *SettingsQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, sq.ctx, "Exist") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryExist) switch _, err := sq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (sgb *SettingsGroupBy) Aggregate(fns ...AggregateFunc) *SettingsGroupBy { // Scan applies the selector query and scans the result into the given value. func (sgb *SettingsGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, sgb.build.ctx, ent.OpQueryGroupBy) if err := sgb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (ss *SettingsSelect) Aggregate(fns ...AggregateFunc) *SettingsSelect { // Scan applies the selector query and scans the result into the given value. func (ss *SettingsSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ss.ctx, "Select") + ctx = setContextOp(ctx, ss.ctx, ent.OpQuerySelect) if err := ss.prepareQuery(ctx); err != nil { return err } diff --git a/ent/storage_query.go b/ent/storage_query.go index afff766..a7e8aa4 100644 --- a/ent/storage_query.go +++ b/ent/storage_query.go @@ -9,6 +9,7 @@ import ( "polaris/ent/predicate" "polaris/ent/storage" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -60,7 +61,7 @@ func (sq *StorageQuery) Order(o ...storage.OrderOption) *StorageQuery { // First returns the first Storage entity from the query. // Returns a *NotFoundError when no Storage was found. func (sq *StorageQuery) First(ctx context.Context) (*Storage, error) { - nodes, err := sq.Limit(1).All(setContextOp(ctx, sq.ctx, "First")) + nodes, err := sq.Limit(1).All(setContextOp(ctx, sq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -83,7 +84,7 @@ func (sq *StorageQuery) FirstX(ctx context.Context) *Storage { // Returns a *NotFoundError when no Storage ID was found. func (sq *StorageQuery) FirstID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = sq.Limit(1).IDs(setContextOp(ctx, sq.ctx, "FirstID")); err != nil { + if ids, err = sq.Limit(1).IDs(setContextOp(ctx, sq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -106,7 +107,7 @@ func (sq *StorageQuery) FirstIDX(ctx context.Context) int { // Returns a *NotSingularError when more than one Storage entity is found. // Returns a *NotFoundError when no Storage entities are found. func (sq *StorageQuery) Only(ctx context.Context) (*Storage, error) { - nodes, err := sq.Limit(2).All(setContextOp(ctx, sq.ctx, "Only")) + nodes, err := sq.Limit(2).All(setContextOp(ctx, sq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (sq *StorageQuery) OnlyX(ctx context.Context) *Storage { // Returns a *NotFoundError when no entities are found. func (sq *StorageQuery) OnlyID(ctx context.Context) (id int, err error) { var ids []int - if ids, err = sq.Limit(2).IDs(setContextOp(ctx, sq.ctx, "OnlyID")); err != nil { + if ids, err = sq.Limit(2).IDs(setContextOp(ctx, sq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -159,7 +160,7 @@ func (sq *StorageQuery) OnlyIDX(ctx context.Context) int { // All executes the query and returns a list of Storages. func (sq *StorageQuery) All(ctx context.Context) ([]*Storage, error) { - ctx = setContextOp(ctx, sq.ctx, "All") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryAll) if err := sq.prepareQuery(ctx); err != nil { return nil, err } @@ -181,7 +182,7 @@ func (sq *StorageQuery) IDs(ctx context.Context) (ids []int, err error) { if sq.ctx.Unique == nil && sq.path != nil { sq.Unique(true) } - ctx = setContextOp(ctx, sq.ctx, "IDs") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryIDs) if err = sq.Select(storage.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -199,7 +200,7 @@ func (sq *StorageQuery) IDsX(ctx context.Context) []int { // Count returns the count of the given query. func (sq *StorageQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, sq.ctx, "Count") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryCount) if err := sq.prepareQuery(ctx); err != nil { return 0, err } @@ -217,7 +218,7 @@ func (sq *StorageQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (sq *StorageQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, sq.ctx, "Exist") + ctx = setContextOp(ctx, sq.ctx, ent.OpQueryExist) switch _, err := sq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -449,7 +450,7 @@ func (sgb *StorageGroupBy) Aggregate(fns ...AggregateFunc) *StorageGroupBy { // Scan applies the selector query and scans the result into the given value. func (sgb *StorageGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, sgb.build.ctx, ent.OpQueryGroupBy) if err := sgb.build.prepareQuery(ctx); err != nil { return err } @@ -497,7 +498,7 @@ func (ss *StorageSelect) Aggregate(fns ...AggregateFunc) *StorageSelect { // Scan applies the selector query and scans the result into the given value. func (ss *StorageSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ss.ctx, "Select") + ctx = setContextOp(ctx, ss.ctx, ent.OpQuerySelect) if err := ss.prepareQuery(ctx); err != nil { return err }