updated deps; minor fixed; ent regen

This commit is contained in:
Giovanni Harting 2022-08-12 23:00:34 +02:00
parent b7bbb97fd3
commit c7e193e88b
23 changed files with 414 additions and 807 deletions

View File

@ -1,9 +1,10 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"log"
@ -58,7 +59,7 @@ func Open(driverName, dataSourceName string, options ...Option) (*Client, error)
// 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, fmt.Errorf("ent: cannot start a transaction within a transaction")
return nil, errors.New("ent: cannot start a transaction within a transaction")
}
tx, err := newTx(ctx, c.driver)
if err != nil {
@ -76,7 +77,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
// BeginTx returns a transactional client with specified options.
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
if _, ok := c.driver.(*txDriver); ok {
return nil, fmt.Errorf("ent: cannot start a transaction within a transaction")
return nil, errors.New("ent: cannot start a transaction within a transaction")
}
tx, err := c.driver.(interface {
BeginTx(context.Context, *sql.TxOptions) (dialect.Tx, error)
@ -99,7 +100,6 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
// DbPackage.
// Query().
// Count(ctx)
//
func (c *Client) Debug() *Client {
if c.debug {
return c
@ -138,7 +138,7 @@ func (c *DbPackageClient) Use(hooks ...Hook) {
c.hooks.DbPackage = append(c.hooks.DbPackage, hooks...)
}
// Create returns a create builder for DbPackage.
// Create returns a builder for creating a DbPackage entity.
func (c *DbPackageClient) Create() *DbPackageCreate {
mutation := newDbPackageMutation(c.config, OpCreate)
return &DbPackageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
@ -173,12 +173,12 @@ func (c *DbPackageClient) Delete() *DbPackageDelete {
return &DbPackageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
}
// DeleteOne returns a delete builder for the given entity.
// DeleteOne returns a builder for deleting the given entity.
func (c *DbPackageClient) DeleteOne(dp *DbPackage) *DbPackageDeleteOne {
return c.DeleteOneID(dp.ID)
}
// DeleteOneID returns a delete builder for the given id.
// DeleteOne returns a builder for deleting the given entity by its id.
func (c *DbPackageClient) DeleteOneID(id int) *DbPackageDeleteOne {
builder := c.Delete().Where(dbpackage.ID(id))
builder.mutation.id = &id

View File

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package ent

View File

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package ent

View File

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package ent
@ -235,11 +235,11 @@ func (dp *DbPackage) Update() *DbPackageUpdateOne {
// Unwrap unwraps the DbPackage entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (dp *DbPackage) Unwrap() *DbPackage {
tx, ok := dp.config.driver.(*txDriver)
_tx, ok := dp.config.driver.(*txDriver)
if !ok {
panic("ent: DbPackage is not a transactional entity")
}
dp.config.driver = tx.drv
dp.config.driver = _tx.drv
return dp
}
@ -247,55 +247,74 @@ func (dp *DbPackage) Unwrap() *DbPackage {
func (dp *DbPackage) String() string {
var builder strings.Builder
builder.WriteString("DbPackage(")
builder.WriteString(fmt.Sprintf("id=%v", dp.ID))
builder.WriteString(", pkgbase=")
builder.WriteString(fmt.Sprintf("id=%v, ", dp.ID))
builder.WriteString("pkgbase=")
builder.WriteString(dp.Pkgbase)
builder.WriteString(", packages=")
builder.WriteString(", ")
builder.WriteString("packages=")
builder.WriteString(fmt.Sprintf("%v", dp.Packages))
builder.WriteString(", status=")
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(fmt.Sprintf("%v", dp.Status))
builder.WriteString(", skip_reason=")
builder.WriteString(", ")
builder.WriteString("skip_reason=")
builder.WriteString(dp.SkipReason)
builder.WriteString(", repository=")
builder.WriteString(", ")
builder.WriteString("repository=")
builder.WriteString(fmt.Sprintf("%v", dp.Repository))
builder.WriteString(", march=")
builder.WriteString(", ")
builder.WriteString("march=")
builder.WriteString(dp.March)
builder.WriteString(", version=")
builder.WriteString(", ")
builder.WriteString("version=")
builder.WriteString(dp.Version)
builder.WriteString(", repo_version=")
builder.WriteString(", ")
builder.WriteString("repo_version=")
builder.WriteString(dp.RepoVersion)
builder.WriteString(", build_time_start=")
builder.WriteString(", ")
builder.WriteString("build_time_start=")
builder.WriteString(dp.BuildTimeStart.Format(time.ANSIC))
builder.WriteString(", updated=")
builder.WriteString(", ")
builder.WriteString("updated=")
builder.WriteString(dp.Updated.Format(time.ANSIC))
builder.WriteString(", hash=")
builder.WriteString(", ")
builder.WriteString("hash=")
builder.WriteString(dp.Hash)
builder.WriteString(", lto=")
builder.WriteString(", ")
builder.WriteString("lto=")
builder.WriteString(fmt.Sprintf("%v", dp.Lto))
builder.WriteString(", last_version_build=")
builder.WriteString(", ")
builder.WriteString("last_version_build=")
builder.WriteString(dp.LastVersionBuild)
builder.WriteString(", last_verified=")
builder.WriteString(", ")
builder.WriteString("last_verified=")
builder.WriteString(dp.LastVerified.Format(time.ANSIC))
builder.WriteString(", debug_symbols=")
builder.WriteString(", ")
builder.WriteString("debug_symbols=")
builder.WriteString(fmt.Sprintf("%v", dp.DebugSymbols))
builder.WriteString(", ")
if v := dp.MaxRss; v != nil {
builder.WriteString(", max_rss=")
builder.WriteString("max_rss=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteString(", ")
if v := dp.UTime; v != nil {
builder.WriteString(", u_time=")
builder.WriteString("u_time=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteString(", ")
if v := dp.STime; v != nil {
builder.WriteString(", s_time=")
builder.WriteString("s_time=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteString(", ")
if v := dp.IoIn; v != nil {
builder.WriteString(", io_in=")
builder.WriteString("io_in=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteString(", ")
if v := dp.IoOut; v != nil {
builder.WriteString(", io_out=")
builder.WriteString("io_out=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteByte(')')

View File

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package dbpackage

View File

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package dbpackage
@ -33,12 +33,6 @@ 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) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(ids) == 0 {
s.Where(sql.False())
return
}
v := make([]interface{}, len(ids))
for i := range v {
v[i] = ids[i]
@ -50,12 +44,6 @@ 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) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(ids) == 0 {
s.Where(sql.False())
return
}
v := make([]interface{}, len(ids))
for i := range v {
v[i] = ids[i]
@ -218,12 +206,6 @@ func PkgbaseIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldPkgbase), v...))
})
}
@ -235,12 +217,6 @@ func PkgbaseNotIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldPkgbase), v...))
})
}
@ -343,12 +319,6 @@ func StatusIn(vs ...Status) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldStatus), v...))
})
}
@ -360,12 +330,6 @@ func StatusNotIn(vs ...Status) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldStatus), v...))
})
}
@ -405,12 +369,6 @@ func SkipReasonIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldSkipReason), v...))
})
}
@ -422,12 +380,6 @@ func SkipReasonNotIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldSkipReason), v...))
})
}
@ -530,12 +482,6 @@ func RepositoryIn(vs ...Repository) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldRepository), v...))
})
}
@ -547,12 +493,6 @@ func RepositoryNotIn(vs ...Repository) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldRepository), v...))
})
}
@ -578,12 +518,6 @@ func MarchIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldMarch), v...))
})
}
@ -595,12 +529,6 @@ func MarchNotIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldMarch), v...))
})
}
@ -689,12 +617,6 @@ func VersionIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldVersion), v...))
})
}
@ -706,12 +628,6 @@ func VersionNotIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldVersion), v...))
})
}
@ -814,12 +730,6 @@ func RepoVersionIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldRepoVersion), v...))
})
}
@ -831,12 +741,6 @@ func RepoVersionNotIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldRepoVersion), v...))
})
}
@ -939,12 +843,6 @@ func BuildTimeStartIn(vs ...time.Time) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldBuildTimeStart), v...))
})
}
@ -956,12 +854,6 @@ func BuildTimeStartNotIn(vs ...time.Time) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldBuildTimeStart), v...))
})
}
@ -1029,12 +921,6 @@ func UpdatedIn(vs ...time.Time) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldUpdated), v...))
})
}
@ -1046,12 +932,6 @@ func UpdatedNotIn(vs ...time.Time) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldUpdated), v...))
})
}
@ -1119,12 +999,6 @@ func HashIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldHash), v...))
})
}
@ -1136,12 +1010,6 @@ func HashNotIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldHash), v...))
})
}
@ -1244,12 +1112,6 @@ func LtoIn(vs ...Lto) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldLto), v...))
})
}
@ -1261,12 +1123,6 @@ func LtoNotIn(vs ...Lto) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldLto), v...))
})
}
@ -1306,12 +1162,6 @@ func LastVersionBuildIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldLastVersionBuild), v...))
})
}
@ -1323,12 +1173,6 @@ func LastVersionBuildNotIn(vs ...string) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldLastVersionBuild), v...))
})
}
@ -1431,12 +1275,6 @@ func LastVerifiedIn(vs ...time.Time) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldLastVerified), v...))
})
}
@ -1448,12 +1286,6 @@ func LastVerifiedNotIn(vs ...time.Time) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldLastVerified), v...))
})
}
@ -1521,12 +1353,6 @@ func DebugSymbolsIn(vs ...DebugSymbols) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldDebugSymbols), v...))
})
}
@ -1538,12 +1364,6 @@ func DebugSymbolsNotIn(vs ...DebugSymbols) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldDebugSymbols), v...))
})
}
@ -1583,12 +1403,6 @@ func MaxRssIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldMaxRss), v...))
})
}
@ -1600,12 +1414,6 @@ func MaxRssNotIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldMaxRss), v...))
})
}
@ -1673,12 +1481,6 @@ func UTimeIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldUTime), v...))
})
}
@ -1690,12 +1492,6 @@ func UTimeNotIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldUTime), v...))
})
}
@ -1763,12 +1559,6 @@ func STimeIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldSTime), v...))
})
}
@ -1780,12 +1570,6 @@ func STimeNotIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldSTime), v...))
})
}
@ -1853,12 +1637,6 @@ func IoInIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldIoIn), v...))
})
}
@ -1870,12 +1648,6 @@ func IoInNotIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldIoIn), v...))
})
}
@ -1943,12 +1715,6 @@ func IoOutIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldIoOut), v...))
})
}
@ -1960,12 +1726,6 @@ func IoOutNotIn(vs ...int64) predicate.DbPackage {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldIoOut), v...))
})
}

View File

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package ent
@ -308,9 +308,15 @@ func (dpc *DbPackageCreate) Save(ctx context.Context) (*DbPackage, error) {
}
mut = dpc.hooks[i](mut)
}
if _, err := mut.Mutate(ctx, dpc.mutation); err != nil {
v, err := mut.Mutate(ctx, dpc.mutation)
if err != nil {
return nil, err
}
nv, ok := v.(*DbPackage)
if !ok {
return nil, fmt.Errorf("unexpected node type %T returned from DbPackageMutation", v)
}
node = nv
}
return node, err
}
@ -401,7 +407,7 @@ func (dpc *DbPackageCreate) sqlSave(ctx context.Context) (*DbPackage, error) {
_node, _spec := dpc.createSpec()
if err := sqlgraph.CreateNode(ctx, dpc.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{err.Error(), err}
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
@ -617,7 +623,7 @@ func (dpcb *DbPackageCreateBulk) Save(ctx context.Context) ([]*DbPackage, error)
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, dpcb.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{err.Error(), err}
err = &ConstraintError{msg: err.Error(), wrap: err}
}
}
}
@ -625,11 +631,11 @@ func (dpcb *DbPackageCreateBulk) Save(ctx context.Context) ([]*DbPackage, error)
return nil, err
}
mutation.id = &nodes[i].ID
mutation.done = true
if specs[i].ID.Value != nil {
id := specs[i].ID.Value.(int64)
nodes[i].ID = int(id)
}
mutation.done = true
return nodes[i], nil
})
for i := len(builder.hooks) - 1; i >= 0; i-- {

View File

@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package ent
@ -84,7 +84,11 @@ func (dpd *DbPackageDelete) sqlExec(ctx context.Context) (int, error) {
}
}
}
return sqlgraph.DeleteNodes(ctx, dpd.driver, _spec)
affected, err := sqlgraph.DeleteNodes(ctx, dpd.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return affected, err
}
// DbPackageDeleteOne is the builder for deleting a single DbPackage entity.

View File

@ -1,10 +1,9 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"math"
@ -24,7 +23,7 @@ type DbPackageQuery struct {
order []OrderFunc
fields []string
predicates []predicate.DbPackage
modifiers []func(s *sql.Selector)
modifiers []func(*sql.Selector)
// intermediate query (i.e. traversal path).
sql *sql.Selector
path func(context.Context) (*sql.Selector, error)
@ -263,17 +262,18 @@ func (dpq *DbPackageQuery) Clone() *DbPackageQuery {
// GroupBy(dbpackage.FieldPkgbase).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
//
func (dpq *DbPackageQuery) GroupBy(field string, fields ...string) *DbPackageGroupBy {
group := &DbPackageGroupBy{config: dpq.config}
group.fields = append([]string{field}, fields...)
group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
grbuild := &DbPackageGroupBy{config: dpq.config}
grbuild.fields = append([]string{field}, fields...)
grbuild.path = func(ctx context.Context) (prev *sql.Selector, err error) {
if err := dpq.prepareQuery(ctx); err != nil {
return nil, err
}
return dpq.sqlQuery(ctx), nil
}
return group
grbuild.label = dbpackage.Label
grbuild.flds, grbuild.scan = &grbuild.fields, grbuild.Scan
return grbuild
}
// Select allows the selection one or more fields/columns for the given query,
@ -288,10 +288,12 @@ func (dpq *DbPackageQuery) GroupBy(field string, fields ...string) *DbPackageGro
// client.DbPackage.Query().
// Select(dbpackage.FieldPkgbase).
// Scan(ctx, &v)
//
func (dpq *DbPackageQuery) Select(fields ...string) *DbPackageSelect {
dpq.fields = append(dpq.fields, fields...)
return &DbPackageSelect{DbPackageQuery: dpq}
selbuild := &DbPackageSelect{DbPackageQuery: dpq}
selbuild.label = dbpackage.Label
selbuild.flds, selbuild.scan = &dpq.fields, selbuild.Scan
return selbuild
}
func (dpq *DbPackageQuery) prepareQuery(ctx context.Context) error {
@ -310,26 +312,25 @@ func (dpq *DbPackageQuery) prepareQuery(ctx context.Context) error {
return nil
}
func (dpq *DbPackageQuery) sqlAll(ctx context.Context) ([]*DbPackage, error) {
func (dpq *DbPackageQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*DbPackage, error) {
var (
nodes = []*DbPackage{}
_spec = dpq.querySpec()
)
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
node := &DbPackage{config: dpq.config}
nodes = append(nodes, node)
return node.scanValues(columns)
return (*DbPackage).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []interface{}) error {
if len(nodes) == 0 {
return fmt.Errorf("ent: Assign called without calling ScanValues")
}
node := nodes[len(nodes)-1]
node := &DbPackage{config: dpq.config}
nodes = append(nodes, node)
return node.assignValues(columns, values)
}
if len(dpq.modifiers) > 0 {
_spec.Modifiers = dpq.modifiers
}
for i := range hooks {
hooks[i](ctx, _spec)
}
if err := sqlgraph.QueryNodes(ctx, dpq.driver, _spec); err != nil {
return nil, err
}
@ -451,6 +452,7 @@ func (dpq *DbPackageQuery) Modify(modifiers ...func(s *sql.Selector)) *DbPackage
// DbPackageGroupBy is the group-by builder for DbPackage entities.
type DbPackageGroupBy struct {
config
selector
fields []string
fns []AggregateFunc
// intermediate query (i.e. traversal path).
@ -474,209 +476,6 @@ func (dpgb *DbPackageGroupBy) Scan(ctx context.Context, v interface{}) error {
return dpgb.sqlScan(ctx, v)
}
// ScanX is like Scan, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) ScanX(ctx context.Context, v interface{}) {
if err := dpgb.Scan(ctx, v); err != nil {
panic(err)
}
}
// Strings returns list of strings from group-by.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) Strings(ctx context.Context) ([]string, error) {
if len(dpgb.fields) > 1 {
return nil, errors.New("ent: DbPackageGroupBy.Strings is not achievable when grouping more than 1 field")
}
var v []string
if err := dpgb.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// StringsX is like Strings, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) StringsX(ctx context.Context) []string {
v, err := dpgb.Strings(ctx)
if err != nil {
panic(err)
}
return v
}
// String returns a single string from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) String(ctx context.Context) (_ string, err error) {
var v []string
if v, err = dpgb.Strings(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{dbpackage.Label}
default:
err = fmt.Errorf("ent: DbPackageGroupBy.Strings returned %d results when one was expected", len(v))
}
return
}
// StringX is like String, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) StringX(ctx context.Context) string {
v, err := dpgb.String(ctx)
if err != nil {
panic(err)
}
return v
}
// Ints returns list of ints from group-by.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) Ints(ctx context.Context) ([]int, error) {
if len(dpgb.fields) > 1 {
return nil, errors.New("ent: DbPackageGroupBy.Ints is not achievable when grouping more than 1 field")
}
var v []int
if err := dpgb.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// IntsX is like Ints, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) IntsX(ctx context.Context) []int {
v, err := dpgb.Ints(ctx)
if err != nil {
panic(err)
}
return v
}
// Int returns a single int from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) Int(ctx context.Context) (_ int, err error) {
var v []int
if v, err = dpgb.Ints(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{dbpackage.Label}
default:
err = fmt.Errorf("ent: DbPackageGroupBy.Ints returned %d results when one was expected", len(v))
}
return
}
// IntX is like Int, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) IntX(ctx context.Context) int {
v, err := dpgb.Int(ctx)
if err != nil {
panic(err)
}
return v
}
// Float64s returns list of float64s from group-by.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) Float64s(ctx context.Context) ([]float64, error) {
if len(dpgb.fields) > 1 {
return nil, errors.New("ent: DbPackageGroupBy.Float64s is not achievable when grouping more than 1 field")
}
var v []float64
if err := dpgb.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// Float64sX is like Float64s, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) Float64sX(ctx context.Context) []float64 {
v, err := dpgb.Float64s(ctx)
if err != nil {
panic(err)
}
return v
}
// Float64 returns a single float64 from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) Float64(ctx context.Context) (_ float64, err error) {
var v []float64
if v, err = dpgb.Float64s(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{dbpackage.Label}
default:
err = fmt.Errorf("ent: DbPackageGroupBy.Float64s returned %d results when one was expected", len(v))
}
return
}
// Float64X is like Float64, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) Float64X(ctx context.Context) float64 {
v, err := dpgb.Float64(ctx)
if err != nil {
panic(err)
}
return v
}
// Bools returns list of bools from group-by.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) Bools(ctx context.Context) ([]bool, error) {
if len(dpgb.fields) > 1 {
return nil, errors.New("ent: DbPackageGroupBy.Bools is not achievable when grouping more than 1 field")
}
var v []bool
if err := dpgb.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// BoolsX is like Bools, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) BoolsX(ctx context.Context) []bool {
v, err := dpgb.Bools(ctx)
if err != nil {
panic(err)
}
return v
}
// Bool returns a single bool from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dpgb *DbPackageGroupBy) Bool(ctx context.Context) (_ bool, err error) {
var v []bool
if v, err = dpgb.Bools(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{dbpackage.Label}
default:
err = fmt.Errorf("ent: DbPackageGroupBy.Bools returned %d results when one was expected", len(v))
}
return
}
// BoolX is like Bool, but panics if an error occurs.
func (dpgb *DbPackageGroupBy) BoolX(ctx context.Context) bool {
v, err := dpgb.Bool(ctx)
if err != nil {
panic(err)
}
return v
}
func (dpgb *DbPackageGroupBy) sqlScan(ctx context.Context, v interface{}) error {
for _, f := range dpgb.fields {
if !dbpackage.ValidColumn(f) {
@ -718,6 +517,7 @@ func (dpgb *DbPackageGroupBy) sqlQuery() *sql.Selector {
// DbPackageSelect is the builder for selecting fields of DbPackage entities.
type DbPackageSelect struct {
*DbPackageQuery
selector
// intermediate query (i.e. traversal path).
sql *sql.Selector
}
@ -731,201 +531,6 @@ func (dps *DbPackageSelect) Scan(ctx context.Context, v interface{}) error {
return dps.sqlScan(ctx, v)
}
// ScanX is like Scan, but panics if an error occurs.
func (dps *DbPackageSelect) ScanX(ctx context.Context, v interface{}) {
if err := dps.Scan(ctx, v); err != nil {
panic(err)
}
}
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) Strings(ctx context.Context) ([]string, error) {
if len(dps.fields) > 1 {
return nil, errors.New("ent: DbPackageSelect.Strings is not achievable when selecting more than 1 field")
}
var v []string
if err := dps.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// StringsX is like Strings, but panics if an error occurs.
func (dps *DbPackageSelect) StringsX(ctx context.Context) []string {
v, err := dps.Strings(ctx)
if err != nil {
panic(err)
}
return v
}
// String returns a single string from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) String(ctx context.Context) (_ string, err error) {
var v []string
if v, err = dps.Strings(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{dbpackage.Label}
default:
err = fmt.Errorf("ent: DbPackageSelect.Strings returned %d results when one was expected", len(v))
}
return
}
// StringX is like String, but panics if an error occurs.
func (dps *DbPackageSelect) StringX(ctx context.Context) string {
v, err := dps.String(ctx)
if err != nil {
panic(err)
}
return v
}
// Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) Ints(ctx context.Context) ([]int, error) {
if len(dps.fields) > 1 {
return nil, errors.New("ent: DbPackageSelect.Ints is not achievable when selecting more than 1 field")
}
var v []int
if err := dps.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// IntsX is like Ints, but panics if an error occurs.
func (dps *DbPackageSelect) IntsX(ctx context.Context) []int {
v, err := dps.Ints(ctx)
if err != nil {
panic(err)
}
return v
}
// Int returns a single int from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) Int(ctx context.Context) (_ int, err error) {
var v []int
if v, err = dps.Ints(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{dbpackage.Label}
default:
err = fmt.Errorf("ent: DbPackageSelect.Ints returned %d results when one was expected", len(v))
}
return
}
// IntX is like Int, but panics if an error occurs.
func (dps *DbPackageSelect) IntX(ctx context.Context) int {
v, err := dps.Int(ctx)
if err != nil {
panic(err)
}
return v
}
// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) Float64s(ctx context.Context) ([]float64, error) {
if len(dps.fields) > 1 {
return nil, errors.New("ent: DbPackageSelect.Float64s is not achievable when selecting more than 1 field")
}
var v []float64
if err := dps.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// Float64sX is like Float64s, but panics if an error occurs.
func (dps *DbPackageSelect) Float64sX(ctx context.Context) []float64 {
v, err := dps.Float64s(ctx)
if err != nil {
panic(err)
}
return v
}
// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) Float64(ctx context.Context) (_ float64, err error) {
var v []float64
if v, err = dps.Float64s(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{dbpackage.Label}
default:
err = fmt.Errorf("ent: DbPackageSelect.Float64s returned %d results when one was expected", len(v))
}
return
}
// Float64X is like Float64, but panics if an error occurs.
func (dps *DbPackageSelect) Float64X(ctx context.Context) float64 {
v, err := dps.Float64(ctx)
if err != nil {
panic(err)
}
return v
}
// Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) Bools(ctx context.Context) ([]bool, error) {
if len(dps.fields) > 1 {
return nil, errors.New("ent: DbPackageSelect.Bools is not achievable when selecting more than 1 field")
}
var v []bool
if err := dps.Scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// BoolsX is like Bools, but panics if an error occurs.
func (dps *DbPackageSelect) BoolsX(ctx context.Context) []bool {
v, err := dps.Bools(ctx)
if err != nil {
panic(err)
}
return v
}
// Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (dps *DbPackageSelect) Bool(ctx context.Context) (_ bool, err error) {
var v []bool
if v, err = dps.Bools(ctx); err != nil {
return
}
switch len(v) {
case 1: