regen ent with version 0.10.0
This commit is contained in:
parent
f0ac9d6052
commit
adad7c1acd
@ -87,6 +87,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
cfg := c.config
|
||||
cfg.driver = &txDriver{tx: tx, drv: c.driver}
|
||||
return &Tx{
|
||||
ctx: ctx,
|
||||
config: cfg,
|
||||
DbPackage: NewDbPackageClient(cfg),
|
||||
}, nil
|
||||
|
@ -282,37 +282,37 @@ func (dpc *DbPackageCreate) defaults() {
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (dpc *DbPackageCreate) check() error {
|
||||
if _, ok := dpc.mutation.Pkgbase(); !ok {
|
||||
return &ValidationError{Name: "pkgbase", err: errors.New(`ent: missing required field "pkgbase"`)}
|
||||
return &ValidationError{Name: "pkgbase", err: errors.New(`ent: missing required field "DbPackage.pkgbase"`)}
|
||||
}
|
||||
if v, ok := dpc.mutation.Pkgbase(); ok {
|
||||
if err := dbpackage.PkgbaseValidator(v); err != nil {
|
||||
return &ValidationError{Name: "pkgbase", err: fmt.Errorf(`ent: validator failed for field "pkgbase": %w`, err)}
|
||||
return &ValidationError{Name: "pkgbase", err: fmt.Errorf(`ent: validator failed for field "DbPackage.pkgbase": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpc.mutation.Status(); ok {
|
||||
if err := dbpackage.StatusValidator(v); err != nil {
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "status": %w`, err)}
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "DbPackage.status": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := dpc.mutation.Repository(); !ok {
|
||||
return &ValidationError{Name: "repository", err: errors.New(`ent: missing required field "repository"`)}
|
||||
return &ValidationError{Name: "repository", err: errors.New(`ent: missing required field "DbPackage.repository"`)}
|
||||
}
|
||||
if v, ok := dpc.mutation.Repository(); ok {
|
||||
if err := dbpackage.RepositoryValidator(v); err != nil {
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf(`ent: validator failed for field "repository": %w`, err)}
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf(`ent: validator failed for field "DbPackage.repository": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := dpc.mutation.March(); !ok {
|
||||
return &ValidationError{Name: "march", err: errors.New(`ent: missing required field "march"`)}
|
||||
return &ValidationError{Name: "march", err: errors.New(`ent: missing required field "DbPackage.march"`)}
|
||||
}
|
||||
if v, ok := dpc.mutation.March(); ok {
|
||||
if err := dbpackage.MarchValidator(v); err != nil {
|
||||
return &ValidationError{Name: "march", err: fmt.Errorf(`ent: validator failed for field "march": %w`, err)}
|
||||
return &ValidationError{Name: "march", err: fmt.Errorf(`ent: validator failed for field "DbPackage.march": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpc.mutation.Lto(); ok {
|
||||
if err := dbpackage.LtoValidator(v); err != nil {
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "lto": %w`, err)}
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DbPackage.lto": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -343,6 +343,10 @@ func (dpq *DbPackageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
if len(dpq.modifiers) > 0 {
|
||||
_spec.Modifiers = dpq.modifiers
|
||||
}
|
||||
_spec.Node.Columns = dpq.fields
|
||||
if len(dpq.fields) > 0 {
|
||||
_spec.Unique = dpq.unique != nil && *dpq.unique
|
||||
}
|
||||
return sqlgraph.CountNodes(ctx, dpq.driver, _spec)
|
||||
}
|
||||
|
||||
@ -414,6 +418,9 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
selector = dpq.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
if dpq.unique != nil && *dpq.unique {
|
||||
selector.Distinct()
|
||||
}
|
||||
for _, m := range dpq.modifiers {
|
||||
m(selector)
|
||||
}
|
||||
@ -701,9 +708,7 @@ func (dpgb *DbPackageGroupBy) sqlQuery() *sql.Selector {
|
||||
for _, f := range dpgb.fields {
|
||||
columns = append(columns, selector.C(f))
|
||||
}
|
||||
for _, c := range aggregation {
|
||||
columns = append(columns, c)
|
||||
}
|
||||
columns = append(columns, aggregation...)
|
||||
selector.Select(columns...)
|
||||
}
|
||||
return selector.GroupBy(selector.Columns(dpgb.fields...)...)
|
||||
|
@ -4,6 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@ -334,17 +335,17 @@ func (dpu *DbPackageUpdate) ExecX(ctx context.Context) {
|
||||
func (dpu *DbPackageUpdate) check() error {
|
||||
if v, ok := dpu.mutation.Status(); ok {
|
||||
if err := dbpackage.StatusValidator(v); err != nil {
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf("ent: validator failed for field \"status\": %w", err)}
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "DbPackage.status": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpu.mutation.Repository(); ok {
|
||||
if err := dbpackage.RepositoryValidator(v); err != nil {
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf("ent: validator failed for field \"repository\": %w", err)}
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf(`ent: validator failed for field "DbPackage.repository": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpu.mutation.Lto(); ok {
|
||||
if err := dbpackage.LtoValidator(v); err != nil {
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf("ent: validator failed for field \"lto\": %w", err)}
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DbPackage.lto": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -864,17 +865,17 @@ func (dpuo *DbPackageUpdateOne) ExecX(ctx context.Context) {
|
||||
func (dpuo *DbPackageUpdateOne) check() error {
|
||||
if v, ok := dpuo.mutation.Status(); ok {
|
||||
if err := dbpackage.StatusValidator(v); err != nil {
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf("ent: validator failed for field \"status\": %w", err)}
|
||||
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "DbPackage.status": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpuo.mutation.Repository(); ok {
|
||||
if err := dbpackage.RepositoryValidator(v); err != nil {
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf("ent: validator failed for field \"repository\": %w", err)}
|
||||
return &ValidationError{Name: "repository", err: fmt.Errorf(`ent: validator failed for field "DbPackage.repository": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpuo.mutation.Lto(); ok {
|
||||
if err := dbpackage.LtoValidator(v); err != nil {
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf("ent: validator failed for field \"lto\": %w", err)}
|
||||
return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DbPackage.lto": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -893,7 +894,7 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
|
||||
}
|
||||
id, ok := dpuo.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing DbPackage.ID for update")}
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "DbPackage.id" for update`)}
|
||||
}
|
||||
_spec.Node.ID.Value = id
|
||||
if fields := dpuo.fields; len(fields) > 0 {
|
||||
|
@ -141,7 +141,7 @@ func Sum(field string) AggregateFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// ValidationError returns when validating a field fails.
|
||||
// ValidationError returns when validating a field or edge fails.
|
||||
type ValidationError struct {
|
||||
Name string // Field or edge name.
|
||||
err error
|
||||
|
@ -37,8 +37,7 @@ var (
|
||||
|
||||
// Schema is the API for creating, migrating and dropping a schema.
|
||||
type Schema struct {
|
||||
drv dialect.Driver
|
||||
universalID bool
|
||||
drv dialect.Driver
|
||||
}
|
||||
|
||||
// NewSchema creates a new schema client.
|
||||
|
@ -4,6 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
@ -83,7 +84,7 @@ func withDbPackageID(id int) dbpackageOption {
|
||||
m.oldValue = func(ctx context.Context) (*DbPackage, error) {
|
||||
once.Do(func() {
|
||||
if m.done {
|
||||
err = fmt.Errorf("querying old values post mutation is not allowed")
|
||||
err = errors.New("querying old values post mutation is not allowed")
|
||||
} else {
|
||||
value, err = m.Client().DbPackage.Get(ctx, id)
|
||||
}
|
||||
@ -116,7 +117,7 @@ func (m DbPackageMutation) Client() *Client {
|
||||
// it returns an error otherwise.
|
||||
func (m DbPackageMutation) Tx() (*Tx, error) {
|
||||
if _, ok := m.driver.(*txDriver); !ok {
|
||||
return nil, fmt.Errorf("ent: mutation is not running in a transaction")
|
||||
return nil, errors.New("ent: mutation is not running in a transaction")
|
||||
}
|
||||
tx := &Tx{config: m.config}
|
||||
tx.init()
|
||||
@ -132,6 +133,25 @@ func (m *DbPackageMutation) ID() (id int, exists bool) {
|
||||
return *m.id, true
|
||||
}
|
||||
|
||||
// IDs queries the database and returns the entity ids that match the mutation's predicate.
|
||||
// That means, if the mutation is applied within a transaction with an isolation level such
|
||||
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
|
||||
// or updated by the mutation.
|
||||
func (m *DbPackageMutation) IDs(ctx context.Context) ([]int, error) {
|
||||
switch {
|
||||
case m.op.Is(OpUpdateOne | OpDeleteOne):
|
||||
id, exists := m.ID()
|
||||
if exists {
|
||||
return []int{id}, nil
|
||||
}
|
||||
fallthrough
|
||||
case m.op.Is(OpUpdate | OpDelete):
|
||||
return m.Client().DbPackage.Query().Where(m.predicates...).IDs(ctx)
|
||||
default:
|
||||
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
||||
}
|
||||
}
|
||||
|
||||
// SetPkgbase sets the "pkgbase" field.
|
||||
func (m *DbPackageMutation) SetPkgbase(s string) {
|
||||
m.pkgbase = &s
|
||||
@ -151,10 +171,10 @@ func (m *DbPackageMutation) Pkgbase() (r string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldPkgbase(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldPkgbase is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldPkgbase is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldPkgbase requires an ID field in the mutation")
|
||||
return v, errors.New("OldPkgbase requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -187,10 +207,10 @@ func (m *DbPackageMutation) Packages() (r []string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldPackages(ctx context.Context) (v []string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldPackages is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldPackages is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldPackages requires an ID field in the mutation")
|
||||
return v, errors.New("OldPackages requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -236,10 +256,10 @@ func (m *DbPackageMutation) Status() (r dbpackage.Status, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldStatus(ctx context.Context) (v dbpackage.Status, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldStatus is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldStatus is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldStatus requires an ID field in the mutation")
|
||||
return v, errors.New("OldStatus requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -285,10 +305,10 @@ func (m *DbPackageMutation) SkipReason() (r string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldSkipReason(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldSkipReason is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldSkipReason is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldSkipReason requires an ID field in the mutation")
|
||||
return v, errors.New("OldSkipReason requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -334,10 +354,10 @@ func (m *DbPackageMutation) Repository() (r dbpackage.Repository, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldRepository(ctx context.Context) (v dbpackage.Repository, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldRepository is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldRepository is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldRepository requires an ID field in the mutation")
|
||||
return v, errors.New("OldRepository requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -370,10 +390,10 @@ func (m *DbPackageMutation) March() (r string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldMarch(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldMarch is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldMarch is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldMarch requires an ID field in the mutation")
|
||||
return v, errors.New("OldMarch requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -406,10 +426,10 @@ func (m *DbPackageMutation) Version() (r string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldVersion(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldVersion is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldVersion is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldVersion requires an ID field in the mutation")
|
||||
return v, errors.New("OldVersion requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -455,10 +475,10 @@ func (m *DbPackageMutation) RepoVersion() (r string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldRepoVersion(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldRepoVersion is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldRepoVersion is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldRepoVersion requires an ID field in the mutation")
|
||||
return v, errors.New("OldRepoVersion requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -504,10 +524,10 @@ func (m *DbPackageMutation) BuildTimeStart() (r time.Time, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldBuildTimeStart(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldBuildTimeStart is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldBuildTimeStart is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldBuildTimeStart requires an ID field in the mutation")
|
||||
return v, errors.New("OldBuildTimeStart requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -553,10 +573,10 @@ func (m *DbPackageMutation) BuildTimeEnd() (r time.Time, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldBuildTimeEnd(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldBuildTimeEnd is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldBuildTimeEnd is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldBuildTimeEnd requires an ID field in the mutation")
|
||||
return v, errors.New("OldBuildTimeEnd requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -602,10 +622,10 @@ func (m *DbPackageMutation) Updated() (r time.Time, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldUpdated(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldUpdated is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldUpdated is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldUpdated requires an ID field in the mutation")
|
||||
return v, errors.New("OldUpdated requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -651,10 +671,10 @@ func (m *DbPackageMutation) Hash() (r string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldHash(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldHash is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldHash is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldHash requires an ID field in the mutation")
|
||||
return v, errors.New("OldHash requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -700,10 +720,10 @@ func (m *DbPackageMutation) Lto() (r dbpackage.Lto, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldLto(ctx context.Context) (v dbpackage.Lto, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldLto is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldLto is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldLto requires an ID field in the mutation")
|
||||
return v, errors.New("OldLto requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -749,10 +769,10 @@ func (m *DbPackageMutation) LastVersionBuild() (r string, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldLastVersionBuild(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldLastVersionBuild is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldLastVersionBuild is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldLastVersionBuild requires an ID field in the mutation")
|
||||
return v, errors.New("OldLastVersionBuild requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
@ -798,10 +818,10 @@ func (m *DbPackageMutation) LastVerified() (r time.Time, exists bool) {
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *DbPackageMutation) OldLastVerified(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, fmt.Errorf("OldLastVerified is only allowed on UpdateOne operations")
|
||||
return v, errors.New("OldLastVerified is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, fmt.Errorf("OldLastVerified requires an ID field in the mutation")
|
||||
return v, errors.New("OldLastVerified requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
|
@ -5,6 +5,6 @@ package runtime
|
||||
// The schema-stitching logic is generated in ALHP.GO/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.9.1" // Version of ent codegen.
|
||||
Sum = "h1:IG8andyeD79GG24U8Q+1Y45hQXj6gY5evSBcva5gtBk=" // Sum of ent codegen.
|
||||
Version = "v0.10.0" // Version of ent codegen.
|
||||
Sum = "h1:9cBomE1fh+WX34DPYQL7tDNAIvhKa3tXvwxuLyhYCMo=" // Sum of ent codegen.
|
||||
)
|
||||
|
@ -30,7 +30,7 @@ type Tx struct {
|
||||
}
|
||||
|
||||
type (
|
||||
// Committer is the interface that wraps the Committer method.
|
||||
// Committer is the interface that wraps the Commit method.
|
||||
Committer interface {
|
||||
Commit(context.Context, *Tx) error
|
||||
}
|
||||
@ -44,7 +44,7 @@ type (
|
||||
// and returns a Committer. For example:
|
||||
//
|
||||
// hook := func(next ent.Committer) ent.Committer {
|
||||
// return ent.CommitFunc(func(context.Context, tx *ent.Tx) error {
|
||||
// return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
|
||||
// // Do some stuff before.
|
||||
// if err := next.Commit(ctx, tx); err != nil {
|
||||
// return err
|
||||
@ -85,7 +85,7 @@ func (tx *Tx) OnCommit(f CommitHook) {
|
||||
}
|
||||
|
||||
type (
|
||||
// Rollbacker is the interface that wraps the Rollbacker method.
|
||||
// Rollbacker is the interface that wraps the Rollback method.
|
||||
Rollbacker interface {
|
||||
Rollback(context.Context, *Tx) error
|
||||
}
|
||||
@ -99,7 +99,7 @@ type (
|
||||
// and returns a Rollbacker. For example:
|
||||
//
|
||||
// hook := func(next ent.Rollbacker) ent.Rollbacker {
|
||||
// return ent.RollbackFunc(func(context.Context, tx *ent.Tx) error {
|
||||
// return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
|
||||
// // Do some stuff before.
|
||||
// if err := next.Rollback(ctx, tx); err != nil {
|
||||
// return err
|
||||
|
5
go.sum
5
go.sum
@ -372,6 +372,7 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
@ -393,6 +394,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
@ -441,9 +443,11 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO
|
||||
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
|
||||
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
||||
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0=
|
||||
github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@ -775,6 +779,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7 h1:M1gcVrIb2lSn2FIL19DG0+/b8nNVKJ7W7b4WcAGZAYM=
|
||||
golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
Loading…
Reference in New Issue
Block a user