forked from ALHP/ALHP.GO
Switched to parsing srcinfo with channels on all available cpus, speeding up srcinfo-parsing and queue generation by a lot. New memory-limit based building will max out the available memory while not building the same packages at the same time for different marchs, fixing some long-standing bugs like firefox not building at the same time because the same ports are used for profile-based optimization. This also drops the artificial delay on build-start, speeding up things even more. This also means there is no hard-coded limit on how many packages can be build at once anymore. As long as there is RAM available, builds will be started.
1414 lines
42 KiB
Go
1414 lines
42 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/dialect/sql/sqljson"
|
|
"entgo.io/ent/schema/field"
|
|
"somegit.dev/ALHP/ALHP.GO/ent/dbpackage"
|
|
"somegit.dev/ALHP/ALHP.GO/ent/predicate"
|
|
)
|
|
|
|
// DbPackageUpdate is the builder for updating DbPackage entities.
|
|
type DbPackageUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *DbPackageMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// Where appends a list predicates to the DbPackageUpdate builder.
|
|
func (dpu *DbPackageUpdate) Where(ps ...predicate.DbPackage) *DbPackageUpdate {
|
|
dpu.mutation.Where(ps...)
|
|
return dpu
|
|
}
|
|
|
|
// SetPackages sets the "packages" field.
|
|
func (dpu *DbPackageUpdate) SetPackages(s []string) *DbPackageUpdate {
|
|
dpu.mutation.SetPackages(s)
|
|
return dpu
|
|
}
|
|
|
|
// AppendPackages appends s to the "packages" field.
|
|
func (dpu *DbPackageUpdate) AppendPackages(s []string) *DbPackageUpdate {
|
|
dpu.mutation.AppendPackages(s)
|
|
return dpu
|
|
}
|
|
|
|
// ClearPackages clears the value of the "packages" field.
|
|
func (dpu *DbPackageUpdate) ClearPackages() *DbPackageUpdate {
|
|
dpu.mutation.ClearPackages()
|
|
return dpu
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (dpu *DbPackageUpdate) SetStatus(d dbpackage.Status) *DbPackageUpdate {
|
|
dpu.mutation.SetStatus(d)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableStatus(d *dbpackage.Status) *DbPackageUpdate {
|
|
if d != nil {
|
|
dpu.SetStatus(*d)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (dpu *DbPackageUpdate) ClearStatus() *DbPackageUpdate {
|
|
dpu.mutation.ClearStatus()
|
|
return dpu
|
|
}
|
|
|
|
// SetSkipReason sets the "skip_reason" field.
|
|
func (dpu *DbPackageUpdate) SetSkipReason(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetSkipReason(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableSkipReason sets the "skip_reason" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableSkipReason(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetSkipReason(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearSkipReason clears the value of the "skip_reason" field.
|
|
func (dpu *DbPackageUpdate) ClearSkipReason() *DbPackageUpdate {
|
|
dpu.mutation.ClearSkipReason()
|
|
return dpu
|
|
}
|
|
|
|
// SetRepository sets the "repository" field.
|
|
func (dpu *DbPackageUpdate) SetRepository(d dbpackage.Repository) *DbPackageUpdate {
|
|
dpu.mutation.SetRepository(d)
|
|
return dpu
|
|
}
|
|
|
|
// SetVersion sets the "version" field.
|
|
func (dpu *DbPackageUpdate) SetVersion(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetVersion(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableVersion sets the "version" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableVersion(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetVersion(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearVersion clears the value of the "version" field.
|
|
func (dpu *DbPackageUpdate) ClearVersion() *DbPackageUpdate {
|
|
dpu.mutation.ClearVersion()
|
|
return dpu
|
|
}
|
|
|
|
// SetRepoVersion sets the "repo_version" field.
|
|
func (dpu *DbPackageUpdate) SetRepoVersion(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetRepoVersion(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableRepoVersion sets the "repo_version" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableRepoVersion(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetRepoVersion(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearRepoVersion clears the value of the "repo_version" field.
|
|
func (dpu *DbPackageUpdate) ClearRepoVersion() *DbPackageUpdate {
|
|
dpu.mutation.ClearRepoVersion()
|
|
return dpu
|
|
}
|
|
|
|
// SetBuildTimeStart sets the "build_time_start" field.
|
|
func (dpu *DbPackageUpdate) SetBuildTimeStart(t time.Time) *DbPackageUpdate {
|
|
dpu.mutation.SetBuildTimeStart(t)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableBuildTimeStart sets the "build_time_start" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableBuildTimeStart(t *time.Time) *DbPackageUpdate {
|
|
if t != nil {
|
|
dpu.SetBuildTimeStart(*t)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
|
func (dpu *DbPackageUpdate) ClearBuildTimeStart() *DbPackageUpdate {
|
|
dpu.mutation.ClearBuildTimeStart()
|
|
return dpu
|
|
}
|
|
|
|
// SetUpdated sets the "updated" field.
|
|
func (dpu *DbPackageUpdate) SetUpdated(t time.Time) *DbPackageUpdate {
|
|
dpu.mutation.SetUpdated(t)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableUpdated sets the "updated" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableUpdated(t *time.Time) *DbPackageUpdate {
|
|
if t != nil {
|
|
dpu.SetUpdated(*t)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearUpdated clears the value of the "updated" field.
|
|
func (dpu *DbPackageUpdate) ClearUpdated() *DbPackageUpdate {
|
|
dpu.mutation.ClearUpdated()
|
|
return dpu
|
|
}
|
|
|
|
// SetHash sets the "hash" field.
|
|
func (dpu *DbPackageUpdate) SetHash(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetHash(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableHash sets the "hash" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableHash(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetHash(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearHash clears the value of the "hash" field.
|
|
func (dpu *DbPackageUpdate) ClearHash() *DbPackageUpdate {
|
|
dpu.mutation.ClearHash()
|
|
return dpu
|
|
}
|
|
|
|
// SetLto sets the "lto" field.
|
|
func (dpu *DbPackageUpdate) SetLto(d dbpackage.Lto) *DbPackageUpdate {
|
|
dpu.mutation.SetLto(d)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableLto sets the "lto" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableLto(d *dbpackage.Lto) *DbPackageUpdate {
|
|
if d != nil {
|
|
dpu.SetLto(*d)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearLto clears the value of the "lto" field.
|
|
func (dpu *DbPackageUpdate) ClearLto() *DbPackageUpdate {
|
|
dpu.mutation.ClearLto()
|
|
return dpu
|
|
}
|
|
|
|
// SetLastVersionBuild sets the "last_version_build" field.
|
|
func (dpu *DbPackageUpdate) SetLastVersionBuild(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetLastVersionBuild(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableLastVersionBuild sets the "last_version_build" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableLastVersionBuild(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetLastVersionBuild(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearLastVersionBuild clears the value of the "last_version_build" field.
|
|
func (dpu *DbPackageUpdate) ClearLastVersionBuild() *DbPackageUpdate {
|
|
dpu.mutation.ClearLastVersionBuild()
|
|
return dpu
|
|
}
|
|
|
|
// SetLastVerified sets the "last_verified" field.
|
|
func (dpu *DbPackageUpdate) SetLastVerified(t time.Time) *DbPackageUpdate {
|
|
dpu.mutation.SetLastVerified(t)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableLastVerified sets the "last_verified" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableLastVerified(t *time.Time) *DbPackageUpdate {
|
|
if t != nil {
|
|
dpu.SetLastVerified(*t)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearLastVerified clears the value of the "last_verified" field.
|
|
func (dpu *DbPackageUpdate) ClearLastVerified() *DbPackageUpdate {
|
|
dpu.mutation.ClearLastVerified()
|
|
return dpu
|
|
}
|
|
|
|
// SetDebugSymbols sets the "debug_symbols" field.
|
|
func (dpu *DbPackageUpdate) SetDebugSymbols(ds dbpackage.DebugSymbols) *DbPackageUpdate {
|
|
dpu.mutation.SetDebugSymbols(ds)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableDebugSymbols sets the "debug_symbols" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols) *DbPackageUpdate {
|
|
if ds != nil {
|
|
dpu.SetDebugSymbols(*ds)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearDebugSymbols clears the value of the "debug_symbols" field.
|
|
func (dpu *DbPackageUpdate) ClearDebugSymbols() *DbPackageUpdate {
|
|
dpu.mutation.ClearDebugSymbols()
|
|
return dpu
|
|
}
|
|
|
|
// SetMaxRss sets the "max_rss" field.
|
|
func (dpu *DbPackageUpdate) SetMaxRss(i int64) *DbPackageUpdate {
|
|
dpu.mutation.ResetMaxRss()
|
|
dpu.mutation.SetMaxRss(i)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableMaxRss sets the "max_rss" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableMaxRss(i *int64) *DbPackageUpdate {
|
|
if i != nil {
|
|
dpu.SetMaxRss(*i)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// AddMaxRss adds i to the "max_rss" field.
|
|
func (dpu *DbPackageUpdate) AddMaxRss(i int64) *DbPackageUpdate {
|
|
dpu.mutation.AddMaxRss(i)
|
|
return dpu
|
|
}
|
|
|
|
// ClearMaxRss clears the value of the "max_rss" field.
|
|
func (dpu *DbPackageUpdate) ClearMaxRss() *DbPackageUpdate {
|
|
dpu.mutation.ClearMaxRss()
|
|
return dpu
|
|
}
|
|
|
|
// SetUTime sets the "u_time" field.
|
|
func (dpu *DbPackageUpdate) SetUTime(i int64) *DbPackageUpdate {
|
|
dpu.mutation.ResetUTime()
|
|
dpu.mutation.SetUTime(i)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableUTime sets the "u_time" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableUTime(i *int64) *DbPackageUpdate {
|
|
if i != nil {
|
|
dpu.SetUTime(*i)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// AddUTime adds i to the "u_time" field.
|
|
func (dpu *DbPackageUpdate) AddUTime(i int64) *DbPackageUpdate {
|
|
dpu.mutation.AddUTime(i)
|
|
return dpu
|
|
}
|
|
|
|
// ClearUTime clears the value of the "u_time" field.
|
|
func (dpu *DbPackageUpdate) ClearUTime() *DbPackageUpdate {
|
|
dpu.mutation.ClearUTime()
|
|
return dpu
|
|
}
|
|
|
|
// SetSTime sets the "s_time" field.
|
|
func (dpu *DbPackageUpdate) SetSTime(i int64) *DbPackageUpdate {
|
|
dpu.mutation.ResetSTime()
|
|
dpu.mutation.SetSTime(i)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableSTime sets the "s_time" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableSTime(i *int64) *DbPackageUpdate {
|
|
if i != nil {
|
|
dpu.SetSTime(*i)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// AddSTime adds i to the "s_time" field.
|
|
func (dpu *DbPackageUpdate) AddSTime(i int64) *DbPackageUpdate {
|
|
dpu.mutation.AddSTime(i)
|
|
return dpu
|
|
}
|
|
|
|
// ClearSTime clears the value of the "s_time" field.
|
|
func (dpu *DbPackageUpdate) ClearSTime() *DbPackageUpdate {
|
|
dpu.mutation.ClearSTime()
|
|
return dpu
|
|
}
|
|
|
|
// SetIoIn sets the "io_in" field.
|
|
func (dpu *DbPackageUpdate) SetIoIn(i int64) *DbPackageUpdate {
|
|
dpu.mutation.ResetIoIn()
|
|
dpu.mutation.SetIoIn(i)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableIoIn sets the "io_in" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableIoIn(i *int64) *DbPackageUpdate {
|
|
if i != nil {
|
|
dpu.SetIoIn(*i)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// AddIoIn adds i to the "io_in" field.
|
|
func (dpu *DbPackageUpdate) AddIoIn(i int64) *DbPackageUpdate {
|
|
dpu.mutation.AddIoIn(i)
|
|
return dpu
|
|
}
|
|
|
|
// ClearIoIn clears the value of the "io_in" field.
|
|
func (dpu *DbPackageUpdate) ClearIoIn() *DbPackageUpdate {
|
|
dpu.mutation.ClearIoIn()
|
|
return dpu
|
|
}
|
|
|
|
// SetIoOut sets the "io_out" field.
|
|
func (dpu *DbPackageUpdate) SetIoOut(i int64) *DbPackageUpdate {
|
|
dpu.mutation.ResetIoOut()
|
|
dpu.mutation.SetIoOut(i)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableIoOut sets the "io_out" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableIoOut(i *int64) *DbPackageUpdate {
|
|
if i != nil {
|
|
dpu.SetIoOut(*i)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// AddIoOut adds i to the "io_out" field.
|
|
func (dpu *DbPackageUpdate) AddIoOut(i int64) *DbPackageUpdate {
|
|
dpu.mutation.AddIoOut(i)
|
|
return dpu
|
|
}
|
|
|
|
// ClearIoOut clears the value of the "io_out" field.
|
|
func (dpu *DbPackageUpdate) ClearIoOut() *DbPackageUpdate {
|
|
dpu.mutation.ClearIoOut()
|
|
return dpu
|
|
}
|
|
|
|
// SetSrcinfo sets the "srcinfo" field.
|
|
func (dpu *DbPackageUpdate) SetSrcinfo(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetSrcinfo(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableSrcinfo sets the "srcinfo" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableSrcinfo(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetSrcinfo(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearSrcinfo clears the value of the "srcinfo" field.
|
|
func (dpu *DbPackageUpdate) ClearSrcinfo() *DbPackageUpdate {
|
|
dpu.mutation.ClearSrcinfo()
|
|
return dpu
|
|
}
|
|
|
|
// SetSrcinfoHash sets the "srcinfo_hash" field.
|
|
func (dpu *DbPackageUpdate) SetSrcinfoHash(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetSrcinfoHash(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillableSrcinfoHash sets the "srcinfo_hash" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillableSrcinfoHash(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetSrcinfoHash(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearSrcinfoHash clears the value of the "srcinfo_hash" field.
|
|
func (dpu *DbPackageUpdate) ClearSrcinfoHash() *DbPackageUpdate {
|
|
dpu.mutation.ClearSrcinfoHash()
|
|
return dpu
|
|
}
|
|
|
|
// SetPkgbuild sets the "pkgbuild" field.
|
|
func (dpu *DbPackageUpdate) SetPkgbuild(s string) *DbPackageUpdate {
|
|
dpu.mutation.SetPkgbuild(s)
|
|
return dpu
|
|
}
|
|
|
|
// SetNillablePkgbuild sets the "pkgbuild" field if the given value is not nil.
|
|
func (dpu *DbPackageUpdate) SetNillablePkgbuild(s *string) *DbPackageUpdate {
|
|
if s != nil {
|
|
dpu.SetPkgbuild(*s)
|
|
}
|
|
return dpu
|
|
}
|
|
|
|
// ClearPkgbuild clears the value of the "pkgbuild" field.
|
|
func (dpu *DbPackageUpdate) ClearPkgbuild() *DbPackageUpdate {
|
|
dpu.mutation.ClearPkgbuild()
|
|
return dpu
|
|
}
|
|
|
|
// Mutation returns the DbPackageMutation object of the builder.
|
|
func (dpu *DbPackageUpdate) Mutation() *DbPackageMutation {
|
|
return dpu.mutation
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (dpu *DbPackageUpdate) Save(ctx context.Context) (int, error) {
|
|
return withHooks[int, DbPackageMutation](ctx, dpu.sqlSave, dpu.mutation, dpu.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (dpu *DbPackageUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := dpu.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (dpu *DbPackageUpdate) Exec(ctx context.Context) error {
|
|
_, err := dpu.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (dpu *DbPackageUpdate) ExecX(ctx context.Context) {
|
|
if err := dpu.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
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 "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 "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 "DbPackage.lto": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := dpu.mutation.DebugSymbols(); ok {
|
|
if err := dbpackage.DebugSymbolsValidator(v); err != nil {
|
|
return &ValidationError{Name: "debug_symbols", err: fmt.Errorf(`ent: validator failed for field "DbPackage.debug_symbols": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (dpu *DbPackageUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *DbPackageUpdate {
|
|
dpu.modifiers = append(dpu.modifiers, modifiers...)
|
|
return dpu
|
|
}
|
|
|
|
func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|
if err := dpu.check(); err != nil {
|
|
return n, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(dbpackage.Table, dbpackage.Columns, sqlgraph.NewFieldSpec(dbpackage.FieldID, field.TypeInt))
|
|
if ps := dpu.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := dpu.mutation.Packages(); ok {
|
|
_spec.SetField(dbpackage.FieldPackages, field.TypeJSON, value)
|
|
}
|
|
if value, ok := dpu.mutation.AppendedPackages(); ok {
|
|
_spec.AddModifier(func(u *sql.UpdateBuilder) {
|
|
sqljson.Append(u, dbpackage.FieldPackages, value)
|
|
})
|
|
}
|
|
if dpu.mutation.PackagesCleared() {
|
|
_spec.ClearField(dbpackage.FieldPackages, field.TypeJSON)
|
|
}
|
|
if value, ok := dpu.mutation.Status(); ok {
|
|
_spec.SetField(dbpackage.FieldStatus, field.TypeEnum, value)
|
|
}
|
|
if dpu.mutation.StatusCleared() {
|
|
_spec.ClearField(dbpackage.FieldStatus, field.TypeEnum)
|
|
}
|
|
if value, ok := dpu.mutation.SkipReason(); ok {
|
|
_spec.SetField(dbpackage.FieldSkipReason, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.SkipReasonCleared() {
|
|
_spec.ClearField(dbpackage.FieldSkipReason, field.TypeString)
|
|
}
|
|
if value, ok := dpu.mutation.Repository(); ok {
|
|
_spec.SetField(dbpackage.FieldRepository, field.TypeEnum, value)
|
|
}
|
|
if value, ok := dpu.mutation.Version(); ok {
|
|
_spec.SetField(dbpackage.FieldVersion, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.VersionCleared() {
|
|
_spec.ClearField(dbpackage.FieldVersion, field.TypeString)
|
|
}
|
|
if value, ok := dpu.mutation.RepoVersion(); ok {
|
|
_spec.SetField(dbpackage.FieldRepoVersion, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.RepoVersionCleared() {
|
|
_spec.ClearField(dbpackage.FieldRepoVersion, field.TypeString)
|
|
}
|
|
if value, ok := dpu.mutation.BuildTimeStart(); ok {
|
|
_spec.SetField(dbpackage.FieldBuildTimeStart, field.TypeTime, value)
|
|
}
|
|
if dpu.mutation.BuildTimeStartCleared() {
|
|
_spec.ClearField(dbpackage.FieldBuildTimeStart, field.TypeTime)
|
|
}
|
|
if value, ok := dpu.mutation.Updated(); ok {
|
|
_spec.SetField(dbpackage.FieldUpdated, field.TypeTime, value)
|
|
}
|
|
if dpu.mutation.UpdatedCleared() {
|
|
_spec.ClearField(dbpackage.FieldUpdated, field.TypeTime)
|
|
}
|
|
if value, ok := dpu.mutation.Hash(); ok {
|
|
_spec.SetField(dbpackage.FieldHash, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.HashCleared() {
|
|
_spec.ClearField(dbpackage.FieldHash, field.TypeString)
|
|
}
|
|
if value, ok := dpu.mutation.Lto(); ok {
|
|
_spec.SetField(dbpackage.FieldLto, field.TypeEnum, value)
|
|
}
|
|
if dpu.mutation.LtoCleared() {
|
|
_spec.ClearField(dbpackage.FieldLto, field.TypeEnum)
|
|
}
|
|
if value, ok := dpu.mutation.LastVersionBuild(); ok {
|
|
_spec.SetField(dbpackage.FieldLastVersionBuild, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.LastVersionBuildCleared() {
|
|
_spec.ClearField(dbpackage.FieldLastVersionBuild, field.TypeString)
|
|
}
|
|
if value, ok := dpu.mutation.LastVerified(); ok {
|
|
_spec.SetField(dbpackage.FieldLastVerified, field.TypeTime, value)
|
|
}
|
|
if dpu.mutation.LastVerifiedCleared() {
|
|
_spec.ClearField(dbpackage.FieldLastVerified, field.TypeTime)
|
|
}
|
|
if value, ok := dpu.mutation.DebugSymbols(); ok {
|
|
_spec.SetField(dbpackage.FieldDebugSymbols, field.TypeEnum, value)
|
|
}
|
|
if dpu.mutation.DebugSymbolsCleared() {
|
|
_spec.ClearField(dbpackage.FieldDebugSymbols, field.TypeEnum)
|
|
}
|
|
if value, ok := dpu.mutation.MaxRss(); ok {
|
|
_spec.SetField(dbpackage.FieldMaxRss, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpu.mutation.AddedMaxRss(); ok {
|
|
_spec.AddField(dbpackage.FieldMaxRss, field.TypeInt64, value)
|
|
}
|
|
if dpu.mutation.MaxRssCleared() {
|
|
_spec.ClearField(dbpackage.FieldMaxRss, field.TypeInt64)
|
|
}
|
|
if value, ok := dpu.mutation.UTime(); ok {
|
|
_spec.SetField(dbpackage.FieldUTime, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpu.mutation.AddedUTime(); ok {
|
|
_spec.AddField(dbpackage.FieldUTime, field.TypeInt64, value)
|
|
}
|
|
if dpu.mutation.UTimeCleared() {
|
|
_spec.ClearField(dbpackage.FieldUTime, field.TypeInt64)
|
|
}
|
|
if value, ok := dpu.mutation.STime(); ok {
|
|
_spec.SetField(dbpackage.FieldSTime, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpu.mutation.AddedSTime(); ok {
|
|
_spec.AddField(dbpackage.FieldSTime, field.TypeInt64, value)
|
|
}
|
|
if dpu.mutation.STimeCleared() {
|
|
_spec.ClearField(dbpackage.FieldSTime, field.TypeInt64)
|
|
}
|
|
if value, ok := dpu.mutation.IoIn(); ok {
|
|
_spec.SetField(dbpackage.FieldIoIn, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpu.mutation.AddedIoIn(); ok {
|
|
_spec.AddField(dbpackage.FieldIoIn, field.TypeInt64, value)
|
|
}
|
|
if dpu.mutation.IoInCleared() {
|
|
_spec.ClearField(dbpackage.FieldIoIn, field.TypeInt64)
|
|
}
|
|
if value, ok := dpu.mutation.IoOut(); ok {
|
|
_spec.SetField(dbpackage.FieldIoOut, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpu.mutation.AddedIoOut(); ok {
|
|
_spec.AddField(dbpackage.FieldIoOut, field.TypeInt64, value)
|
|
}
|
|
if dpu.mutation.IoOutCleared() {
|
|
_spec.ClearField(dbpackage.FieldIoOut, field.TypeInt64)
|
|
}
|
|
if value, ok := dpu.mutation.Srcinfo(); ok {
|
|
_spec.SetField(dbpackage.FieldSrcinfo, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.SrcinfoCleared() {
|
|
_spec.ClearField(dbpackage.FieldSrcinfo, field.TypeString)
|
|
}
|
|
if value, ok := dpu.mutation.SrcinfoHash(); ok {
|
|
_spec.SetField(dbpackage.FieldSrcinfoHash, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.SrcinfoHashCleared() {
|
|
_spec.ClearField(dbpackage.FieldSrcinfoHash, field.TypeString)
|
|
}
|
|
if value, ok := dpu.mutation.Pkgbuild(); ok {
|
|
_spec.SetField(dbpackage.FieldPkgbuild, field.TypeString, value)
|
|
}
|
|
if dpu.mutation.PkgbuildCleared() {
|
|
_spec.ClearField(dbpackage.FieldPkgbuild, field.TypeString)
|
|
}
|
|
_spec.AddModifiers(dpu.modifiers...)
|
|
if n, err = sqlgraph.UpdateNodes(ctx, dpu.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{dbpackage.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
dpu.mutation.done = true
|
|
return n, nil
|
|
}
|
|
|
|
// DbPackageUpdateOne is the builder for updating a single DbPackage entity.
|
|
type DbPackageUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *DbPackageMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// SetPackages sets the "packages" field.
|
|
func (dpuo *DbPackageUpdateOne) SetPackages(s []string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetPackages(s)
|
|
return dpuo
|
|
}
|
|
|
|
// AppendPackages appends s to the "packages" field.
|
|
func (dpuo *DbPackageUpdateOne) AppendPackages(s []string) *DbPackageUpdateOne {
|
|
dpuo.mutation.AppendPackages(s)
|
|
return dpuo
|
|
}
|
|
|
|
// ClearPackages clears the value of the "packages" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearPackages() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearPackages()
|
|
return dpuo
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (dpuo *DbPackageUpdateOne) SetStatus(d dbpackage.Status) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetStatus(d)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableStatus(d *dbpackage.Status) *DbPackageUpdateOne {
|
|
if d != nil {
|
|
dpuo.SetStatus(*d)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearStatus() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearStatus()
|
|
return dpuo
|
|
}
|
|
|
|
// SetSkipReason sets the "skip_reason" field.
|
|
func (dpuo *DbPackageUpdateOne) SetSkipReason(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetSkipReason(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableSkipReason sets the "skip_reason" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableSkipReason(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetSkipReason(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearSkipReason clears the value of the "skip_reason" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearSkipReason() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearSkipReason()
|
|
return dpuo
|
|
}
|
|
|
|
// SetRepository sets the "repository" field.
|
|
func (dpuo *DbPackageUpdateOne) SetRepository(d dbpackage.Repository) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetRepository(d)
|
|
return dpuo
|
|
}
|
|
|
|
// SetVersion sets the "version" field.
|
|
func (dpuo *DbPackageUpdateOne) SetVersion(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetVersion(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableVersion sets the "version" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableVersion(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetVersion(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearVersion clears the value of the "version" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearVersion() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearVersion()
|
|
return dpuo
|
|
}
|
|
|
|
// SetRepoVersion sets the "repo_version" field.
|
|
func (dpuo *DbPackageUpdateOne) SetRepoVersion(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetRepoVersion(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableRepoVersion sets the "repo_version" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableRepoVersion(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetRepoVersion(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearRepoVersion clears the value of the "repo_version" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearRepoVersion() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearRepoVersion()
|
|
return dpuo
|
|
}
|
|
|
|
// SetBuildTimeStart sets the "build_time_start" field.
|
|
func (dpuo *DbPackageUpdateOne) SetBuildTimeStart(t time.Time) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetBuildTimeStart(t)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableBuildTimeStart sets the "build_time_start" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableBuildTimeStart(t *time.Time) *DbPackageUpdateOne {
|
|
if t != nil {
|
|
dpuo.SetBuildTimeStart(*t)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearBuildTimeStart() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearBuildTimeStart()
|
|
return dpuo
|
|
}
|
|
|
|
// SetUpdated sets the "updated" field.
|
|
func (dpuo *DbPackageUpdateOne) SetUpdated(t time.Time) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetUpdated(t)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableUpdated sets the "updated" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableUpdated(t *time.Time) *DbPackageUpdateOne {
|
|
if t != nil {
|
|
dpuo.SetUpdated(*t)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearUpdated clears the value of the "updated" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearUpdated() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearUpdated()
|
|
return dpuo
|
|
}
|
|
|
|
// SetHash sets the "hash" field.
|
|
func (dpuo *DbPackageUpdateOne) SetHash(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetHash(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableHash sets the "hash" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableHash(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetHash(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearHash clears the value of the "hash" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearHash() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearHash()
|
|
return dpuo
|
|
}
|
|
|
|
// SetLto sets the "lto" field.
|
|
func (dpuo *DbPackageUpdateOne) SetLto(d dbpackage.Lto) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetLto(d)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableLto sets the "lto" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableLto(d *dbpackage.Lto) *DbPackageUpdateOne {
|
|
if d != nil {
|
|
dpuo.SetLto(*d)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearLto clears the value of the "lto" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearLto() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearLto()
|
|
return dpuo
|
|
}
|
|
|
|
// SetLastVersionBuild sets the "last_version_build" field.
|
|
func (dpuo *DbPackageUpdateOne) SetLastVersionBuild(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetLastVersionBuild(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableLastVersionBuild sets the "last_version_build" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableLastVersionBuild(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetLastVersionBuild(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearLastVersionBuild clears the value of the "last_version_build" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearLastVersionBuild() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearLastVersionBuild()
|
|
return dpuo
|
|
}
|
|
|
|
// SetLastVerified sets the "last_verified" field.
|
|
func (dpuo *DbPackageUpdateOne) SetLastVerified(t time.Time) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetLastVerified(t)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableLastVerified sets the "last_verified" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableLastVerified(t *time.Time) *DbPackageUpdateOne {
|
|
if t != nil {
|
|
dpuo.SetLastVerified(*t)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearLastVerified clears the value of the "last_verified" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearLastVerified() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearLastVerified()
|
|
return dpuo
|
|
}
|
|
|
|
// SetDebugSymbols sets the "debug_symbols" field.
|
|
func (dpuo *DbPackageUpdateOne) SetDebugSymbols(ds dbpackage.DebugSymbols) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetDebugSymbols(ds)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableDebugSymbols sets the "debug_symbols" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols) *DbPackageUpdateOne {
|
|
if ds != nil {
|
|
dpuo.SetDebugSymbols(*ds)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearDebugSymbols clears the value of the "debug_symbols" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearDebugSymbols() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearDebugSymbols()
|
|
return dpuo
|
|
}
|
|
|
|
// SetMaxRss sets the "max_rss" field.
|
|
func (dpuo *DbPackageUpdateOne) SetMaxRss(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.ResetMaxRss()
|
|
dpuo.mutation.SetMaxRss(i)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableMaxRss sets the "max_rss" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableMaxRss(i *int64) *DbPackageUpdateOne {
|
|
if i != nil {
|
|
dpuo.SetMaxRss(*i)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// AddMaxRss adds i to the "max_rss" field.
|
|
func (dpuo *DbPackageUpdateOne) AddMaxRss(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.AddMaxRss(i)
|
|
return dpuo
|
|
}
|
|
|
|
// ClearMaxRss clears the value of the "max_rss" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearMaxRss() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearMaxRss()
|
|
return dpuo
|
|
}
|
|
|
|
// SetUTime sets the "u_time" field.
|
|
func (dpuo *DbPackageUpdateOne) SetUTime(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.ResetUTime()
|
|
dpuo.mutation.SetUTime(i)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableUTime sets the "u_time" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableUTime(i *int64) *DbPackageUpdateOne {
|
|
if i != nil {
|
|
dpuo.SetUTime(*i)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// AddUTime adds i to the "u_time" field.
|
|
func (dpuo *DbPackageUpdateOne) AddUTime(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.AddUTime(i)
|
|
return dpuo
|
|
}
|
|
|
|
// ClearUTime clears the value of the "u_time" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearUTime() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearUTime()
|
|
return dpuo
|
|
}
|
|
|
|
// SetSTime sets the "s_time" field.
|
|
func (dpuo *DbPackageUpdateOne) SetSTime(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.ResetSTime()
|
|
dpuo.mutation.SetSTime(i)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableSTime sets the "s_time" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableSTime(i *int64) *DbPackageUpdateOne {
|
|
if i != nil {
|
|
dpuo.SetSTime(*i)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// AddSTime adds i to the "s_time" field.
|
|
func (dpuo *DbPackageUpdateOne) AddSTime(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.AddSTime(i)
|
|
return dpuo
|
|
}
|
|
|
|
// ClearSTime clears the value of the "s_time" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearSTime() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearSTime()
|
|
return dpuo
|
|
}
|
|
|
|
// SetIoIn sets the "io_in" field.
|
|
func (dpuo *DbPackageUpdateOne) SetIoIn(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.ResetIoIn()
|
|
dpuo.mutation.SetIoIn(i)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableIoIn sets the "io_in" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableIoIn(i *int64) *DbPackageUpdateOne {
|
|
if i != nil {
|
|
dpuo.SetIoIn(*i)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// AddIoIn adds i to the "io_in" field.
|
|
func (dpuo *DbPackageUpdateOne) AddIoIn(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.AddIoIn(i)
|
|
return dpuo
|
|
}
|
|
|
|
// ClearIoIn clears the value of the "io_in" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearIoIn() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearIoIn()
|
|
return dpuo
|
|
}
|
|
|
|
// SetIoOut sets the "io_out" field.
|
|
func (dpuo *DbPackageUpdateOne) SetIoOut(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.ResetIoOut()
|
|
dpuo.mutation.SetIoOut(i)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableIoOut sets the "io_out" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableIoOut(i *int64) *DbPackageUpdateOne {
|
|
if i != nil {
|
|
dpuo.SetIoOut(*i)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// AddIoOut adds i to the "io_out" field.
|
|
func (dpuo *DbPackageUpdateOne) AddIoOut(i int64) *DbPackageUpdateOne {
|
|
dpuo.mutation.AddIoOut(i)
|
|
return dpuo
|
|
}
|
|
|
|
// ClearIoOut clears the value of the "io_out" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearIoOut() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearIoOut()
|
|
return dpuo
|
|
}
|
|
|
|
// SetSrcinfo sets the "srcinfo" field.
|
|
func (dpuo *DbPackageUpdateOne) SetSrcinfo(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetSrcinfo(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableSrcinfo sets the "srcinfo" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableSrcinfo(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetSrcinfo(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearSrcinfo clears the value of the "srcinfo" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearSrcinfo() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearSrcinfo()
|
|
return dpuo
|
|
}
|
|
|
|
// SetSrcinfoHash sets the "srcinfo_hash" field.
|
|
func (dpuo *DbPackageUpdateOne) SetSrcinfoHash(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetSrcinfoHash(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillableSrcinfoHash sets the "srcinfo_hash" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillableSrcinfoHash(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetSrcinfoHash(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearSrcinfoHash clears the value of the "srcinfo_hash" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearSrcinfoHash() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearSrcinfoHash()
|
|
return dpuo
|
|
}
|
|
|
|
// SetPkgbuild sets the "pkgbuild" field.
|
|
func (dpuo *DbPackageUpdateOne) SetPkgbuild(s string) *DbPackageUpdateOne {
|
|
dpuo.mutation.SetPkgbuild(s)
|
|
return dpuo
|
|
}
|
|
|
|
// SetNillablePkgbuild sets the "pkgbuild" field if the given value is not nil.
|
|
func (dpuo *DbPackageUpdateOne) SetNillablePkgbuild(s *string) *DbPackageUpdateOne {
|
|
if s != nil {
|
|
dpuo.SetPkgbuild(*s)
|
|
}
|
|
return dpuo
|
|
}
|
|
|
|
// ClearPkgbuild clears the value of the "pkgbuild" field.
|
|
func (dpuo *DbPackageUpdateOne) ClearPkgbuild() *DbPackageUpdateOne {
|
|
dpuo.mutation.ClearPkgbuild()
|
|
return dpuo
|
|
}
|
|
|
|
// Mutation returns the DbPackageMutation object of the builder.
|
|
func (dpuo *DbPackageUpdateOne) Mutation() *DbPackageMutation {
|
|
return dpuo.mutation
|
|
}
|
|
|
|
// Where appends a list predicates to the DbPackageUpdate builder.
|
|
func (dpuo *DbPackageUpdateOne) Where(ps ...predicate.DbPackage) *DbPackageUpdateOne {
|
|
dpuo.mutation.Where(ps...)
|
|
return dpuo
|
|
}
|
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
// The default is selecting all fields defined in the entity schema.
|
|
func (dpuo *DbPackageUpdateOne) Select(field string, fields ...string) *DbPackageUpdateOne {
|
|
dpuo.fields = append([]string{field}, fields...)
|
|
return dpuo
|
|
}
|
|
|
|
// Save executes the query and returns the updated DbPackage entity.
|
|
func (dpuo *DbPackageUpdateOne) Save(ctx context.Context) (*DbPackage, error) {
|
|
return withHooks[*DbPackage, DbPackageMutation](ctx, dpuo.sqlSave, dpuo.mutation, dpuo.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (dpuo *DbPackageUpdateOne) SaveX(ctx context.Context) *DbPackage {
|
|
node, err := dpuo.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (dpuo *DbPackageUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := dpuo.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (dpuo *DbPackageUpdateOne) ExecX(ctx context.Context) {
|
|
if err := dpuo.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
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 "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 "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 "DbPackage.lto": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := dpuo.mutation.DebugSymbols(); ok {
|
|
if err := dbpackage.DebugSymbolsValidator(v); err != nil {
|
|
return &ValidationError{Name: "debug_symbols", err: fmt.Errorf(`ent: validator failed for field "DbPackage.debug_symbols": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (dpuo *DbPackageUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *DbPackageUpdateOne {
|
|
dpuo.modifiers = append(dpuo.modifiers, modifiers...)
|
|
return dpuo
|
|
}
|
|
|
|
func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage, err error) {
|
|
if err := dpuo.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(dbpackage.Table, dbpackage.Columns, sqlgraph.NewFieldSpec(dbpackage.FieldID, field.TypeInt))
|
|
id, ok := dpuo.mutation.ID()
|
|
if !ok {
|
|
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 {
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
_spec.Node.Columns = append(_spec.Node.Columns, dbpackage.FieldID)
|
|
for _, f := range fields {
|
|
if !dbpackage.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != dbpackage.FieldID {
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
}
|
|
}
|
|
}
|
|
if ps := dpuo.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := dpuo.mutation.Packages(); ok {
|
|
_spec.SetField(dbpackage.FieldPackages, field.TypeJSON, value)
|
|
}
|
|
if value, ok := dpuo.mutation.AppendedPackages(); ok {
|
|
_spec.AddModifier(func(u *sql.UpdateBuilder) {
|
|
sqljson.Append(u, dbpackage.FieldPackages, value)
|
|
})
|
|
}
|
|
if dpuo.mutation.PackagesCleared() {
|
|
_spec.ClearField(dbpackage.FieldPackages, field.TypeJSON)
|
|
}
|
|
if value, ok := dpuo.mutation.Status(); ok {
|
|
_spec.SetField(dbpackage.FieldStatus, field.TypeEnum, value)
|
|
}
|
|
if dpuo.mutation.StatusCleared() {
|
|
_spec.ClearField(dbpackage.FieldStatus, field.TypeEnum)
|
|
}
|
|
if value, ok := dpuo.mutation.SkipReason(); ok {
|
|
_spec.SetField(dbpackage.FieldSkipReason, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.SkipReasonCleared() {
|
|
_spec.ClearField(dbpackage.FieldSkipReason, field.TypeString)
|
|
}
|
|
if value, ok := dpuo.mutation.Repository(); ok {
|
|
_spec.SetField(dbpackage.FieldRepository, field.TypeEnum, value)
|
|
}
|
|
if value, ok := dpuo.mutation.Version(); ok {
|
|
_spec.SetField(dbpackage.FieldVersion, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.VersionCleared() {
|
|
_spec.ClearField(dbpackage.FieldVersion, field.TypeString)
|
|
}
|
|
if value, ok := dpuo.mutation.RepoVersion(); ok {
|
|
_spec.SetField(dbpackage.FieldRepoVersion, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.RepoVersionCleared() {
|
|
_spec.ClearField(dbpackage.FieldRepoVersion, field.TypeString)
|
|
}
|
|
if value, ok := dpuo.mutation.BuildTimeStart(); ok {
|
|
_spec.SetField(dbpackage.FieldBuildTimeStart, field.TypeTime, value)
|
|
}
|
|
if dpuo.mutation.BuildTimeStartCleared() {
|
|
_spec.ClearField(dbpackage.FieldBuildTimeStart, field.TypeTime)
|
|
}
|
|
if value, ok := dpuo.mutation.Updated(); ok {
|
|
_spec.SetField(dbpackage.FieldUpdated, field.TypeTime, value)
|
|
}
|
|
if dpuo.mutation.UpdatedCleared() {
|
|
_spec.ClearField(dbpackage.FieldUpdated, field.TypeTime)
|
|
}
|
|
if value, ok := dpuo.mutation.Hash(); ok {
|
|
_spec.SetField(dbpackage.FieldHash, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.HashCleared() {
|
|
_spec.ClearField(dbpackage.FieldHash, field.TypeString)
|
|
}
|
|
if value, ok := dpuo.mutation.Lto(); ok {
|
|
_spec.SetField(dbpackage.FieldLto, field.TypeEnum, value)
|
|
}
|
|
if dpuo.mutation.LtoCleared() {
|
|
_spec.ClearField(dbpackage.FieldLto, field.TypeEnum)
|
|
}
|
|
if value, ok := dpuo.mutation.LastVersionBuild(); ok {
|
|
_spec.SetField(dbpackage.FieldLastVersionBuild, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.LastVersionBuildCleared() {
|
|
_spec.ClearField(dbpackage.FieldLastVersionBuild, field.TypeString)
|
|
}
|
|
if value, ok := dpuo.mutation.LastVerified(); ok {
|
|
_spec.SetField(dbpackage.FieldLastVerified, field.TypeTime, value)
|
|
}
|
|
if dpuo.mutation.LastVerifiedCleared() {
|
|
_spec.ClearField(dbpackage.FieldLastVerified, field.TypeTime)
|
|
}
|
|
if value, ok := dpuo.mutation.DebugSymbols(); ok {
|
|
_spec.SetField(dbpackage.FieldDebugSymbols, field.TypeEnum, value)
|
|
}
|
|
if dpuo.mutation.DebugSymbolsCleared() {
|
|
_spec.ClearField(dbpackage.FieldDebugSymbols, field.TypeEnum)
|
|
}
|
|
if value, ok := dpuo.mutation.MaxRss(); ok {
|
|
_spec.SetField(dbpackage.FieldMaxRss, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpuo.mutation.AddedMaxRss(); ok {
|
|
_spec.AddField(dbpackage.FieldMaxRss, field.TypeInt64, value)
|
|
}
|
|
if dpuo.mutation.MaxRssCleared() {
|
|
_spec.ClearField(dbpackage.FieldMaxRss, field.TypeInt64)
|
|
}
|
|
if value, ok := dpuo.mutation.UTime(); ok {
|
|
_spec.SetField(dbpackage.FieldUTime, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpuo.mutation.AddedUTime(); ok {
|
|
_spec.AddField(dbpackage.FieldUTime, field.TypeInt64, value)
|
|
}
|
|
if dpuo.mutation.UTimeCleared() {
|
|
_spec.ClearField(dbpackage.FieldUTime, field.TypeInt64)
|
|
}
|
|
if value, ok := dpuo.mutation.STime(); ok {
|
|
_spec.SetField(dbpackage.FieldSTime, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpuo.mutation.AddedSTime(); ok {
|
|
_spec.AddField(dbpackage.FieldSTime, field.TypeInt64, value)
|
|
}
|
|
if dpuo.mutation.STimeCleared() {
|
|
_spec.ClearField(dbpackage.FieldSTime, field.TypeInt64)
|
|
}
|
|
if value, ok := dpuo.mutation.IoIn(); ok {
|
|
_spec.SetField(dbpackage.FieldIoIn, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpuo.mutation.AddedIoIn(); ok {
|
|
_spec.AddField(dbpackage.FieldIoIn, field.TypeInt64, value)
|
|
}
|
|
if dpuo.mutation.IoInCleared() {
|
|
_spec.ClearField(dbpackage.FieldIoIn, field.TypeInt64)
|
|
}
|
|
if value, ok := dpuo.mutation.IoOut(); ok {
|
|
_spec.SetField(dbpackage.FieldIoOut, field.TypeInt64, value)
|
|
}
|
|
if value, ok := dpuo.mutation.AddedIoOut(); ok {
|
|
_spec.AddField(dbpackage.FieldIoOut, field.TypeInt64, value)
|
|
}
|
|
if dpuo.mutation.IoOutCleared() {
|
|
_spec.ClearField(dbpackage.FieldIoOut, field.TypeInt64)
|
|
}
|
|
if value, ok := dpuo.mutation.Srcinfo(); ok {
|
|
_spec.SetField(dbpackage.FieldSrcinfo, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.SrcinfoCleared() {
|
|
_spec.ClearField(dbpackage.FieldSrcinfo, field.TypeString)
|
|
}
|
|
if value, ok := dpuo.mutation.SrcinfoHash(); ok {
|
|
_spec.SetField(dbpackage.FieldSrcinfoHash, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.SrcinfoHashCleared() {
|
|
_spec.ClearField(dbpackage.FieldSrcinfoHash, field.TypeString)
|
|
}
|
|
if value, ok := dpuo.mutation.Pkgbuild(); ok {
|
|
_spec.SetField(dbpackage.FieldPkgbuild, field.TypeString, value)
|
|
}
|
|
if dpuo.mutation.PkgbuildCleared() {
|
|
_spec.ClearField(dbpackage.FieldPkgbuild, field.TypeString)
|
|
}
|
|
_spec.AddModifiers(dpuo.modifiers...)
|
|
_node = &DbPackage{config: dpuo.config}
|
|
_spec.Assign = _node.assignValues
|
|
_spec.ScanValues = _node.scanValues
|
|
if err = sqlgraph.UpdateNode(ctx, dpuo.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{dbpackage.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
dpuo.mutation.done = true
|
|
return _node, nil
|
|
}
|