diff --git a/ent/config.go b/ent/config.go index 68b65be..0db46d5 100644 --- a/ent/config.go +++ b/ent/config.go @@ -17,7 +17,7 @@ type config struct { // debug enable a debug logging. debug bool // log used for logging on debug mode. - log func(...interface{}) + log func(...any) // hooks to execute on mutations. hooks *hooks } @@ -45,7 +45,7 @@ func Debug() Option { } // Log sets the logging function for debug mode. -func Log(fn func(...interface{})) Option { +func Log(fn func(...any)) Option { return func(c *config) { c.log = fn } diff --git a/ent/dbpackage.go b/ent/dbpackage.go index 4d21293..929674a 100644 --- a/ent/dbpackage.go +++ b/ent/dbpackage.go @@ -66,8 +66,8 @@ type DbPackage struct { } // scanValues returns the types for scanning values from sql.Rows. -func (*DbPackage) scanValues(columns []string) ([]interface{}, error) { - values := make([]interface{}, len(columns)) +func (*DbPackage) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) for i := range columns { switch columns[i] { case dbpackage.FieldPackages: @@ -87,7 +87,7 @@ func (*DbPackage) scanValues(columns []string) ([]interface{}, error) { // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the DbPackage fields. -func (dp *DbPackage) assignValues(columns []string, values []interface{}) error { +func (dp *DbPackage) assignValues(columns []string, values []any) error { if m, n := len(values), len(columns); m < n { return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) } diff --git a/ent/dbpackage/where.go b/ent/dbpackage/where.go index 946efb7..e0f9077 100644 --- a/ent/dbpackage/where.go +++ b/ent/dbpackage/where.go @@ -33,7 +33,7 @@ func IDNEQ(id int) predicate.DbPackage { // IDIn applies the In predicate on the ID field. func IDIn(ids ...int) predicate.DbPackage { return predicate.DbPackage(func(s *sql.Selector) { - v := make([]interface{}, len(ids)) + v := make([]any, len(ids)) for i := range v { v[i] = ids[i] } @@ -44,7 +44,7 @@ func IDIn(ids ...int) predicate.DbPackage { // IDNotIn applies the NotIn predicate on the ID field. func IDNotIn(ids ...int) predicate.DbPackage { return predicate.DbPackage(func(s *sql.Selector) { - v := make([]interface{}, len(ids)) + v := make([]any, len(ids)) for i := range v { v[i] = ids[i] } @@ -222,7 +222,7 @@ func PkgbaseNEQ(v string) predicate.DbPackage { // PkgbaseIn applies the In predicate on the "pkgbase" field. func PkgbaseIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -233,7 +233,7 @@ func PkgbaseIn(vs ...string) predicate.DbPackage { // PkgbaseNotIn applies the NotIn predicate on the "pkgbase" field. func PkgbaseNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -335,7 +335,7 @@ func StatusNEQ(v Status) predicate.DbPackage { // StatusIn applies the In predicate on the "status" field. func StatusIn(vs ...Status) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -346,7 +346,7 @@ func StatusIn(vs ...Status) predicate.DbPackage { // StatusNotIn applies the NotIn predicate on the "status" field. func StatusNotIn(vs ...Status) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -385,7 +385,7 @@ func SkipReasonNEQ(v string) predicate.DbPackage { // SkipReasonIn applies the In predicate on the "skip_reason" field. func SkipReasonIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -396,7 +396,7 @@ func SkipReasonIn(vs ...string) predicate.DbPackage { // SkipReasonNotIn applies the NotIn predicate on the "skip_reason" field. func SkipReasonNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -498,7 +498,7 @@ func RepositoryNEQ(v Repository) predicate.DbPackage { // RepositoryIn applies the In predicate on the "repository" field. func RepositoryIn(vs ...Repository) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -509,7 +509,7 @@ func RepositoryIn(vs ...Repository) predicate.DbPackage { // RepositoryNotIn applies the NotIn predicate on the "repository" field. func RepositoryNotIn(vs ...Repository) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -534,7 +534,7 @@ func MarchNEQ(v string) predicate.DbPackage { // MarchIn applies the In predicate on the "march" field. func MarchIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -545,7 +545,7 @@ func MarchIn(vs ...string) predicate.DbPackage { // MarchNotIn applies the NotIn predicate on the "march" field. func MarchNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -633,7 +633,7 @@ func VersionNEQ(v string) predicate.DbPackage { // VersionIn applies the In predicate on the "version" field. func VersionIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -644,7 +644,7 @@ func VersionIn(vs ...string) predicate.DbPackage { // VersionNotIn applies the NotIn predicate on the "version" field. func VersionNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -746,7 +746,7 @@ func RepoVersionNEQ(v string) predicate.DbPackage { // RepoVersionIn applies the In predicate on the "repo_version" field. func RepoVersionIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -757,7 +757,7 @@ func RepoVersionIn(vs ...string) predicate.DbPackage { // RepoVersionNotIn applies the NotIn predicate on the "repo_version" field. func RepoVersionNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -859,7 +859,7 @@ func BuildTimeStartNEQ(v time.Time) predicate.DbPackage { // BuildTimeStartIn applies the In predicate on the "build_time_start" field. func BuildTimeStartIn(vs ...time.Time) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -870,7 +870,7 @@ func BuildTimeStartIn(vs ...time.Time) predicate.DbPackage { // BuildTimeStartNotIn applies the NotIn predicate on the "build_time_start" field. func BuildTimeStartNotIn(vs ...time.Time) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -937,7 +937,7 @@ func UpdatedNEQ(v time.Time) predicate.DbPackage { // UpdatedIn applies the In predicate on the "updated" field. func UpdatedIn(vs ...time.Time) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -948,7 +948,7 @@ func UpdatedIn(vs ...time.Time) predicate.DbPackage { // UpdatedNotIn applies the NotIn predicate on the "updated" field. func UpdatedNotIn(vs ...time.Time) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1015,7 +1015,7 @@ func HashNEQ(v string) predicate.DbPackage { // HashIn applies the In predicate on the "hash" field. func HashIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1026,7 +1026,7 @@ func HashIn(vs ...string) predicate.DbPackage { // HashNotIn applies the NotIn predicate on the "hash" field. func HashNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1128,7 +1128,7 @@ func LtoNEQ(v Lto) predicate.DbPackage { // LtoIn applies the In predicate on the "lto" field. func LtoIn(vs ...Lto) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1139,7 +1139,7 @@ func LtoIn(vs ...Lto) predicate.DbPackage { // LtoNotIn applies the NotIn predicate on the "lto" field. func LtoNotIn(vs ...Lto) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1178,7 +1178,7 @@ func LastVersionBuildNEQ(v string) predicate.DbPackage { // LastVersionBuildIn applies the In predicate on the "last_version_build" field. func LastVersionBuildIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1189,7 +1189,7 @@ func LastVersionBuildIn(vs ...string) predicate.DbPackage { // LastVersionBuildNotIn applies the NotIn predicate on the "last_version_build" field. func LastVersionBuildNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1291,7 +1291,7 @@ func LastVerifiedNEQ(v time.Time) predicate.DbPackage { // LastVerifiedIn applies the In predicate on the "last_verified" field. func LastVerifiedIn(vs ...time.Time) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1302,7 +1302,7 @@ func LastVerifiedIn(vs ...time.Time) predicate.DbPackage { // LastVerifiedNotIn applies the NotIn predicate on the "last_verified" field. func LastVerifiedNotIn(vs ...time.Time) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1369,7 +1369,7 @@ func DebugSymbolsNEQ(v DebugSymbols) predicate.DbPackage { // DebugSymbolsIn applies the In predicate on the "debug_symbols" field. func DebugSymbolsIn(vs ...DebugSymbols) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1380,7 +1380,7 @@ func DebugSymbolsIn(vs ...DebugSymbols) predicate.DbPackage { // DebugSymbolsNotIn applies the NotIn predicate on the "debug_symbols" field. func DebugSymbolsNotIn(vs ...DebugSymbols) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1419,7 +1419,7 @@ func MaxRssNEQ(v int64) predicate.DbPackage { // MaxRssIn applies the In predicate on the "max_rss" field. func MaxRssIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1430,7 +1430,7 @@ func MaxRssIn(vs ...int64) predicate.DbPackage { // MaxRssNotIn applies the NotIn predicate on the "max_rss" field. func MaxRssNotIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1497,7 +1497,7 @@ func UTimeNEQ(v int64) predicate.DbPackage { // UTimeIn applies the In predicate on the "u_time" field. func UTimeIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1508,7 +1508,7 @@ func UTimeIn(vs ...int64) predicate.DbPackage { // UTimeNotIn applies the NotIn predicate on the "u_time" field. func UTimeNotIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1575,7 +1575,7 @@ func STimeNEQ(v int64) predicate.DbPackage { // STimeIn applies the In predicate on the "s_time" field. func STimeIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1586,7 +1586,7 @@ func STimeIn(vs ...int64) predicate.DbPackage { // STimeNotIn applies the NotIn predicate on the "s_time" field. func STimeNotIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1653,7 +1653,7 @@ func IoInNEQ(v int64) predicate.DbPackage { // IoInIn applies the In predicate on the "io_in" field. func IoInIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1664,7 +1664,7 @@ func IoInIn(vs ...int64) predicate.DbPackage { // IoInNotIn applies the NotIn predicate on the "io_in" field. func IoInNotIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1731,7 +1731,7 @@ func IoOutNEQ(v int64) predicate.DbPackage { // IoOutIn applies the In predicate on the "io_out" field. func IoOutIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1742,7 +1742,7 @@ func IoOutIn(vs ...int64) predicate.DbPackage { // IoOutNotIn applies the NotIn predicate on the "io_out" field. func IoOutNotIn(vs ...int64) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1809,7 +1809,7 @@ func SrcinfoNEQ(v string) predicate.DbPackage { // SrcinfoIn applies the In predicate on the "srcinfo" field. func SrcinfoIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1820,7 +1820,7 @@ func SrcinfoIn(vs ...string) predicate.DbPackage { // SrcinfoNotIn applies the NotIn predicate on the "srcinfo" field. func SrcinfoNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1922,7 +1922,7 @@ func SrcinfoHashNEQ(v string) predicate.DbPackage { // SrcinfoHashIn applies the In predicate on the "srcinfo_hash" field. func SrcinfoHashIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -1933,7 +1933,7 @@ func SrcinfoHashIn(vs ...string) predicate.DbPackage { // SrcinfoHashNotIn applies the NotIn predicate on the "srcinfo_hash" field. func SrcinfoHashNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -2035,7 +2035,7 @@ func PkgbuildNEQ(v string) predicate.DbPackage { // PkgbuildIn applies the In predicate on the "pkgbuild" field. func PkgbuildIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } @@ -2046,7 +2046,7 @@ func PkgbuildIn(vs ...string) predicate.DbPackage { // PkgbuildNotIn applies the NotIn predicate on the "pkgbuild" field. func PkgbuildNotIn(vs ...string) predicate.DbPackage { - v := make([]interface{}, len(vs)) + v := make([]any, len(vs)) for i := range v { v[i] = vs[i] } diff --git a/ent/dbpackage_query.go b/ent/dbpackage_query.go index fda5ed7..8d7a3d3 100644 --- a/ent/dbpackage_query.go +++ b/ent/dbpackage_query.go @@ -317,10 +317,10 @@ func (dpq *DbPackageQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*D nodes = []*DbPackage{} _spec = dpq.querySpec() ) - _spec.ScanValues = func(columns []string) ([]interface{}, error) { + _spec.ScanValues = func(columns []string) ([]any, error) { return (*DbPackage).scanValues(nil, columns) } - _spec.Assign = func(columns []string, values []interface{}) error { + _spec.Assign = func(columns []string, values []any) error { node := &DbPackage{config: dpq.config} nodes = append(nodes, node) return node.assignValues(columns, values) @@ -353,11 +353,14 @@ func (dpq *DbPackageQuery) sqlCount(ctx context.Context) (int, error) { } func (dpq *DbPackageQuery) sqlExist(ctx context.Context) (bool, error) { - n, err := dpq.sqlCount(ctx) - if err != nil { + switch _, err := dpq.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: return false, fmt.Errorf("ent: check existence: %w", err) + default: + return true, nil } - return n > 0, nil } func (dpq *DbPackageQuery) querySpec() *sqlgraph.QuerySpec { @@ -467,7 +470,7 @@ func (dpgb *DbPackageGroupBy) Aggregate(fns ...AggregateFunc) *DbPackageGroupBy } // Scan applies the group-by query and scans the result into the given value. -func (dpgb *DbPackageGroupBy) Scan(ctx context.Context, v interface{}) error { +func (dpgb *DbPackageGroupBy) Scan(ctx context.Context, v any) error { query, err := dpgb.path(ctx) if err != nil { return err @@ -476,7 +479,7 @@ func (dpgb *DbPackageGroupBy) Scan(ctx context.Context, v interface{}) error { return dpgb.sqlScan(ctx, v) } -func (dpgb *DbPackageGroupBy) sqlScan(ctx context.Context, v interface{}) error { +func (dpgb *DbPackageGroupBy) sqlScan(ctx context.Context, v any) error { for _, f := range dpgb.fields { if !dbpackage.ValidColumn(f) { return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} @@ -523,7 +526,7 @@ type DbPackageSelect struct { } // Scan applies the selector query and scans the result into the given value. -func (dps *DbPackageSelect) Scan(ctx context.Context, v interface{}) error { +func (dps *DbPackageSelect) Scan(ctx context.Context, v any) error { if err := dps.prepareQuery(ctx); err != nil { return err } @@ -531,7 +534,7 @@ func (dps *DbPackageSelect) Scan(ctx context.Context, v interface{}) error { return dps.sqlScan(ctx, v) } -func (dps *DbPackageSelect) sqlScan(ctx context.Context, v interface{}) error { +func (dps *DbPackageSelect) sqlScan(ctx context.Context, v any) error { rows := &sql.Rows{} query, args := dps.sql.Query() if err := dps.driver.Query(ctx, query, args, rows); err != nil { diff --git a/ent/ent.go b/ent/ent.go index 8a67d8a..ff4b2ca 100644 --- a/ent/ent.go +++ b/ent/ent.go @@ -263,11 +263,11 @@ func IsConstraintError(err error) bool { type selector struct { label string flds *[]string - scan func(context.Context, interface{}) error + scan func(context.Context, any) error } // ScanX is like Scan, but panics if an error occurs. -func (s *selector) ScanX(ctx context.Context, v interface{}) { +func (s *selector) ScanX(ctx context.Context, v any) { if err := s.scan(ctx, v); err != nil { panic(err) } diff --git a/ent/enttest/enttest.go b/ent/enttest/enttest.go index 2d1a7f5..5589d44 100644 --- a/ent/enttest/enttest.go +++ b/ent/enttest/enttest.go @@ -18,7 +18,7 @@ type ( // testing.T and testing.B and used by enttest. TestingT interface { FailNow() - Error(...interface{}) + Error(...any) } // Option configures client creation. diff --git a/ent/runtime/runtime.go b/ent/runtime/runtime.go index 5903918..0d373c6 100644 --- a/ent/runtime/runtime.go +++ b/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in git.harting.dev/ALHP/ALHP.GO/ent/runtime.go const ( - Version = "v0.11.2" // Version of ent codegen. - Sum = "h1:UM2/BUhF2FfsxPHRxLjQbhqJNaDdVlOwNIAMLs2jyto=" // Sum of ent codegen. + Version = "v0.11.3" // Version of ent codegen. + Sum = "h1:F5FBGAWiDCGder7YT+lqMnyzXl6d0xU3xMBM/SO3CMc=" // Sum of ent codegen. ) diff --git a/ent/tx.go b/ent/tx.go index d1f8342..c53c086 100644 --- a/ent/tx.go +++ b/ent/tx.go @@ -198,12 +198,12 @@ func (*txDriver) Commit() error { return nil } func (*txDriver) Rollback() error { return nil } // Exec calls tx.Exec. -func (tx *txDriver) Exec(ctx context.Context, query string, args, v interface{}) error { +func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error { return tx.tx.Exec(ctx, query, args, v) } // Query calls tx.Query. -func (tx *txDriver) Query(ctx context.Context, query string, args, v interface{}) error { +func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error { return tx.tx.Query(ctx, query, args, v) }