changes to db schema; more housekeeping work
This commit is contained in:
parent
6e0fec9cac
commit
22d265e7f1
@ -22,21 +22,21 @@ type DbPackage struct {
|
||||
// Packages holds the value of the "packages" field.
|
||||
Packages []string `json:"packages,omitempty"`
|
||||
// Status holds the value of the "status" field.
|
||||
Status int `json:"status,omitempty"`
|
||||
Status dbpackage.Status `json:"status,omitempty"`
|
||||
// SkipReason holds the value of the "skip_reason" field.
|
||||
SkipReason string `json:"skip_reason,omitempty"`
|
||||
// Repository holds the value of the "repository" field.
|
||||
Repository string `json:"repository,omitempty"`
|
||||
Repository dbpackage.Repository `json:"repository,omitempty"`
|
||||
// March holds the value of the "march" field.
|
||||
March string `json:"march,omitempty"`
|
||||
// Version holds the value of the "version" field.
|
||||
Version string `json:"version,omitempty"`
|
||||
// RepoVersion holds the value of the "repo_version" field.
|
||||
RepoVersion string `json:"repo_version,omitempty"`
|
||||
// BuildTime holds the value of the "build_time" field.
|
||||
BuildTime time.Time `json:"build_time,omitempty"`
|
||||
// BuildDuration holds the value of the "build_duration" field.
|
||||
BuildDuration uint64 `json:"build_duration,omitempty"`
|
||||
// BuildTimeStart holds the value of the "build_time_start" field.
|
||||
BuildTimeStart time.Time `json:"build_time_start,omitempty"`
|
||||
// BuildTimeEnd holds the value of the "build_time_end" field.
|
||||
BuildTimeEnd time.Time `json:"build_time_end,omitempty"`
|
||||
// Updated holds the value of the "updated" field.
|
||||
Updated time.Time `json:"updated,omitempty"`
|
||||
// Hash holds the value of the "hash" field.
|
||||
@ -50,11 +50,11 @@ func (*DbPackage) scanValues(columns []string) ([]interface{}, error) {
|
||||
switch columns[i] {
|
||||
case dbpackage.FieldPackages:
|
||||
values[i] = new([]byte)
|
||||
case dbpackage.FieldID, dbpackage.FieldStatus, dbpackage.FieldBuildDuration:
|
||||
case dbpackage.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case dbpackage.FieldPkgbase, dbpackage.FieldSkipReason, dbpackage.FieldRepository, dbpackage.FieldMarch, dbpackage.FieldVersion, dbpackage.FieldRepoVersion, dbpackage.FieldHash:
|
||||
case dbpackage.FieldPkgbase, dbpackage.FieldStatus, dbpackage.FieldSkipReason, dbpackage.FieldRepository, dbpackage.FieldMarch, dbpackage.FieldVersion, dbpackage.FieldRepoVersion, dbpackage.FieldHash:
|
||||
values[i] = new(sql.NullString)
|
||||
case dbpackage.FieldBuildTime, dbpackage.FieldUpdated:
|
||||
case dbpackage.FieldBuildTimeStart, dbpackage.FieldBuildTimeEnd, dbpackage.FieldUpdated:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected column %q for type DbPackage", columns[i])
|
||||
@ -92,10 +92,10 @@ func (dp *DbPackage) assignValues(columns []string, values []interface{}) error
|
||||
}
|
||||
}
|
||||
case dbpackage.FieldStatus:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field status", values[i])
|
||||
} else if value.Valid {
|
||||
dp.Status = int(value.Int64)
|
||||
dp.Status = dbpackage.Status(value.String)
|
||||
}
|
||||
case dbpackage.FieldSkipReason:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
@ -107,7 +107,7 @@ func (dp *DbPackage) assignValues(columns []string, values []interface{}) error
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field repository", values[i])
|
||||
} else if value.Valid {
|
||||
dp.Repository = value.String
|
||||
dp.Repository = dbpackage.Repository(value.String)
|
||||
}
|
||||
case dbpackage.FieldMarch:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
@ -127,17 +127,17 @@ func (dp *DbPackage) assignValues(columns []string, values []interface{}) error
|
||||
} else if value.Valid {
|
||||
dp.RepoVersion = value.String
|
||||
}
|
||||
case dbpackage.FieldBuildTime:
|
||||
case dbpackage.FieldBuildTimeStart:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field build_time", values[i])
|
||||
return fmt.Errorf("unexpected type %T for field build_time_start", values[i])
|
||||
} else if value.Valid {
|
||||
dp.BuildTime = value.Time
|
||||
dp.BuildTimeStart = value.Time
|
||||
}
|
||||
case dbpackage.FieldBuildDuration:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field build_duration", values[i])
|
||||
case dbpackage.FieldBuildTimeEnd:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field build_time_end", values[i])
|
||||
} else if value.Valid {
|
||||
dp.BuildDuration = uint64(value.Int64)
|
||||
dp.BuildTimeEnd = value.Time
|
||||
}
|
||||
case dbpackage.FieldUpdated:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
@ -188,17 +188,17 @@ func (dp *DbPackage) String() string {
|
||||
builder.WriteString(", skip_reason=")
|
||||
builder.WriteString(dp.SkipReason)
|
||||
builder.WriteString(", repository=")
|
||||
builder.WriteString(dp.Repository)
|
||||
builder.WriteString(fmt.Sprintf("%v", dp.Repository))
|
||||
builder.WriteString(", march=")
|
||||
builder.WriteString(dp.March)
|
||||
builder.WriteString(", version=")
|
||||
builder.WriteString(dp.Version)
|
||||
builder.WriteString(", repo_version=")
|
||||
builder.WriteString(dp.RepoVersion)
|
||||
builder.WriteString(", build_time=")
|
||||
builder.WriteString(dp.BuildTime.Format(time.ANSIC))
|
||||
builder.WriteString(", build_duration=")
|
||||
builder.WriteString(fmt.Sprintf("%v", dp.BuildDuration))
|
||||
builder.WriteString(", build_time_start=")
|
||||
builder.WriteString(dp.BuildTimeStart.Format(time.ANSIC))
|
||||
builder.WriteString(", build_time_end=")
|
||||
builder.WriteString(dp.BuildTimeEnd.Format(time.ANSIC))
|
||||
builder.WriteString(", updated=")
|
||||
builder.WriteString(dp.Updated.Format(time.ANSIC))
|
||||
builder.WriteString(", hash=")
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
package dbpackage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the dbpackage type in the database.
|
||||
Label = "db_package"
|
||||
@ -23,10 +27,10 @@ const (
|
||||
FieldVersion = "version"
|
||||
// FieldRepoVersion holds the string denoting the repo_version field in the database.
|
||||
FieldRepoVersion = "repo_version"
|
||||
// FieldBuildTime holds the string denoting the build_time field in the database.
|
||||
FieldBuildTime = "build_time"
|
||||
// FieldBuildDuration holds the string denoting the build_duration field in the database.
|
||||
FieldBuildDuration = "build_duration"
|
||||
// FieldBuildTimeStart holds the string denoting the build_time_start field in the database.
|
||||
FieldBuildTimeStart = "build_time_start"
|
||||
// FieldBuildTimeEnd holds the string denoting the build_time_end field in the database.
|
||||
FieldBuildTimeEnd = "build_time_end"
|
||||
// FieldUpdated holds the string denoting the updated field in the database.
|
||||
FieldUpdated = "updated"
|
||||
// FieldHash holds the string denoting the hash field in the database.
|
||||
@ -46,8 +50,8 @@ var Columns = []string{
|
||||
FieldMarch,
|
||||
FieldVersion,
|
||||
FieldRepoVersion,
|
||||
FieldBuildTime,
|
||||
FieldBuildDuration,
|
||||
FieldBuildTimeStart,
|
||||
FieldBuildTimeEnd,
|
||||
FieldUpdated,
|
||||
FieldHash,
|
||||
}
|
||||
@ -65,14 +69,62 @@ func ValidColumn(column string) bool {
|
||||
var (
|
||||
// PkgbaseValidator is a validator for the "pkgbase" field. It is called by the builders before save.
|
||||
PkgbaseValidator func(string) error
|
||||
// DefaultStatus holds the default value on creation for the "status" field.
|
||||
DefaultStatus int
|
||||
// StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
||||
StatusValidator func(int) error
|
||||
// RepositoryValidator is a validator for the "repository" field. It is called by the builders before save.
|
||||
RepositoryValidator func(string) error
|
||||
// MarchValidator is a validator for the "march" field. It is called by the builders before save.
|
||||
MarchValidator func(string) error
|
||||
// BuildDurationValidator is a validator for the "build_duration" field. It is called by the builders before save.
|
||||
BuildDurationValidator func(uint64) error
|
||||
)
|
||||
|
||||
// Status defines the type for the "status" enum field.
|
||||
type Status string
|
||||
|
||||
// StatusUnknown is the default value of the Status enum.
|
||||
const DefaultStatus = StatusUnknown
|
||||
|
||||
// Status values.
|
||||
const (
|
||||
StatusSkipped Status = "skipped"
|
||||
StatusFailed Status = "failed"
|
||||
StatusBuild Status = "build"
|
||||
StatusQueued Status = "queued"
|
||||
StatusBuilding Status = "building"
|
||||
StatusLatest Status = "latest"
|
||||
StatusSigning Status = "signing"
|
||||
StatusUnknown Status = "unknown"
|
||||
)
|
||||
|
||||
func (s Status) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
||||
func StatusValidator(s Status) error {
|
||||
switch s {
|
||||
case StatusSkipped, StatusFailed, StatusBuild, StatusQueued, StatusBuilding, StatusLatest, StatusSigning, StatusUnknown:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("dbpackage: invalid enum value for status field: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// Repository defines the type for the "repository" enum field.
|
||||
type Repository string
|
||||
|
||||
// Repository values.
|
||||
const (
|
||||
RepositoryExtra Repository = "extra"
|
||||
RepositoryCore Repository = "core"
|
||||
RepositoryCommunity Repository = "community"
|
||||
)
|
||||
|
||||
func (r Repository) String() string {
|
||||
return string(r)
|
||||
}
|
||||
|
||||
// RepositoryValidator is a validator for the "repository" field enum values. It is called by the builders before save.
|
||||
func RepositoryValidator(r Repository) error {
|
||||
switch r {
|
||||
case RepositoryExtra, RepositoryCore, RepositoryCommunity:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("dbpackage: invalid enum value for repository field: %q", r)
|
||||
}
|
||||
}
|
||||
|
@ -99,13 +99,6 @@ func Pkgbase(v string) predicate.DbPackage {
|
||||
})
|
||||
}
|
||||
|
||||
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
||||
func Status(v int) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldStatus), v))
|
||||
})
|
||||
}
|
||||
|
||||
// SkipReason applies equality check predicate on the "skip_reason" field. It's identical to SkipReasonEQ.
|
||||
func SkipReason(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
@ -113,13 +106,6 @@ func SkipReason(v string) predicate.DbPackage {
|
||||
})
|
||||
}
|
||||
|
||||
// Repository applies equality check predicate on the "repository" field. It's identical to RepositoryEQ.
|
||||
func Repository(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// March applies equality check predicate on the "march" field. It's identical to MarchEQ.
|
||||
func March(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
@ -141,17 +127,17 @@ func RepoVersion(v string) predicate.DbPackage {
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTime applies equality check predicate on the "build_time" field. It's identical to BuildTimeEQ.
|
||||
func BuildTime(v time.Time) predicate.DbPackage {
|
||||
// BuildTimeStart applies equality check predicate on the "build_time_start" field. It's identical to BuildTimeStartEQ.
|
||||
func BuildTimeStart(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldBuildTime), v))
|
||||
s.Where(sql.EQ(s.C(FieldBuildTimeStart), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDuration applies equality check predicate on the "build_duration" field. It's identical to BuildDurationEQ.
|
||||
func BuildDuration(v uint64) predicate.DbPackage {
|
||||
// BuildTimeEnd applies equality check predicate on the "build_time_end" field. It's identical to BuildTimeEndEQ.
|
||||
func BuildTimeEnd(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldBuildDuration), v))
|
||||
s.Where(sql.EQ(s.C(FieldBuildTimeEnd), v))
|
||||
})
|
||||
}
|
||||
|
||||
@ -295,21 +281,21 @@ func PackagesNotNil() predicate.DbPackage {
|
||||
}
|
||||
|
||||
// StatusEQ applies the EQ predicate on the "status" field.
|
||||
func StatusEQ(v int) predicate.DbPackage {
|
||||
func StatusEQ(v Status) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldStatus), v))
|
||||
})
|
||||
}
|
||||
|
||||
// StatusNEQ applies the NEQ predicate on the "status" field.
|
||||
func StatusNEQ(v int) predicate.DbPackage {
|
||||
func StatusNEQ(v Status) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldStatus), v))
|
||||
})
|
||||
}
|
||||
|
||||
// StatusIn applies the In predicate on the "status" field.
|
||||
func StatusIn(vs ...int) predicate.DbPackage {
|
||||
func StatusIn(vs ...Status) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -326,7 +312,7 @@ func StatusIn(vs ...int) predicate.DbPackage {
|
||||
}
|
||||
|
||||
// StatusNotIn applies the NotIn predicate on the "status" field.
|
||||
func StatusNotIn(vs ...int) predicate.DbPackage {
|
||||
func StatusNotIn(vs ...Status) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -342,31 +328,17 @@ func StatusNotIn(vs ...int) predicate.DbPackage {
|
||||
})
|
||||
}
|
||||
|
||||
// StatusGT applies the GT predicate on the "status" field.
|
||||
func StatusGT(v int) predicate.DbPackage {
|
||||
// StatusIsNil applies the IsNil predicate on the "status" field.
|
||||
func StatusIsNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldStatus), v))
|
||||
s.Where(sql.IsNull(s.C(FieldStatus)))
|
||||
})
|
||||
}
|
||||
|
||||
// StatusGTE applies the GTE predicate on the "status" field.
|
||||
func StatusGTE(v int) predicate.DbPackage {
|
||||
// StatusNotNil applies the NotNil predicate on the "status" field.
|
||||
func StatusNotNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldStatus), v))
|
||||
})
|
||||
}
|
||||
|
||||
// StatusLT applies the LT predicate on the "status" field.
|
||||
func StatusLT(v int) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldStatus), v))
|
||||
})
|
||||
}
|
||||
|
||||
// StatusLTE applies the LTE predicate on the "status" field.
|
||||
func StatusLTE(v int) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldStatus), v))
|
||||
s.Where(sql.NotNull(s.C(FieldStatus)))
|
||||
})
|
||||
}
|
||||
|
||||
@ -496,21 +468,21 @@ func SkipReasonContainsFold(v string) predicate.DbPackage {
|
||||
}
|
||||
|
||||
// RepositoryEQ applies the EQ predicate on the "repository" field.
|
||||
func RepositoryEQ(v string) predicate.DbPackage {
|
||||
func RepositoryEQ(v Repository) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryNEQ applies the NEQ predicate on the "repository" field.
|
||||
func RepositoryNEQ(v string) predicate.DbPackage {
|
||||
func RepositoryNEQ(v Repository) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryIn applies the In predicate on the "repository" field.
|
||||
func RepositoryIn(vs ...string) predicate.DbPackage {
|
||||
func RepositoryIn(vs ...Repository) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -527,7 +499,7 @@ func RepositoryIn(vs ...string) predicate.DbPackage {
|
||||
}
|
||||
|
||||
// RepositoryNotIn applies the NotIn predicate on the "repository" field.
|
||||
func RepositoryNotIn(vs ...string) predicate.DbPackage {
|
||||
func RepositoryNotIn(vs ...Repository) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -543,69 +515,6 @@ func RepositoryNotIn(vs ...string) predicate.DbPackage {
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryGT applies the GT predicate on the "repository" field.
|
||||
func RepositoryGT(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryGTE applies the GTE predicate on the "repository" field.
|
||||
func RepositoryGTE(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryLT applies the LT predicate on the "repository" field.
|
||||
func RepositoryLT(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryLTE applies the LTE predicate on the "repository" field.
|
||||
func RepositoryLTE(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryContains applies the Contains predicate on the "repository" field.
|
||||
func RepositoryContains(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryHasPrefix applies the HasPrefix predicate on the "repository" field.
|
||||
func RepositoryHasPrefix(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryHasSuffix applies the HasSuffix predicate on the "repository" field.
|
||||
func RepositoryHasSuffix(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryEqualFold applies the EqualFold predicate on the "repository" field.
|
||||
func RepositoryEqualFold(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RepositoryContainsFold applies the ContainsFold predicate on the "repository" field.
|
||||
func RepositoryContainsFold(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldRepository), v))
|
||||
})
|
||||
}
|
||||
|
||||
// MarchEQ applies the EQ predicate on the "march" field.
|
||||
func MarchEQ(v string) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
@ -967,22 +876,22 @@ func RepoVersionContainsFold(v string) predicate.DbPackage {
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeEQ applies the EQ predicate on the "build_time" field.
|
||||
func BuildTimeEQ(v time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartEQ applies the EQ predicate on the "build_time_start" field.
|
||||
func BuildTimeStartEQ(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldBuildTime), v))
|
||||
s.Where(sql.EQ(s.C(FieldBuildTimeStart), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeNEQ applies the NEQ predicate on the "build_time" field.
|
||||
func BuildTimeNEQ(v time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartNEQ applies the NEQ predicate on the "build_time_start" field.
|
||||
func BuildTimeStartNEQ(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldBuildTime), v))
|
||||
s.Where(sql.NEQ(s.C(FieldBuildTimeStart), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeIn applies the In predicate on the "build_time" field.
|
||||
func BuildTimeIn(vs ...time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartIn applies the In predicate on the "build_time_start" field.
|
||||
func BuildTimeStartIn(vs ...time.Time) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -994,12 +903,12 @@ func BuildTimeIn(vs ...time.Time) predicate.DbPackage {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldBuildTime), v...))
|
||||
s.Where(sql.In(s.C(FieldBuildTimeStart), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeNotIn applies the NotIn predicate on the "build_time" field.
|
||||
func BuildTimeNotIn(vs ...time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartNotIn applies the NotIn predicate on the "build_time_start" field.
|
||||
func BuildTimeStartNotIn(vs ...time.Time) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -1011,68 +920,68 @@ func BuildTimeNotIn(vs ...time.Time) predicate.DbPackage {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldBuildTime), v...))
|
||||
s.Where(sql.NotIn(s.C(FieldBuildTimeStart), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeGT applies the GT predicate on the "build_time" field.
|
||||
func BuildTimeGT(v time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartGT applies the GT predicate on the "build_time_start" field.
|
||||
func BuildTimeStartGT(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldBuildTime), v))
|
||||
s.Where(sql.GT(s.C(FieldBuildTimeStart), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeGTE applies the GTE predicate on the "build_time" field.
|
||||
func BuildTimeGTE(v time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartGTE applies the GTE predicate on the "build_time_start" field.
|
||||
func BuildTimeStartGTE(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldBuildTime), v))
|
||||
s.Where(sql.GTE(s.C(FieldBuildTimeStart), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeLT applies the LT predicate on the "build_time" field.
|
||||
func BuildTimeLT(v time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartLT applies the LT predicate on the "build_time_start" field.
|
||||
func BuildTimeStartLT(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldBuildTime), v))
|
||||
s.Where(sql.LT(s.C(FieldBuildTimeStart), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeLTE applies the LTE predicate on the "build_time" field.
|
||||
func BuildTimeLTE(v time.Time) predicate.DbPackage {
|
||||
// BuildTimeStartLTE applies the LTE predicate on the "build_time_start" field.
|
||||
func BuildTimeStartLTE(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldBuildTime), v))
|
||||
s.Where(sql.LTE(s.C(FieldBuildTimeStart), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeIsNil applies the IsNil predicate on the "build_time" field.
|
||||
func BuildTimeIsNil() predicate.DbPackage {
|
||||
// BuildTimeStartIsNil applies the IsNil predicate on the "build_time_start" field.
|
||||
func BuildTimeStartIsNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldBuildTime)))
|
||||
s.Where(sql.IsNull(s.C(FieldBuildTimeStart)))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildTimeNotNil applies the NotNil predicate on the "build_time" field.
|
||||
func BuildTimeNotNil() predicate.DbPackage {
|
||||
// BuildTimeStartNotNil applies the NotNil predicate on the "build_time_start" field.
|
||||
func BuildTimeStartNotNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldBuildTime)))
|
||||
s.Where(sql.NotNull(s.C(FieldBuildTimeStart)))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationEQ applies the EQ predicate on the "build_duration" field.
|
||||
func BuildDurationEQ(v uint64) predicate.DbPackage {
|
||||
// BuildTimeEndEQ applies the EQ predicate on the "build_time_end" field.
|
||||
func BuildTimeEndEQ(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldBuildDuration), v))
|
||||
s.Where(sql.EQ(s.C(FieldBuildTimeEnd), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationNEQ applies the NEQ predicate on the "build_duration" field.
|
||||
func BuildDurationNEQ(v uint64) predicate.DbPackage {
|
||||
// BuildTimeEndNEQ applies the NEQ predicate on the "build_time_end" field.
|
||||
func BuildTimeEndNEQ(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldBuildDuration), v))
|
||||
s.Where(sql.NEQ(s.C(FieldBuildTimeEnd), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationIn applies the In predicate on the "build_duration" field.
|
||||
func BuildDurationIn(vs ...uint64) predicate.DbPackage {
|
||||
// BuildTimeEndIn applies the In predicate on the "build_time_end" field.
|
||||
func BuildTimeEndIn(vs ...time.Time) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -1084,12 +993,12 @@ func BuildDurationIn(vs ...uint64) predicate.DbPackage {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldBuildDuration), v...))
|
||||
s.Where(sql.In(s.C(FieldBuildTimeEnd), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationNotIn applies the NotIn predicate on the "build_duration" field.
|
||||
func BuildDurationNotIn(vs ...uint64) predicate.DbPackage {
|
||||
// BuildTimeEndNotIn applies the NotIn predicate on the "build_time_end" field.
|
||||
func BuildTimeEndNotIn(vs ...time.Time) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
@ -1101,49 +1010,49 @@ func BuildDurationNotIn(vs ...uint64) predicate.DbPackage {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldBuildDuration), v...))
|
||||
s.Where(sql.NotIn(s.C(FieldBuildTimeEnd), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationGT applies the GT predicate on the "build_duration" field.
|
||||
func BuildDurationGT(v uint64) predicate.DbPackage {
|
||||
// BuildTimeEndGT applies the GT predicate on the "build_time_end" field.
|
||||
func BuildTimeEndGT(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldBuildDuration), v))
|
||||
s.Where(sql.GT(s.C(FieldBuildTimeEnd), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationGTE applies the GTE predicate on the "build_duration" field.
|
||||
func BuildDurationGTE(v uint64) predicate.DbPackage {
|
||||
// BuildTimeEndGTE applies the GTE predicate on the "build_time_end" field.
|
||||
func BuildTimeEndGTE(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldBuildDuration), v))
|
||||
s.Where(sql.GTE(s.C(FieldBuildTimeEnd), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationLT applies the LT predicate on the "build_duration" field.
|
||||
func BuildDurationLT(v uint64) predicate.DbPackage {
|
||||
// BuildTimeEndLT applies the LT predicate on the "build_time_end" field.
|
||||
func BuildTimeEndLT(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldBuildDuration), v))
|
||||
s.Where(sql.LT(s.C(FieldBuildTimeEnd), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationLTE applies the LTE predicate on the "build_duration" field.
|
||||
func BuildDurationLTE(v uint64) predicate.DbPackage {
|
||||
// BuildTimeEndLTE applies the LTE predicate on the "build_time_end" field.
|
||||
func BuildTimeEndLTE(v time.Time) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldBuildDuration), v))
|
||||
s.Where(sql.LTE(s.C(FieldBuildTimeEnd), v))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationIsNil applies the IsNil predicate on the "build_duration" field.
|
||||
func BuildDurationIsNil() predicate.DbPackage {
|
||||
// BuildTimeEndIsNil applies the IsNil predicate on the "build_time_end" field.
|
||||
func BuildTimeEndIsNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldBuildDuration)))
|
||||
s.Where(sql.IsNull(s.C(FieldBuildTimeEnd)))
|
||||
})
|
||||
}
|
||||
|
||||
// BuildDurationNotNil applies the NotNil predicate on the "build_duration" field.
|
||||
func BuildDurationNotNil() predicate.DbPackage {
|
||||
// BuildTimeEndNotNil applies the NotNil predicate on the "build_time_end" field.
|
||||
func BuildTimeEndNotNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldBuildDuration)))
|
||||
s.Where(sql.NotNull(s.C(FieldBuildTimeEnd)))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -33,15 +33,15 @@ func (dpc *DbPackageCreate) SetPackages(s []string) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (dpc *DbPackageCreate) SetStatus(i int) *DbPackageCreate {
|
||||
dpc.mutation.SetStatus(i)
|
||||
func (dpc *DbPackageCreate) SetStatus(d dbpackage.Status) *DbPackageCreate {
|
||||
dpc.mutation.SetStatus(d)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableStatus(i *int) *DbPackageCreate {
|
||||
if i != nil {
|
||||
dpc.SetStatus(*i)
|
||||
func (dpc *DbPackageCreate) SetNillableStatus(d *dbpackage.Status) *DbPackageCreate {
|
||||
if d != nil {
|
||||
dpc.SetStatus(*d)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
@ -61,8 +61,8 @@ func (dpc *DbPackageCreate) SetNillableSkipReason(s *string) *DbPackageCreate {
|
||||
}
|
||||
|
||||
// SetRepository sets the "repository" field.
|
||||
func (dpc *DbPackageCreate) SetRepository(s string) *DbPackageCreate {
|
||||
dpc.mutation.SetRepository(s)
|
||||
func (dpc *DbPackageCreate) SetRepository(d dbpackage.Repository) *DbPackageCreate {
|
||||
dpc.mutation.SetRepository(d)
|
||||
return dpc
|
||||
}
|
||||
|
||||
@ -100,30 +100,30 @@ func (dpc *DbPackageCreate) SetNillableRepoVersion(s *string) *DbPackageCreate {
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetBuildTime sets the "build_time" field.
|
||||
func (dpc *DbPackageCreate) SetBuildTime(t time.Time) *DbPackageCreate {
|
||||
dpc.mutation.SetBuildTime(t)
|
||||
// SetBuildTimeStart sets the "build_time_start" field.
|
||||
func (dpc *DbPackageCreate) SetBuildTimeStart(t time.Time) *DbPackageCreate {
|
||||
dpc.mutation.SetBuildTimeStart(t)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableBuildTime sets the "build_time" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableBuildTime(t *time.Time) *DbPackageCreate {
|
||||
// SetNillableBuildTimeStart sets the "build_time_start" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableBuildTimeStart(t *time.Time) *DbPackageCreate {
|
||||
if t != nil {
|
||||
dpc.SetBuildTime(*t)
|
||||
dpc.SetBuildTimeStart(*t)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetBuildDuration sets the "build_duration" field.
|
||||
func (dpc *DbPackageCreate) SetBuildDuration(u uint64) *DbPackageCreate {
|
||||
dpc.mutation.SetBuildDuration(u)
|
||||
// SetBuildTimeEnd sets the "build_time_end" field.
|
||||
func (dpc *DbPackageCreate) SetBuildTimeEnd(t time.Time) *DbPackageCreate {
|
||||
dpc.mutation.SetBuildTimeEnd(t)
|
||||
return dpc
|
||||
}
|
||||
|
||||
// SetNillableBuildDuration sets the "build_duration" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableBuildDuration(u *uint64) *DbPackageCreate {
|
||||
if u != nil {
|
||||
dpc.SetBuildDuration(*u)
|
||||
// SetNillableBuildTimeEnd sets the "build_time_end" field if the given value is not nil.
|
||||
func (dpc *DbPackageCreate) SetNillableBuildTimeEnd(t *time.Time) *DbPackageCreate {
|
||||
if t != nil {
|
||||
dpc.SetBuildTimeEnd(*t)
|
||||
}
|
||||
return dpc
|
||||
}
|
||||
@ -243,9 +243,6 @@ func (dpc *DbPackageCreate) check() error {
|
||||
return &ValidationError{Name: "pkgbase", err: fmt.Errorf(`ent: validator failed for field "pkgbase": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := dpc.mutation.Status(); !ok {
|
||||
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "status"`)}
|
||||
}
|
||||
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)}
|
||||
@ -267,11 +264,6 @@ func (dpc *DbPackageCreate) check() error {
|
||||
return &ValidationError{Name: "march", err: fmt.Errorf(`ent: validator failed for field "march": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpc.mutation.BuildDuration(); ok {
|
||||
if err := dbpackage.BuildDurationValidator(v); err != nil {
|
||||
return &ValidationError{Name: "build_duration", err: fmt.Errorf(`ent: validator failed for field "build_duration": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -317,7 +309,7 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
||||
}
|
||||
if value, ok := dpc.mutation.Status(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Type: field.TypeEnum,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldStatus,
|
||||
})
|
||||
@ -333,7 +325,7 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
||||
}
|
||||
if value, ok := dpc.mutation.Repository(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Type: field.TypeEnum,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldRepository,
|
||||
})
|
||||
@ -363,21 +355,21 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
||||
})
|
||||
_node.RepoVersion = value
|
||||
}
|
||||
if value, ok := dpc.mutation.BuildTime(); ok {
|
||||
if value, ok := dpc.mutation.BuildTimeStart(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildTime,
|
||||
Column: dbpackage.FieldBuildTimeStart,
|
||||
})
|
||||
_node.BuildTime = value
|
||||
_node.BuildTimeStart = value
|
||||
}
|
||||
if value, ok := dpc.mutation.BuildDuration(); ok {
|
||||
if value, ok := dpc.mutation.BuildTimeEnd(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildDuration,
|
||||
Column: dbpackage.FieldBuildTimeEnd,
|
||||
})
|
||||
_node.BuildDuration = value
|
||||
_node.BuildTimeEnd = value
|
||||
}
|
||||
if value, ok := dpc.mutation.Updated(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
|
@ -24,6 +24,7 @@ type DbPackageQuery struct {
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
predicates []predicate.DbPackage
|
||||
modifiers []func(s *sql.Selector)
|
||||
// intermediate query (i.e. traversal path).
|
||||
sql *sql.Selector
|
||||
path func(context.Context) (*sql.Selector, error)
|
||||
@ -325,6 +326,9 @@ func (dpq *DbPackageQuery) sqlAll(ctx context.Context) ([]*DbPackage, error) {
|
||||
node := nodes[len(nodes)-1]
|
||||
return node.assignValues(columns, values)
|
||||
}
|
||||
if len(dpq.modifiers) > 0 {
|
||||
_spec.Modifiers = dpq.modifiers
|
||||
}
|
||||
if err := sqlgraph.QueryNodes(ctx, dpq.driver, _spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -336,6 +340,9 @@ func (dpq *DbPackageQuery) sqlAll(ctx context.Context) ([]*DbPackage, error) {
|
||||
|
||||
func (dpq *DbPackageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||
_spec := dpq.querySpec()
|
||||
if len(dpq.modifiers) > 0 {
|
||||
_spec.Modifiers = dpq.modifiers
|
||||
}
|
||||
return sqlgraph.CountNodes(ctx, dpq.driver, _spec)
|
||||
}
|
||||
|
||||
@ -407,6 +414,9 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
selector = dpq.sql
|
||||
selector.Select(selector.Columns(columns...)...)
|
||||
}
|
||||
for _, m := range dpq.modifiers {
|
||||
m(selector)
|
||||
}
|
||||
for _, p := range dpq.predicates {
|
||||
p(selector)
|
||||
}
|
||||
@ -424,6 +434,12 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
return selector
|
||||
}
|
||||
|
||||
// Modify adds a query modifier for attaching custom logic to queries.
|
||||
func (dpq *DbPackageQuery) Modify(modifiers ...func(s *sql.Selector)) *DbPackageSelect {
|
||||
dpq.modifiers = append(dpq.modifiers, modifiers...)
|
||||
return dpq.Select()
|
||||
}
|
||||
|
||||
// DbPackageGroupBy is the group-by builder for DbPackage entities.
|
||||
type DbPackageGroupBy struct {
|
||||
config
|
||||
@ -913,3 +929,9 @@ func (dps *DbPackageSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
defer rows.Close()
|
||||
return sql.ScanSlice(rows, v)
|
||||
}
|
||||
|
||||
// Modify adds a query modifier for attaching custom logic to queries.
|
||||
func (dps *DbPackageSelect) Modify(modifiers ...func(s *sql.Selector)) *DbPackageSelect {
|
||||
dps.modifiers = append(dps.modifiers, modifiers...)
|
||||
return dps
|
||||
}
|
||||
|
@ -40,23 +40,22 @@ func (dpu *DbPackageUpdate) ClearPackages() *DbPackageUpdate {
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (dpu *DbPackageUpdate) SetStatus(i int) *DbPackageUpdate {
|
||||
dpu.mutation.ResetStatus()
|
||||
dpu.mutation.SetStatus(i)
|
||||
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(i *int) *DbPackageUpdate {
|
||||
if i != nil {
|
||||
dpu.SetStatus(*i)
|
||||
func (dpu *DbPackageUpdate) SetNillableStatus(d *dbpackage.Status) *DbPackageUpdate {
|
||||
if d != nil {
|
||||
dpu.SetStatus(*d)
|
||||
}
|
||||
return dpu
|
||||
}
|
||||
|
||||
// AddStatus adds i to the "status" field.
|
||||
func (dpu *DbPackageUpdate) AddStatus(i int) *DbPackageUpdate {
|
||||
dpu.mutation.AddStatus(i)
|
||||
// ClearStatus clears the value of the "status" field.
|
||||
func (dpu *DbPackageUpdate) ClearStatus() *DbPackageUpdate {
|
||||
dpu.mutation.ClearStatus()
|
||||
return dpu
|
||||
}
|
||||
|
||||
@ -81,8 +80,8 @@ func (dpu *DbPackageUpdate) ClearSkipReason() *DbPackageUpdate {
|
||||
}
|
||||
|
||||
// SetRepository sets the "repository" field.
|
||||
func (dpu *DbPackageUpdate) SetRepository(s string) *DbPackageUpdate {
|
||||
dpu.mutation.SetRepository(s)
|
||||
func (dpu *DbPackageUpdate) SetRepository(d dbpackage.Repository) *DbPackageUpdate {
|
||||
dpu.mutation.SetRepository(d)
|
||||
return dpu
|
||||
}
|
||||
|
||||
@ -132,50 +131,43 @@ func (dpu *DbPackageUpdate) ClearRepoVersion() *DbPackageUpdate {
|
||||
return dpu
|
||||
}
|
||||
|
||||
// SetBuildTime sets the "build_time" field.
|
||||
func (dpu *DbPackageUpdate) SetBuildTime(t time.Time) *DbPackageUpdate {
|
||||
dpu.mutation.SetBuildTime(t)
|
||||
// SetBuildTimeStart sets the "build_time_start" field.
|
||||
func (dpu *DbPackageUpdate) SetBuildTimeStart(t time.Time) *DbPackageUpdate {
|
||||
dpu.mutation.SetBuildTimeStart(t)
|
||||
return dpu
|
||||
}
|
||||
|
||||
// SetNillableBuildTime sets the "build_time" field if the given value is not nil.
|
||||
func (dpu *DbPackageUpdate) SetNillableBuildTime(t *time.Time) *DbPackageUpdate {
|
||||
// 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.SetBuildTime(*t)
|
||||
dpu.SetBuildTimeStart(*t)
|
||||
}
|
||||
return dpu
|
||||
}
|
||||
|
||||
// ClearBuildTime clears the value of the "build_time" field.
|
||||
func (dpu *DbPackageUpdate) ClearBuildTime() *DbPackageUpdate {
|
||||
dpu.mutation.ClearBuildTime()
|
||||
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
||||
func (dpu *DbPackageUpdate) ClearBuildTimeStart() *DbPackageUpdate {
|
||||
dpu.mutation.ClearBuildTimeStart()
|
||||
return dpu
|
||||
}
|
||||
|
||||
// SetBuildDuration sets the "build_duration" field.
|
||||
func (dpu *DbPackageUpdate) SetBuildDuration(u uint64) *DbPackageUpdate {
|
||||
dpu.mutation.ResetBuildDuration()
|
||||
dpu.mutation.SetBuildDuration(u)
|
||||
// SetBuildTimeEnd sets the "build_time_end" field.
|
||||
func (dpu *DbPackageUpdate) SetBuildTimeEnd(t time.Time) *DbPackageUpdate {
|
||||
dpu.mutation.SetBuildTimeEnd(t)
|
||||
return dpu
|
||||
}
|
||||
|
||||
// SetNillableBuildDuration sets the "build_duration" field if the given value is not nil.
|
||||
func (dpu *DbPackageUpdate) SetNillableBuildDuration(u *uint64) *DbPackageUpdate {
|
||||
if u != nil {
|
||||
dpu.SetBuildDuration(*u)
|
||||
// SetNillableBuildTimeEnd sets the "build_time_end" field if the given value is not nil.
|
||||
func (dpu *DbPackageUpdate) SetNillableBuildTimeEnd(t *time.Time) *DbPackageUpdate {
|
||||
if t != nil {
|
||||
dpu.SetBuildTimeEnd(*t)
|
||||
}
|
||||
return dpu
|
||||
}
|
||||
|
||||
// AddBuildDuration adds u to the "build_duration" field.
|
||||
func (dpu *DbPackageUpdate) AddBuildDuration(u uint64) *DbPackageUpdate {
|
||||
dpu.mutation.AddBuildDuration(u)
|
||||
return dpu
|
||||
}
|
||||
|
||||
// ClearBuildDuration clears the value of the "build_duration" field.
|
||||
func (dpu *DbPackageUpdate) ClearBuildDuration() *DbPackageUpdate {
|
||||
dpu.mutation.ClearBuildDuration()
|
||||
// ClearBuildTimeEnd clears the value of the "build_time_end" field.
|
||||
func (dpu *DbPackageUpdate) ClearBuildTimeEnd() *DbPackageUpdate {
|
||||
dpu.mutation.ClearBuildTimeEnd()
|
||||
return dpu
|
||||
}
|
||||
|
||||
@ -301,11 +293,6 @@ func (dpu *DbPackageUpdate) check() error {
|
||||
return &ValidationError{Name: "march", err: fmt.Errorf("ent: validator failed for field \"march\": %w", err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpu.mutation.BuildDuration(); ok {
|
||||
if err := dbpackage.BuildDurationValidator(v); err != nil {
|
||||
return &ValidationError{Name: "build_duration", err: fmt.Errorf("ent: validator failed for field \"build_duration\": %w", err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -342,15 +329,14 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
if value, ok := dpu.mutation.Status(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Type: field.TypeEnum,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldStatus,
|
||||
})
|
||||
}
|
||||
if value, ok := dpu.mutation.AddedStatus(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
if dpu.mutation.StatusCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeEnum,
|
||||
Column: dbpackage.FieldStatus,
|
||||
})
|
||||
}
|
||||
@ -369,7 +355,7 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
if value, ok := dpu.mutation.Repository(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Type: field.TypeEnum,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldRepository,
|
||||
})
|
||||
@ -407,37 +393,30 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Column: dbpackage.FieldRepoVersion,
|
||||
})
|
||||
}
|
||||
if value, ok := dpu.mutation.BuildTime(); ok {
|
||||
if value, ok := dpu.mutation.BuildTimeStart(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildTime,
|
||||
Column: dbpackage.FieldBuildTimeStart,
|
||||
})
|
||||
}
|
||||
if dpu.mutation.BuildTimeCleared() {
|
||||
if dpu.mutation.BuildTimeStartCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: dbpackage.FieldBuildTime,
|
||||
Column: dbpackage.FieldBuildTimeStart,
|
||||
})
|
||||
}
|
||||
if value, ok := dpu.mutation.BuildDuration(); ok {
|
||||
if value, ok := dpu.mutation.BuildTimeEnd(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildDuration,
|
||||
Column: dbpackage.FieldBuildTimeEnd,
|
||||
})
|
||||
}
|
||||
if value, ok := dpu.mutation.AddedBuildDuration(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildDuration,
|
||||
})
|
||||
}
|
||||
if dpu.mutation.BuildDurationCleared() {
|
||||
if dpu.mutation.BuildTimeEndCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: dbpackage.FieldBuildDuration,
|
||||
Type: field.TypeTime,
|
||||
Column: dbpackage.FieldBuildTimeEnd,
|
||||
})
|
||||
}
|
||||
if value, ok := dpu.mutation.Updated(); ok {
|
||||
@ -498,23 +477,22 @@ func (dpuo *DbPackageUpdateOne) ClearPackages() *DbPackageUpdateOne {
|
||||
}
|
||||
|
||||
// SetStatus sets the "status" field.
|
||||
func (dpuo *DbPackageUpdateOne) SetStatus(i int) *DbPackageUpdateOne {
|
||||
dpuo.mutation.ResetStatus()
|
||||
dpuo.mutation.SetStatus(i)
|
||||
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(i *int) *DbPackageUpdateOne {
|
||||
if i != nil {
|
||||
dpuo.SetStatus(*i)
|
||||
func (dpuo *DbPackageUpdateOne) SetNillableStatus(d *dbpackage.Status) *DbPackageUpdateOne {
|
||||
if d != nil {
|
||||
dpuo.SetStatus(*d)
|
||||
}
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// AddStatus adds i to the "status" field.
|
||||
func (dpuo *DbPackageUpdateOne) AddStatus(i int) *DbPackageUpdateOne {
|
||||
dpuo.mutation.AddStatus(i)
|
||||
// ClearStatus clears the value of the "status" field.
|
||||
func (dpuo *DbPackageUpdateOne) ClearStatus() *DbPackageUpdateOne {
|
||||
dpuo.mutation.ClearStatus()
|
||||
return dpuo
|
||||
}
|
||||
|
||||
@ -539,8 +517,8 @@ func (dpuo *DbPackageUpdateOne) ClearSkipReason() *DbPackageUpdateOne {
|
||||
}
|
||||
|
||||
// SetRepository sets the "repository" field.
|
||||
func (dpuo *DbPackageUpdateOne) SetRepository(s string) *DbPackageUpdateOne {
|
||||
dpuo.mutation.SetRepository(s)
|
||||
func (dpuo *DbPackageUpdateOne) SetRepository(d dbpackage.Repository) *DbPackageUpdateOne {
|
||||
dpuo.mutation.SetRepository(d)
|
||||
return dpuo
|
||||
}
|
||||
|
||||
@ -590,50 +568,43 @@ func (dpuo *DbPackageUpdateOne) ClearRepoVersion() *DbPackageUpdateOne {
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// SetBuildTime sets the "build_time" field.
|
||||
func (dpuo *DbPackageUpdateOne) SetBuildTime(t time.Time) *DbPackageUpdateOne {
|
||||
dpuo.mutation.SetBuildTime(t)
|
||||
// SetBuildTimeStart sets the "build_time_start" field.
|
||||
func (dpuo *DbPackageUpdateOne) SetBuildTimeStart(t time.Time) *DbPackageUpdateOne {
|
||||
dpuo.mutation.SetBuildTimeStart(t)
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// SetNillableBuildTime sets the "build_time" field if the given value is not nil.
|
||||
func (dpuo *DbPackageUpdateOne) SetNillableBuildTime(t *time.Time) *DbPackageUpdateOne {
|
||||
// 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.SetBuildTime(*t)
|
||||
dpuo.SetBuildTimeStart(*t)
|
||||
}
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// ClearBuildTime clears the value of the "build_time" field.
|
||||
func (dpuo *DbPackageUpdateOne) ClearBuildTime() *DbPackageUpdateOne {
|
||||
dpuo.mutation.ClearBuildTime()
|
||||
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
||||
func (dpuo *DbPackageUpdateOne) ClearBuildTimeStart() *DbPackageUpdateOne {
|
||||
dpuo.mutation.ClearBuildTimeStart()
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// SetBuildDuration sets the "build_duration" field.
|
||||
func (dpuo *DbPackageUpdateOne) SetBuildDuration(u uint64) *DbPackageUpdateOne {
|
||||
dpuo.mutation.ResetBuildDuration()
|
||||
dpuo.mutation.SetBuildDuration(u)
|
||||
// SetBuildTimeEnd sets the "build_time_end" field.
|
||||
func (dpuo *DbPackageUpdateOne) SetBuildTimeEnd(t time.Time) *DbPackageUpdateOne {
|
||||
dpuo.mutation.SetBuildTimeEnd(t)
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// SetNillableBuildDuration sets the "build_duration" field if the given value is not nil.
|
||||
func (dpuo *DbPackageUpdateOne) SetNillableBuildDuration(u *uint64) *DbPackageUpdateOne {
|
||||
if u != nil {
|
||||
dpuo.SetBuildDuration(*u)
|
||||
// SetNillableBuildTimeEnd sets the "build_time_end" field if the given value is not nil.
|
||||
func (dpuo *DbPackageUpdateOne) SetNillableBuildTimeEnd(t *time.Time) *DbPackageUpdateOne {
|
||||
if t != nil {
|
||||
dpuo.SetBuildTimeEnd(*t)
|
||||
}
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// AddBuildDuration adds u to the "build_duration" field.
|
||||
func (dpuo *DbPackageUpdateOne) AddBuildDuration(u uint64) *DbPackageUpdateOne {
|
||||
dpuo.mutation.AddBuildDuration(u)
|
||||
return dpuo
|
||||
}
|
||||
|
||||
// ClearBuildDuration clears the value of the "build_duration" field.
|
||||
func (dpuo *DbPackageUpdateOne) ClearBuildDuration() *DbPackageUpdateOne {
|
||||
dpuo.mutation.ClearBuildDuration()
|
||||
// ClearBuildTimeEnd clears the value of the "build_time_end" field.
|
||||
func (dpuo *DbPackageUpdateOne) ClearBuildTimeEnd() *DbPackageUpdateOne {
|
||||
dpuo.mutation.ClearBuildTimeEnd()
|
||||
return dpuo
|
||||
}
|
||||
|
||||
@ -766,11 +737,6 @@ func (dpuo *DbPackageUpdateOne) check() error {
|
||||
return &ValidationError{Name: "march", err: fmt.Errorf("ent: validator failed for field \"march\": %w", err)}
|
||||
}
|
||||
}
|
||||
if v, ok := dpuo.mutation.BuildDuration(); ok {
|
||||
if err := dbpackage.BuildDurationValidator(v); err != nil {
|
||||
return &ValidationError{Name: "build_duration", err: fmt.Errorf("ent: validator failed for field \"build_duration\": %w", err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -824,15 +790,14 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
|
||||
}
|
||||
if value, ok := dpuo.mutation.Status(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Type: field.TypeEnum,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldStatus,
|
||||
})
|
||||
}
|
||||
if value, ok := dpuo.mutation.AddedStatus(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Value: value,
|
||||
if dpuo.mutation.StatusCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeEnum,
|
||||
Column: dbpackage.FieldStatus,
|
||||
})
|
||||
}
|
||||
@ -851,7 +816,7 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
|
||||
}
|
||||
if value, ok := dpuo.mutation.Repository(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Type: field.TypeEnum,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldRepository,
|
||||
})
|
||||
@ -889,37 +854,30 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
|
||||
Column: dbpackage.FieldRepoVersion,
|
||||
})
|
||||
}
|
||||
if value, ok := dpuo.mutation.BuildTime(); ok {
|
||||
if value, ok := dpuo.mutation.BuildTimeStart(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildTime,
|
||||
Column: dbpackage.FieldBuildTimeStart,
|
||||
})
|
||||
}
|
||||
if dpuo.mutation.BuildTimeCleared() {
|
||||
if dpuo.mutation.BuildTimeStartCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeTime,
|
||||
Column: dbpackage.FieldBuildTime,
|
||||
Column: dbpackage.FieldBuildTimeStart,
|
||||
})
|
||||
}
|
||||
if value, ok := dpuo.mutation.BuildDuration(); ok {
|
||||
if value, ok := dpuo.mutation.BuildTimeEnd(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Type: field.TypeTime,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildDuration,
|
||||
Column: dbpackage.FieldBuildTimeEnd,
|
||||
})
|
||||
}
|
||||
if value, ok := dpuo.mutation.AddedBuildDuration(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Value: value,
|
||||
Column: dbpackage.FieldBuildDuration,
|
||||
})
|
||||
}
|
||||
if dpuo.mutation.BuildDurationCleared() {
|
||||
if dpuo.mutation.BuildTimeEndCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUint64,
|
||||
Column: dbpackage.FieldBuildDuration,
|
||||
Type: field.TypeTime,
|
||||
Column: dbpackage.FieldBuildTimeEnd,
|
||||