forked from ALHP/ALHP.GO
changes to db schema; more housekeeping work
This commit is contained in:
@@ -22,21 +22,21 @@ type DbPackage struct {
|
|||||||
// Packages holds the value of the "packages" field.
|
// Packages holds the value of the "packages" field.
|
||||||
Packages []string `json:"packages,omitempty"`
|
Packages []string `json:"packages,omitempty"`
|
||||||
// Status holds the value of the "status" field.
|
// 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 holds the value of the "skip_reason" field.
|
||||||
SkipReason string `json:"skip_reason,omitempty"`
|
SkipReason string `json:"skip_reason,omitempty"`
|
||||||
// Repository holds the value of the "repository" field.
|
// 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 holds the value of the "march" field.
|
||||||
March string `json:"march,omitempty"`
|
March string `json:"march,omitempty"`
|
||||||
// Version holds the value of the "version" field.
|
// Version holds the value of the "version" field.
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
// RepoVersion holds the value of the "repo_version" field.
|
// RepoVersion holds the value of the "repo_version" field.
|
||||||
RepoVersion string `json:"repo_version,omitempty"`
|
RepoVersion string `json:"repo_version,omitempty"`
|
||||||
// BuildTime holds the value of the "build_time" field.
|
// BuildTimeStart holds the value of the "build_time_start" field.
|
||||||
BuildTime time.Time `json:"build_time,omitempty"`
|
BuildTimeStart time.Time `json:"build_time_start,omitempty"`
|
||||||
// BuildDuration holds the value of the "build_duration" field.
|
// BuildTimeEnd holds the value of the "build_time_end" field.
|
||||||
BuildDuration uint64 `json:"build_duration,omitempty"`
|
BuildTimeEnd time.Time `json:"build_time_end,omitempty"`
|
||||||
// Updated holds the value of the "updated" field.
|
// Updated holds the value of the "updated" field.
|
||||||
Updated time.Time `json:"updated,omitempty"`
|
Updated time.Time `json:"updated,omitempty"`
|
||||||
// Hash holds the value of the "hash" field.
|
// Hash holds the value of the "hash" field.
|
||||||
@@ -50,11 +50,11 @@ func (*DbPackage) scanValues(columns []string) ([]interface{}, error) {
|
|||||||
switch columns[i] {
|
switch columns[i] {
|
||||||
case dbpackage.FieldPackages:
|
case dbpackage.FieldPackages:
|
||||||
values[i] = new([]byte)
|
values[i] = new([]byte)
|
||||||
case dbpackage.FieldID, dbpackage.FieldStatus, dbpackage.FieldBuildDuration:
|
case dbpackage.FieldID:
|
||||||
values[i] = new(sql.NullInt64)
|
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)
|
values[i] = new(sql.NullString)
|
||||||
case dbpackage.FieldBuildTime, dbpackage.FieldUpdated:
|
case dbpackage.FieldBuildTimeStart, dbpackage.FieldBuildTimeEnd, dbpackage.FieldUpdated:
|
||||||
values[i] = new(sql.NullTime)
|
values[i] = new(sql.NullTime)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unexpected column %q for type DbPackage", columns[i])
|
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:
|
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])
|
return fmt.Errorf("unexpected type %T for field status", values[i])
|
||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
dp.Status = int(value.Int64)
|
dp.Status = dbpackage.Status(value.String)
|
||||||
}
|
}
|
||||||
case dbpackage.FieldSkipReason:
|
case dbpackage.FieldSkipReason:
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
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 {
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field repository", values[i])
|
return fmt.Errorf("unexpected type %T for field repository", values[i])
|
||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
dp.Repository = value.String
|
dp.Repository = dbpackage.Repository(value.String)
|
||||||
}
|
}
|
||||||
case dbpackage.FieldMarch:
|
case dbpackage.FieldMarch:
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
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 {
|
} else if value.Valid {
|
||||||
dp.RepoVersion = value.String
|
dp.RepoVersion = value.String
|
||||||
}
|
}
|
||||||
case dbpackage.FieldBuildTime:
|
case dbpackage.FieldBuildTimeStart:
|
||||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
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 {
|
} else if value.Valid {
|
||||||
dp.BuildTime = value.Time
|
dp.BuildTimeStart = value.Time
|
||||||
}
|
}
|
||||||
case dbpackage.FieldBuildDuration:
|
case dbpackage.FieldBuildTimeEnd:
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field build_duration", values[i])
|
return fmt.Errorf("unexpected type %T for field build_time_end", values[i])
|
||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
dp.BuildDuration = uint64(value.Int64)
|
dp.BuildTimeEnd = value.Time
|
||||||
}
|
}
|
||||||
case dbpackage.FieldUpdated:
|
case dbpackage.FieldUpdated:
|
||||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
@@ -188,17 +188,17 @@ func (dp *DbPackage) String() string {
|
|||||||
builder.WriteString(", skip_reason=")
|
builder.WriteString(", skip_reason=")
|
||||||
builder.WriteString(dp.SkipReason)
|
builder.WriteString(dp.SkipReason)
|
||||||
builder.WriteString(", repository=")
|
builder.WriteString(", repository=")
|
||||||
builder.WriteString(dp.Repository)
|
builder.WriteString(fmt.Sprintf("%v", dp.Repository))
|
||||||
builder.WriteString(", march=")
|
builder.WriteString(", march=")
|
||||||
builder.WriteString(dp.March)
|
builder.WriteString(dp.March)
|
||||||
builder.WriteString(", version=")
|
builder.WriteString(", version=")
|
||||||
builder.WriteString(dp.Version)
|
builder.WriteString(dp.Version)
|
||||||
builder.WriteString(", repo_version=")
|
builder.WriteString(", repo_version=")
|
||||||
builder.WriteString(dp.RepoVersion)
|
builder.WriteString(dp.RepoVersion)
|
||||||
builder.WriteString(", build_time=")
|
builder.WriteString(", build_time_start=")
|
||||||
builder.WriteString(dp.BuildTime.Format(time.ANSIC))
|
builder.WriteString(dp.BuildTimeStart.Format(time.ANSIC))
|
||||||
builder.WriteString(", build_duration=")
|
builder.WriteString(", build_time_end=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", dp.BuildDuration))
|
builder.WriteString(dp.BuildTimeEnd.Format(time.ANSIC))
|
||||||
builder.WriteString(", updated=")
|
builder.WriteString(", updated=")
|
||||||
builder.WriteString(dp.Updated.Format(time.ANSIC))
|
builder.WriteString(dp.Updated.Format(time.ANSIC))
|
||||||
builder.WriteString(", hash=")
|
builder.WriteString(", hash=")
|
||||||
|
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
package dbpackage
|
package dbpackage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Label holds the string label denoting the dbpackage type in the database.
|
// Label holds the string label denoting the dbpackage type in the database.
|
||||||
Label = "db_package"
|
Label = "db_package"
|
||||||
@@ -23,10 +27,10 @@ const (
|
|||||||
FieldVersion = "version"
|
FieldVersion = "version"
|
||||||
// FieldRepoVersion holds the string denoting the repo_version field in the database.
|
// FieldRepoVersion holds the string denoting the repo_version field in the database.
|
||||||
FieldRepoVersion = "repo_version"
|
FieldRepoVersion = "repo_version"
|
||||||
// FieldBuildTime holds the string denoting the build_time field in the database.
|
// FieldBuildTimeStart holds the string denoting the build_time_start field in the database.
|
||||||
FieldBuildTime = "build_time"
|
FieldBuildTimeStart = "build_time_start"
|
||||||
// FieldBuildDuration holds the string denoting the build_duration field in the database.
|
// FieldBuildTimeEnd holds the string denoting the build_time_end field in the database.
|
||||||
FieldBuildDuration = "build_duration"
|
FieldBuildTimeEnd = "build_time_end"
|
||||||
// FieldUpdated holds the string denoting the updated field in the database.
|
// FieldUpdated holds the string denoting the updated field in the database.
|
||||||
FieldUpdated = "updated"
|
FieldUpdated = "updated"
|
||||||
// FieldHash holds the string denoting the hash field in the database.
|
// FieldHash holds the string denoting the hash field in the database.
|
||||||
@@ -46,8 +50,8 @@ var Columns = []string{
|
|||||||
FieldMarch,
|
FieldMarch,
|
||||||
FieldVersion,
|
FieldVersion,
|
||||||
FieldRepoVersion,
|
FieldRepoVersion,
|
||||||
FieldBuildTime,
|
FieldBuildTimeStart,
|
||||||
FieldBuildDuration,
|
FieldBuildTimeEnd,
|
||||||
FieldUpdated,
|
FieldUpdated,
|
||||||
FieldHash,
|
FieldHash,
|
||||||
}
|
}
|
||||||
@@ -65,14 +69,62 @@ func ValidColumn(column string) bool {
|
|||||||
var (
|
var (
|
||||||
// PkgbaseValidator is a validator for the "pkgbase" field. It is called by the builders before save.
|
// PkgbaseValidator is a validator for the "pkgbase" field. It is called by the builders before save.
|
||||||
PkgbaseValidator func(string) error
|
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 is a validator for the "march" field. It is called by the builders before save.
|
||||||
MarchValidator func(string) error
|
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.
|
// SkipReason applies equality check predicate on the "skip_reason" field. It's identical to SkipReasonEQ.
|
||||||
func SkipReason(v string) predicate.DbPackage {
|
func SkipReason(v string) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// March applies equality check predicate on the "march" field. It's identical to MarchEQ.
|
||||||
func March(v string) predicate.DbPackage {
|
func March(v string) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStart applies equality check predicate on the "build_time_start" field. It's identical to BuildTimeStartEQ.
|
||||||
func BuildTime(v time.Time) predicate.DbPackage {
|
func BuildTimeStart(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEnd applies equality check predicate on the "build_time_end" field. It's identical to BuildTimeEndEQ.
|
||||||
func BuildDuration(v uint64) predicate.DbPackage {
|
func BuildTimeEnd(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// 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) {
|
return predicate.DbPackage(func(s *sql.Selector) {
|
||||||
s.Where(sql.EQ(s.C(FieldStatus), v))
|
s.Where(sql.EQ(s.C(FieldStatus), v))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// StatusNEQ applies the NEQ predicate on the "status" field.
|
// 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) {
|
return predicate.DbPackage(func(s *sql.Selector) {
|
||||||
s.Where(sql.NEQ(s.C(FieldStatus), v))
|
s.Where(sql.NEQ(s.C(FieldStatus), v))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// StatusIn applies the In predicate on the "status" field.
|
// 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))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
v[i] = vs[i]
|
||||||
@@ -326,7 +312,7 @@ func StatusIn(vs ...int) predicate.DbPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StatusNotIn applies the NotIn predicate on the "status" field.
|
// 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))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
v[i] = vs[i]
|
||||||
@@ -342,31 +328,17 @@ func StatusNotIn(vs ...int) predicate.DbPackage {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// StatusGT applies the GT predicate on the "status" field.
|
// StatusIsNil applies the IsNil predicate on the "status" field.
|
||||||
func StatusGT(v int) predicate.DbPackage {
|
func StatusIsNil() predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// StatusNotNil applies the NotNil predicate on the "status" field.
|
||||||
func StatusGTE(v int) predicate.DbPackage {
|
func StatusNotNil() predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
return predicate.DbPackage(func(s *sql.Selector) {
|
||||||
s.Where(sql.GTE(s.C(FieldStatus), v))
|
s.Where(sql.NotNull(s.C(FieldStatus)))
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,21 +468,21 @@ func SkipReasonContainsFold(v string) predicate.DbPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RepositoryEQ applies the EQ predicate on the "repository" field.
|
// 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) {
|
return predicate.DbPackage(func(s *sql.Selector) {
|
||||||
s.Where(sql.EQ(s.C(FieldRepository), v))
|
s.Where(sql.EQ(s.C(FieldRepository), v))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// RepositoryNEQ applies the NEQ predicate on the "repository" field.
|
// 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) {
|
return predicate.DbPackage(func(s *sql.Selector) {
|
||||||
s.Where(sql.NEQ(s.C(FieldRepository), v))
|
s.Where(sql.NEQ(s.C(FieldRepository), v))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// RepositoryIn applies the In predicate on the "repository" field.
|
// 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))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
v[i] = vs[i]
|
||||||
@@ -527,7 +499,7 @@ func RepositoryIn(vs ...string) predicate.DbPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RepositoryNotIn applies the NotIn predicate on the "repository" field.
|
// 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))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
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.
|
// MarchEQ applies the EQ predicate on the "march" field.
|
||||||
func MarchEQ(v string) predicate.DbPackage {
|
func MarchEQ(v string) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartEQ applies the EQ predicate on the "build_time_start" field.
|
||||||
func BuildTimeEQ(v time.Time) predicate.DbPackage {
|
func BuildTimeStartEQ(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartNEQ applies the NEQ predicate on the "build_time_start" field.
|
||||||
func BuildTimeNEQ(v time.Time) predicate.DbPackage {
|
func BuildTimeStartNEQ(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartIn applies the In predicate on the "build_time_start" field.
|
||||||
func BuildTimeIn(vs ...time.Time) predicate.DbPackage {
|
func BuildTimeStartIn(vs ...time.Time) predicate.DbPackage {
|
||||||
v := make([]interface{}, len(vs))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
v[i] = vs[i]
|
||||||
@@ -994,12 +903,12 @@ func BuildTimeIn(vs ...time.Time) predicate.DbPackage {
|
|||||||
s.Where(sql.False())
|
s.Where(sql.False())
|
||||||
return
|
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.
|
// BuildTimeStartNotIn applies the NotIn predicate on the "build_time_start" field.
|
||||||
func BuildTimeNotIn(vs ...time.Time) predicate.DbPackage {
|
func BuildTimeStartNotIn(vs ...time.Time) predicate.DbPackage {
|
||||||
v := make([]interface{}, len(vs))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
v[i] = vs[i]
|
||||||
@@ -1011,68 +920,68 @@ func BuildTimeNotIn(vs ...time.Time) predicate.DbPackage {
|
|||||||
s.Where(sql.False())
|
s.Where(sql.False())
|
||||||
return
|
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.
|
// BuildTimeStartGT applies the GT predicate on the "build_time_start" field.
|
||||||
func BuildTimeGT(v time.Time) predicate.DbPackage {
|
func BuildTimeStartGT(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartGTE applies the GTE predicate on the "build_time_start" field.
|
||||||
func BuildTimeGTE(v time.Time) predicate.DbPackage {
|
func BuildTimeStartGTE(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartLT applies the LT predicate on the "build_time_start" field.
|
||||||
func BuildTimeLT(v time.Time) predicate.DbPackage {
|
func BuildTimeStartLT(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartLTE applies the LTE predicate on the "build_time_start" field.
|
||||||
func BuildTimeLTE(v time.Time) predicate.DbPackage {
|
func BuildTimeStartLTE(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartIsNil applies the IsNil predicate on the "build_time_start" field.
|
||||||
func BuildTimeIsNil() predicate.DbPackage {
|
func BuildTimeStartIsNil() predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeStartNotNil applies the NotNil predicate on the "build_time_start" field.
|
||||||
func BuildTimeNotNil() predicate.DbPackage {
|
func BuildTimeStartNotNil() predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndEQ applies the EQ predicate on the "build_time_end" field.
|
||||||
func BuildDurationEQ(v uint64) predicate.DbPackage {
|
func BuildTimeEndEQ(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndNEQ applies the NEQ predicate on the "build_time_end" field.
|
||||||
func BuildDurationNEQ(v uint64) predicate.DbPackage {
|
func BuildTimeEndNEQ(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndIn applies the In predicate on the "build_time_end" field.
|
||||||
func BuildDurationIn(vs ...uint64) predicate.DbPackage {
|
func BuildTimeEndIn(vs ...time.Time) predicate.DbPackage {
|
||||||
v := make([]interface{}, len(vs))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
v[i] = vs[i]
|
||||||
@@ -1084,12 +993,12 @@ func BuildDurationIn(vs ...uint64) predicate.DbPackage {
|
|||||||
s.Where(sql.False())
|
s.Where(sql.False())
|
||||||
return
|
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.
|
// BuildTimeEndNotIn applies the NotIn predicate on the "build_time_end" field.
|
||||||
func BuildDurationNotIn(vs ...uint64) predicate.DbPackage {
|
func BuildTimeEndNotIn(vs ...time.Time) predicate.DbPackage {
|
||||||
v := make([]interface{}, len(vs))
|
v := make([]interface{}, len(vs))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
v[i] = vs[i]
|
v[i] = vs[i]
|
||||||
@@ -1101,49 +1010,49 @@ func BuildDurationNotIn(vs ...uint64) predicate.DbPackage {
|
|||||||
s.Where(sql.False())
|
s.Where(sql.False())
|
||||||
return
|
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.
|
// BuildTimeEndGT applies the GT predicate on the "build_time_end" field.
|
||||||
func BuildDurationGT(v uint64) predicate.DbPackage {
|
func BuildTimeEndGT(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndGTE applies the GTE predicate on the "build_time_end" field.
|
||||||
func BuildDurationGTE(v uint64) predicate.DbPackage {
|
func BuildTimeEndGTE(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndLT applies the LT predicate on the "build_time_end" field.
|
||||||
func BuildDurationLT(v uint64) predicate.DbPackage {
|
func BuildTimeEndLT(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndLTE applies the LTE predicate on the "build_time_end" field.
|
||||||
func BuildDurationLTE(v uint64) predicate.DbPackage {
|
func BuildTimeEndLTE(v time.Time) predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndIsNil applies the IsNil predicate on the "build_time_end" field.
|
||||||
func BuildDurationIsNil() predicate.DbPackage {
|
func BuildTimeEndIsNil() predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// BuildTimeEndNotNil applies the NotNil predicate on the "build_time_end" field.
|
||||||
func BuildDurationNotNil() predicate.DbPackage {
|
func BuildTimeEndNotNil() predicate.DbPackage {
|
||||||
return predicate.DbPackage(func(s *sql.Selector) {
|
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.
|
// SetStatus sets the "status" field.
|
||||||
func (dpc *DbPackageCreate) SetStatus(i int) *DbPackageCreate {
|
func (dpc *DbPackageCreate) SetStatus(d dbpackage.Status) *DbPackageCreate {
|
||||||
dpc.mutation.SetStatus(i)
|
dpc.mutation.SetStatus(d)
|
||||||
return dpc
|
return dpc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||||
func (dpc *DbPackageCreate) SetNillableStatus(i *int) *DbPackageCreate {
|
func (dpc *DbPackageCreate) SetNillableStatus(d *dbpackage.Status) *DbPackageCreate {
|
||||||
if i != nil {
|
if d != nil {
|
||||||
dpc.SetStatus(*i)
|
dpc.SetStatus(*d)
|
||||||
}
|
}
|
||||||
return dpc
|
return dpc
|
||||||
}
|
}
|
||||||
@@ -61,8 +61,8 @@ func (dpc *DbPackageCreate) SetNillableSkipReason(s *string) *DbPackageCreate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetRepository sets the "repository" field.
|
// SetRepository sets the "repository" field.
|
||||||
func (dpc *DbPackageCreate) SetRepository(s string) *DbPackageCreate {
|
func (dpc *DbPackageCreate) SetRepository(d dbpackage.Repository) *DbPackageCreate {
|
||||||
dpc.mutation.SetRepository(s)
|
dpc.mutation.SetRepository(d)
|
||||||
return dpc
|
return dpc
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,30 +100,30 @@ func (dpc *DbPackageCreate) SetNillableRepoVersion(s *string) *DbPackageCreate {
|
|||||||
return dpc
|
return dpc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildTime sets the "build_time" field.
|
// SetBuildTimeStart sets the "build_time_start" field.
|
||||||
func (dpc *DbPackageCreate) SetBuildTime(t time.Time) *DbPackageCreate {
|
func (dpc *DbPackageCreate) SetBuildTimeStart(t time.Time) *DbPackageCreate {
|
||||||
dpc.mutation.SetBuildTime(t)
|
dpc.mutation.SetBuildTimeStart(t)
|
||||||
return dpc
|
return dpc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableBuildTime sets the "build_time" field if the given value is not nil.
|
// SetNillableBuildTimeStart sets the "build_time_start" field if the given value is not nil.
|
||||||
func (dpc *DbPackageCreate) SetNillableBuildTime(t *time.Time) *DbPackageCreate {
|
func (dpc *DbPackageCreate) SetNillableBuildTimeStart(t *time.Time) *DbPackageCreate {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
dpc.SetBuildTime(*t)
|
dpc.SetBuildTimeStart(*t)
|
||||||
}
|
}
|
||||||
return dpc
|
return dpc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildDuration sets the "build_duration" field.
|
// SetBuildTimeEnd sets the "build_time_end" field.
|
||||||
func (dpc *DbPackageCreate) SetBuildDuration(u uint64) *DbPackageCreate {
|
func (dpc *DbPackageCreate) SetBuildTimeEnd(t time.Time) *DbPackageCreate {
|
||||||
dpc.mutation.SetBuildDuration(u)
|
dpc.mutation.SetBuildTimeEnd(t)
|
||||||
return dpc
|
return dpc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableBuildDuration sets the "build_duration" field if the given value is not nil.
|
// SetNillableBuildTimeEnd sets the "build_time_end" field if the given value is not nil.
|
||||||
func (dpc *DbPackageCreate) SetNillableBuildDuration(u *uint64) *DbPackageCreate {
|
func (dpc *DbPackageCreate) SetNillableBuildTimeEnd(t *time.Time) *DbPackageCreate {
|
||||||
if u != nil {
|
if t != nil {
|
||||||
dpc.SetBuildDuration(*u)
|
dpc.SetBuildTimeEnd(*t)
|
||||||
}
|
}
|
||||||
return dpc
|
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)}
|
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 v, ok := dpc.mutation.Status(); ok {
|
||||||
if err := dbpackage.StatusValidator(v); err != nil {
|
if err := dbpackage.StatusValidator(v); err != nil {
|
||||||
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "status": %w`, err)}
|
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "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)}
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +309,7 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
|||||||
}
|
}
|
||||||
if value, ok := dpc.mutation.Status(); ok {
|
if value, ok := dpc.mutation.Status(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeInt,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldStatus,
|
Column: dbpackage.FieldStatus,
|
||||||
})
|
})
|
||||||
@@ -333,7 +325,7 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
|||||||
}
|
}
|
||||||
if value, ok := dpc.mutation.Repository(); ok {
|
if value, ok := dpc.mutation.Repository(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeString,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldRepository,
|
Column: dbpackage.FieldRepository,
|
||||||
})
|
})
|
||||||
@@ -363,21 +355,21 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
|
|||||||
})
|
})
|
||||||
_node.RepoVersion = value
|
_node.RepoVersion = value
|
||||||
}
|
}
|
||||||
if value, ok := dpc.mutation.BuildTime(); ok {
|
if value, ok := dpc.mutation.BuildTimeStart(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeTime,
|
Type: field.TypeTime,
|
||||||
Value: value,
|
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{
|
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeUint64,
|
Type: field.TypeTime,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldBuildDuration,
|
Column: dbpackage.FieldBuildTimeEnd,
|
||||||
})
|
})
|
||||||
_node.BuildDuration = value
|
_node.BuildTimeEnd = value
|
||||||
}
|
}
|
||||||
if value, ok := dpc.mutation.Updated(); ok {
|
if value, ok := dpc.mutation.Updated(); ok {
|
||||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||||
|
@@ -24,6 +24,7 @@ type DbPackageQuery struct {
|
|||||||
order []OrderFunc
|
order []OrderFunc
|
||||||
fields []string
|
fields []string
|
||||||
predicates []predicate.DbPackage
|
predicates []predicate.DbPackage
|
||||||
|
modifiers []func(s *sql.Selector)
|
||||||
// intermediate query (i.e. traversal path).
|
// intermediate query (i.e. traversal path).
|
||||||
sql *sql.Selector
|
sql *sql.Selector
|
||||||
path func(context.Context) (*sql.Selector, error)
|
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]
|
node := nodes[len(nodes)-1]
|
||||||
return node.assignValues(columns, values)
|
return node.assignValues(columns, values)
|
||||||
}
|
}
|
||||||
|
if len(dpq.modifiers) > 0 {
|
||||||
|
_spec.Modifiers = dpq.modifiers
|
||||||
|
}
|
||||||
if err := sqlgraph.QueryNodes(ctx, dpq.driver, _spec); err != nil {
|
if err := sqlgraph.QueryNodes(ctx, dpq.driver, _spec); err != nil {
|
||||||
return nil, err
|
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) {
|
func (dpq *DbPackageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||||
_spec := dpq.querySpec()
|
_spec := dpq.querySpec()
|
||||||
|
if len(dpq.modifiers) > 0 {
|
||||||
|
_spec.Modifiers = dpq.modifiers
|
||||||
|
}
|
||||||
return sqlgraph.CountNodes(ctx, dpq.driver, _spec)
|
return sqlgraph.CountNodes(ctx, dpq.driver, _spec)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,6 +414,9 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
|||||||
selector = dpq.sql
|
selector = dpq.sql
|
||||||
selector.Select(selector.Columns(columns...)...)
|
selector.Select(selector.Columns(columns...)...)
|
||||||
}
|
}
|
||||||
|
for _, m := range dpq.modifiers {
|
||||||
|
m(selector)
|
||||||
|
}
|
||||||
for _, p := range dpq.predicates {
|
for _, p := range dpq.predicates {
|
||||||
p(selector)
|
p(selector)
|
||||||
}
|
}
|
||||||
@@ -424,6 +434,12 @@ func (dpq *DbPackageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
|||||||
return 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.
|
// DbPackageGroupBy is the group-by builder for DbPackage entities.
|
||||||
type DbPackageGroupBy struct {
|
type DbPackageGroupBy struct {
|
||||||
config
|
config
|
||||||
@@ -913,3 +929,9 @@ func (dps *DbPackageSelect) sqlScan(ctx context.Context, v interface{}) error {
|
|||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
return sql.ScanSlice(rows, v)
|
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.
|
// SetStatus sets the "status" field.
|
||||||
func (dpu *DbPackageUpdate) SetStatus(i int) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) SetStatus(d dbpackage.Status) *DbPackageUpdate {
|
||||||
dpu.mutation.ResetStatus()
|
dpu.mutation.SetStatus(d)
|
||||||
dpu.mutation.SetStatus(i)
|
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||||
func (dpu *DbPackageUpdate) SetNillableStatus(i *int) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) SetNillableStatus(d *dbpackage.Status) *DbPackageUpdate {
|
||||||
if i != nil {
|
if d != nil {
|
||||||
dpu.SetStatus(*i)
|
dpu.SetStatus(*d)
|
||||||
}
|
}
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddStatus adds i to the "status" field.
|
// ClearStatus clears the value of the "status" field.
|
||||||
func (dpu *DbPackageUpdate) AddStatus(i int) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) ClearStatus() *DbPackageUpdate {
|
||||||
dpu.mutation.AddStatus(i)
|
dpu.mutation.ClearStatus()
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,8 +80,8 @@ func (dpu *DbPackageUpdate) ClearSkipReason() *DbPackageUpdate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetRepository sets the "repository" field.
|
// SetRepository sets the "repository" field.
|
||||||
func (dpu *DbPackageUpdate) SetRepository(s string) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) SetRepository(d dbpackage.Repository) *DbPackageUpdate {
|
||||||
dpu.mutation.SetRepository(s)
|
dpu.mutation.SetRepository(d)
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,50 +131,43 @@ func (dpu *DbPackageUpdate) ClearRepoVersion() *DbPackageUpdate {
|
|||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildTime sets the "build_time" field.
|
// SetBuildTimeStart sets the "build_time_start" field.
|
||||||
func (dpu *DbPackageUpdate) SetBuildTime(t time.Time) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) SetBuildTimeStart(t time.Time) *DbPackageUpdate {
|
||||||
dpu.mutation.SetBuildTime(t)
|
dpu.mutation.SetBuildTimeStart(t)
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableBuildTime sets the "build_time" field if the given value is not nil.
|
// SetNillableBuildTimeStart sets the "build_time_start" field if the given value is not nil.
|
||||||
func (dpu *DbPackageUpdate) SetNillableBuildTime(t *time.Time) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) SetNillableBuildTimeStart(t *time.Time) *DbPackageUpdate {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
dpu.SetBuildTime(*t)
|
dpu.SetBuildTimeStart(*t)
|
||||||
}
|
}
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuildTime clears the value of the "build_time" field.
|
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
||||||
func (dpu *DbPackageUpdate) ClearBuildTime() *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) ClearBuildTimeStart() *DbPackageUpdate {
|
||||||
dpu.mutation.ClearBuildTime()
|
dpu.mutation.ClearBuildTimeStart()
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildDuration sets the "build_duration" field.
|
// SetBuildTimeEnd sets the "build_time_end" field.
|
||||||
func (dpu *DbPackageUpdate) SetBuildDuration(u uint64) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) SetBuildTimeEnd(t time.Time) *DbPackageUpdate {
|
||||||
dpu.mutation.ResetBuildDuration()
|
dpu.mutation.SetBuildTimeEnd(t)
|
||||||
dpu.mutation.SetBuildDuration(u)
|
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableBuildDuration sets the "build_duration" field if the given value is not nil.
|
// SetNillableBuildTimeEnd sets the "build_time_end" field if the given value is not nil.
|
||||||
func (dpu *DbPackageUpdate) SetNillableBuildDuration(u *uint64) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) SetNillableBuildTimeEnd(t *time.Time) *DbPackageUpdate {
|
||||||
if u != nil {
|
if t != nil {
|
||||||
dpu.SetBuildDuration(*u)
|
dpu.SetBuildTimeEnd(*t)
|
||||||
}
|
}
|
||||||
return dpu
|
return dpu
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddBuildDuration adds u to the "build_duration" field.
|
// ClearBuildTimeEnd clears the value of the "build_time_end" field.
|
||||||
func (dpu *DbPackageUpdate) AddBuildDuration(u uint64) *DbPackageUpdate {
|
func (dpu *DbPackageUpdate) ClearBuildTimeEnd() *DbPackageUpdate {
|
||||||
dpu.mutation.AddBuildDuration(u)
|
dpu.mutation.ClearBuildTimeEnd()
|
||||||
return dpu
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearBuildDuration clears the value of the "build_duration" field.
|
|
||||||
func (dpu *DbPackageUpdate) ClearBuildDuration() *DbPackageUpdate {
|
|
||||||
dpu.mutation.ClearBuildDuration()
|
|
||||||
return dpu
|
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)}
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,15 +329,14 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
}
|
}
|
||||||
if value, ok := dpu.mutation.Status(); ok {
|
if value, ok := dpu.mutation.Status(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeInt,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldStatus,
|
Column: dbpackage.FieldStatus,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := dpu.mutation.AddedStatus(); ok {
|
if dpu.mutation.StatusCleared() {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeInt,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
|
||||||
Column: dbpackage.FieldStatus,
|
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 {
|
if value, ok := dpu.mutation.Repository(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeString,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldRepository,
|
Column: dbpackage.FieldRepository,
|
||||||
})
|
})
|
||||||
@@ -407,37 +393,30 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
Column: dbpackage.FieldRepoVersion,
|
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{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeTime,
|
Type: field.TypeTime,
|
||||||
Value: value,
|
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{
|
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeTime,
|
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{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeUint64,
|
Type: field.TypeTime,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldBuildDuration,
|
Column: dbpackage.FieldBuildTimeEnd,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := dpu.mutation.AddedBuildDuration(); ok {
|
if dpu.mutation.BuildTimeEndCleared() {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUint64,
|
|
||||||
Value: value,
|
|
||||||
Column: dbpackage.FieldBuildDuration,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if dpu.mutation.BuildDurationCleared() {
|
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeUint64,
|
Type: field.TypeTime,
|
||||||
Column: dbpackage.FieldBuildDuration,
|
Column: dbpackage.FieldBuildTimeEnd,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := dpu.mutation.Updated(); ok {
|
if value, ok := dpu.mutation.Updated(); ok {
|
||||||
@@ -498,23 +477,22 @@ func (dpuo *DbPackageUpdateOne) ClearPackages() *DbPackageUpdateOne {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetStatus sets the "status" field.
|
// SetStatus sets the "status" field.
|
||||||
func (dpuo *DbPackageUpdateOne) SetStatus(i int) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) SetStatus(d dbpackage.Status) *DbPackageUpdateOne {
|
||||||
dpuo.mutation.ResetStatus()
|
dpuo.mutation.SetStatus(d)
|
||||||
dpuo.mutation.SetStatus(i)
|
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||||
func (dpuo *DbPackageUpdateOne) SetNillableStatus(i *int) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) SetNillableStatus(d *dbpackage.Status) *DbPackageUpdateOne {
|
||||||
if i != nil {
|
if d != nil {
|
||||||
dpuo.SetStatus(*i)
|
dpuo.SetStatus(*d)
|
||||||
}
|
}
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddStatus adds i to the "status" field.
|
// ClearStatus clears the value of the "status" field.
|
||||||
func (dpuo *DbPackageUpdateOne) AddStatus(i int) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) ClearStatus() *DbPackageUpdateOne {
|
||||||
dpuo.mutation.AddStatus(i)
|
dpuo.mutation.ClearStatus()
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,8 +517,8 @@ func (dpuo *DbPackageUpdateOne) ClearSkipReason() *DbPackageUpdateOne {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetRepository sets the "repository" field.
|
// SetRepository sets the "repository" field.
|
||||||
func (dpuo *DbPackageUpdateOne) SetRepository(s string) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) SetRepository(d dbpackage.Repository) *DbPackageUpdateOne {
|
||||||
dpuo.mutation.SetRepository(s)
|
dpuo.mutation.SetRepository(d)
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,50 +568,43 @@ func (dpuo *DbPackageUpdateOne) ClearRepoVersion() *DbPackageUpdateOne {
|
|||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildTime sets the "build_time" field.
|
// SetBuildTimeStart sets the "build_time_start" field.
|
||||||
func (dpuo *DbPackageUpdateOne) SetBuildTime(t time.Time) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) SetBuildTimeStart(t time.Time) *DbPackageUpdateOne {
|
||||||
dpuo.mutation.SetBuildTime(t)
|
dpuo.mutation.SetBuildTimeStart(t)
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableBuildTime sets the "build_time" field if the given value is not nil.
|
// SetNillableBuildTimeStart sets the "build_time_start" field if the given value is not nil.
|
||||||
func (dpuo *DbPackageUpdateOne) SetNillableBuildTime(t *time.Time) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) SetNillableBuildTimeStart(t *time.Time) *DbPackageUpdateOne {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
dpuo.SetBuildTime(*t)
|
dpuo.SetBuildTimeStart(*t)
|
||||||
}
|
}
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuildTime clears the value of the "build_time" field.
|
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
||||||
func (dpuo *DbPackageUpdateOne) ClearBuildTime() *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) ClearBuildTimeStart() *DbPackageUpdateOne {
|
||||||
dpuo.mutation.ClearBuildTime()
|
dpuo.mutation.ClearBuildTimeStart()
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildDuration sets the "build_duration" field.
|
// SetBuildTimeEnd sets the "build_time_end" field.
|
||||||
func (dpuo *DbPackageUpdateOne) SetBuildDuration(u uint64) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) SetBuildTimeEnd(t time.Time) *DbPackageUpdateOne {
|
||||||
dpuo.mutation.ResetBuildDuration()
|
dpuo.mutation.SetBuildTimeEnd(t)
|
||||||
dpuo.mutation.SetBuildDuration(u)
|
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNillableBuildDuration sets the "build_duration" field if the given value is not nil.
|
// SetNillableBuildTimeEnd sets the "build_time_end" field if the given value is not nil.
|
||||||
func (dpuo *DbPackageUpdateOne) SetNillableBuildDuration(u *uint64) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) SetNillableBuildTimeEnd(t *time.Time) *DbPackageUpdateOne {
|
||||||
if u != nil {
|
if t != nil {
|
||||||
dpuo.SetBuildDuration(*u)
|
dpuo.SetBuildTimeEnd(*t)
|
||||||
}
|
}
|
||||||
return dpuo
|
return dpuo
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddBuildDuration adds u to the "build_duration" field.
|
// ClearBuildTimeEnd clears the value of the "build_time_end" field.
|
||||||
func (dpuo *DbPackageUpdateOne) AddBuildDuration(u uint64) *DbPackageUpdateOne {
|
func (dpuo *DbPackageUpdateOne) ClearBuildTimeEnd() *DbPackageUpdateOne {
|
||||||
dpuo.mutation.AddBuildDuration(u)
|
dpuo.mutation.ClearBuildTimeEnd()
|
||||||
return dpuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearBuildDuration clears the value of the "build_duration" field.
|
|
||||||
func (dpuo *DbPackageUpdateOne) ClearBuildDuration() *DbPackageUpdateOne {
|
|
||||||
dpuo.mutation.ClearBuildDuration()
|
|
||||||
return dpuo
|
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)}
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -824,15 +790,14 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
|
|||||||
}
|
}
|
||||||
if value, ok := dpuo.mutation.Status(); ok {
|
if value, ok := dpuo.mutation.Status(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeInt,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldStatus,
|
Column: dbpackage.FieldStatus,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := dpuo.mutation.AddedStatus(); ok {
|
if dpuo.mutation.StatusCleared() {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeInt,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
|
||||||
Column: dbpackage.FieldStatus,
|
Column: dbpackage.FieldStatus,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -851,7 +816,7 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
|
|||||||
}
|
}
|
||||||
if value, ok := dpuo.mutation.Repository(); ok {
|
if value, ok := dpuo.mutation.Repository(); ok {
|
||||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeString,
|
Type: field.TypeEnum,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldRepository,
|
Column: dbpackage.FieldRepository,
|
||||||
})
|
})
|
||||||
@@ -889,37 +854,30 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
|
|||||||
Column: dbpackage.FieldRepoVersion,
|
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{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeTime,
|
Type: field.TypeTime,
|
||||||
Value: value,
|
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{
|
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeTime,
|
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{
|
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeUint64,
|
Type: field.TypeTime,
|
||||||
Value: value,
|
Value: value,
|
||||||
Column: dbpackage.FieldBuildDuration,
|
Column: dbpackage.FieldBuildTimeEnd,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := dpuo.mutation.AddedBuildDuration(); ok {
|
if dpuo.mutation.BuildTimeEndCleared() {
|
||||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUint64,
|
|
||||||
Value: value,
|
|
||||||
Column: dbpackage.FieldBuildDuration,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if dpuo.mutation.BuildDurationCleared() {
|
|
||||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||||
Type: field.TypeUint64,
|
Type: field.TypeTime,
|
||||||
Column: dbpackage.FieldBuildDuration,
|
Column: dbpackage.FieldBuildTimeEnd,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if value, ok := dpuo.mutation.Updated(); ok {
|
if value, ok := dpuo.mutation.Updated(); ok {
|
||||||
|
3
ent/generate.go
Normal file
3
ent/generate.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
package ent
|
||||||
|
|
||||||
|
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate --feature sql/modifier ./schema
|
@@ -13,14 +13,14 @@ var (
|
|||||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||||
{Name: "pkgbase", Type: field.TypeString, Unique: true},
|
{Name: "pkgbase", Type: field.TypeString, Unique: true},
|
||||||
{Name: "packages", Type: field.TypeJSON, Nullable: true},
|
{Name: "packages", Type: field.TypeJSON, Nullable: true},
|
||||||
{Name: "status", Type: field.TypeInt, Default: 6},
|
{Name: "status", Type: field.TypeEnum, Nullable: true, Enums: []string{"skipped", "failed", "build", "queued", "building", "latest", "signing", "unknown"}, Default: "unknown"},
|
||||||
{Name: "skip_reason", Type: field.TypeString, Nullable: true},
|
{Name: "skip_reason", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "repository", Type: field.TypeString},
|
{Name: "repository", Type: field.TypeEnum, Enums: []string{"extra", "core", "community"}},
|
||||||
{Name: "march", Type: field.TypeString},
|
{Name: "march", Type: field.TypeString},
|
||||||
{Name: "version", Type: field.TypeString, Nullable: true},
|
{Name: "version", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "repo_version", Type: field.TypeString, Nullable: true},
|
{Name: "repo_version", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "build_time", Type: field.TypeTime, Nullable: true},
|
{Name: "build_time_start", Type: field.TypeTime, Nullable: true},
|
||||||
{Name: "build_duration", Type: field.TypeUint64, Nullable: true},
|
{Name: "build_time_end", Type: field.TypeTime, Nullable: true},
|
||||||
{Name: "updated", Type: field.TypeTime, Nullable: true},
|
{Name: "updated", Type: field.TypeTime, Nullable: true},
|
||||||
{Name: "hash", Type: field.TypeString, Nullable: true},
|
{Name: "hash", Type: field.TypeString, Nullable: true},
|
||||||
}
|
}
|
||||||
|
261
ent/mutation.go
261
ent/mutation.go
@@ -34,16 +34,14 @@ type DbPackageMutation struct {
|
|||||||
id *int
|
id *int
|
||||||
pkgbase *string
|
pkgbase *string
|
||||||
packages *[]string
|
packages *[]string
|
||||||
status *int
|
status *dbpackage.Status
|
||||||
addstatus *int
|
|
||||||
skip_reason *string
|
skip_reason *string
|
||||||
repository *string
|
repository *dbpackage.Repository
|
||||||
march *string
|
march *string
|
||||||
version *string
|
version *string
|
||||||
repo_version *string
|
repo_version *string
|
||||||
build_time *time.Time
|
build_time_start *time.Time
|
||||||
build_duration *uint64
|
build_time_end *time.Time
|
||||||
addbuild_duration *uint64
|
|
||||||
updated *time.Time
|
updated *time.Time
|
||||||
hash *string
|
hash *string
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
@@ -217,13 +215,12 @@ func (m *DbPackageMutation) ResetPackages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetStatus sets the "status" field.
|
// SetStatus sets the "status" field.
|
||||||
func (m *DbPackageMutation) SetStatus(i int) {
|
func (m *DbPackageMutation) SetStatus(d dbpackage.Status) {
|
||||||
m.status = &i
|
m.status = &d
|
||||||
m.addstatus = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status returns the value of the "status" field in the mutation.
|
// Status returns the value of the "status" field in the mutation.
|
||||||
func (m *DbPackageMutation) Status() (r int, exists bool) {
|
func (m *DbPackageMutation) Status() (r dbpackage.Status, exists bool) {
|
||||||
v := m.status
|
v := m.status
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return
|
return
|
||||||
@@ -234,7 +231,7 @@ func (m *DbPackageMutation) Status() (r int, exists bool) {
|
|||||||
// OldStatus returns the old "status" field's value of the DbPackage entity.
|
// OldStatus returns the old "status" field's value of the DbPackage entity.
|
||||||
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
||||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||||
func (m *DbPackageMutation) OldStatus(ctx context.Context) (v int, err error) {
|
func (m *DbPackageMutation) OldStatus(ctx context.Context) (v dbpackage.Status, err error) {
|
||||||
if !m.op.Is(OpUpdateOne) {
|
if !m.op.Is(OpUpdateOne) {
|
||||||
return v, fmt.Errorf("OldStatus is only allowed on UpdateOne operations")
|
return v, fmt.Errorf("OldStatus is only allowed on UpdateOne operations")
|
||||||
}
|
}
|
||||||
@@ -248,28 +245,22 @@ func (m *DbPackageMutation) OldStatus(ctx context.Context) (v int, err error) {
|
|||||||
return oldValue.Status, nil
|
return oldValue.Status, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddStatus adds i to the "status" field.
|
// ClearStatus clears the value of the "status" field.
|
||||||
func (m *DbPackageMutation) AddStatus(i int) {
|
func (m *DbPackageMutation) ClearStatus() {
|
||||||
if m.addstatus != nil {
|
m.status = nil
|
||||||
*m.addstatus += i
|
m.clearedFields[dbpackage.FieldStatus] = struct{}{}
|
||||||
} else {
|
|
||||||
m.addstatus = &i
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddedStatus returns the value that was added to the "status" field in this mutation.
|
// StatusCleared returns if the "status" field was cleared in this mutation.
|
||||||
func (m *DbPackageMutation) AddedStatus() (r int, exists bool) {
|
func (m *DbPackageMutation) StatusCleared() bool {
|
||||||
v := m.addstatus
|
_, ok := m.clearedFields[dbpackage.FieldStatus]
|
||||||
if v == nil {
|
return ok
|
||||||
return
|
|
||||||
}
|
|
||||||
return *v, true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetStatus resets all changes to the "status" field.
|
// ResetStatus resets all changes to the "status" field.
|
||||||
func (m *DbPackageMutation) ResetStatus() {
|
func (m *DbPackageMutation) ResetStatus() {
|
||||||
m.status = nil
|
m.status = nil
|
||||||
m.addstatus = nil
|
delete(m.clearedFields, dbpackage.FieldStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSkipReason sets the "skip_reason" field.
|
// SetSkipReason sets the "skip_reason" field.
|
||||||
@@ -322,12 +313,12 @@ func (m *DbPackageMutation) ResetSkipReason() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetRepository sets the "repository" field.
|
// SetRepository sets the "repository" field.
|
||||||
func (m *DbPackageMutation) SetRepository(s string) {
|
func (m *DbPackageMutation) SetRepository(d dbpackage.Repository) {
|
||||||
m.repository = &s
|
m.repository = &d
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repository returns the value of the "repository" field in the mutation.
|
// Repository returns the value of the "repository" field in the mutation.
|
||||||
func (m *DbPackageMutation) Repository() (r string, exists bool) {
|
func (m *DbPackageMutation) Repository() (r dbpackage.Repository, exists bool) {
|
||||||
v := m.repository
|
v := m.repository
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return
|
return
|
||||||
@@ -338,7 +329,7 @@ func (m *DbPackageMutation) Repository() (r string, exists bool) {
|
|||||||
// OldRepository returns the old "repository" field's value of the DbPackage entity.
|
// OldRepository returns the old "repository" field's value of the DbPackage entity.
|
||||||
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
||||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||||
func (m *DbPackageMutation) OldRepository(ctx context.Context) (v string, err error) {
|
func (m *DbPackageMutation) OldRepository(ctx context.Context) (v dbpackage.Repository, err error) {
|
||||||
if !m.op.Is(OpUpdateOne) {
|
if !m.op.Is(OpUpdateOne) {
|
||||||
return v, fmt.Errorf("OldRepository is only allowed on UpdateOne operations")
|
return v, fmt.Errorf("OldRepository is only allowed on UpdateOne operations")
|
||||||
}
|
}
|
||||||
@@ -491,123 +482,102 @@ func (m *DbPackageMutation) ResetRepoVersion() {
|
|||||||
delete(m.clearedFields, dbpackage.FieldRepoVersion)
|
delete(m.clearedFields, dbpackage.FieldRepoVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildTime sets the "build_time" field.
|
// SetBuildTimeStart sets the "build_time_start" field.
|
||||||
func (m *DbPackageMutation) SetBuildTime(t time.Time) {
|
func (m *DbPackageMutation) SetBuildTimeStart(t time.Time) {
|
||||||
m.build_time = &t
|
m.build_time_start = &t
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildTime returns the value of the "build_time" field in the mutation.
|
// BuildTimeStart returns the value of the "build_time_start" field in the mutation.
|
||||||
func (m *DbPackageMutation) BuildTime() (r time.Time, exists bool) {
|
func (m *DbPackageMutation) BuildTimeStart() (r time.Time, exists bool) {
|
||||||
v := m.build_time
|
v := m.build_time_start
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return *v, true
|
return *v, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// OldBuildTime returns the old "build_time" field's value of the DbPackage entity.
|
// OldBuildTimeStart returns the old "build_time_start" field's value of the DbPackage entity.
|
||||||
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
||||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||||
func (m *DbPackageMutation) OldBuildTime(ctx context.Context) (v time.Time, err error) {
|
func (m *DbPackageMutation) OldBuildTimeStart(ctx context.Context) (v time.Time, err error) {
|
||||||
if !m.op.Is(OpUpdateOne) {
|
if !m.op.Is(OpUpdateOne) {
|
||||||
return v, fmt.Errorf("OldBuildTime is only allowed on UpdateOne operations")
|
return v, fmt.Errorf("OldBuildTimeStart is only allowed on UpdateOne operations")
|
||||||
}
|
}
|
||||||
if m.id == nil || m.oldValue == nil {
|
if m.id == nil || m.oldValue == nil {
|
||||||
return v, fmt.Errorf("OldBuildTime requires an ID field in the mutation")
|
return v, fmt.Errorf("OldBuildTimeStart requires an ID field in the mutation")
|
||||||
}
|
}
|
||||||
oldValue, err := m.oldValue(ctx)
|
oldValue, err := m.oldValue(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return v, fmt.Errorf("querying old value for OldBuildTime: %w", err)
|
return v, fmt.Errorf("querying old value for OldBuildTimeStart: %w", err)
|
||||||
}
|
}
|
||||||
return oldValue.BuildTime, nil
|
return oldValue.BuildTimeStart, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearBuildTime clears the value of the "build_time" field.
|
// ClearBuildTimeStart clears the value of the "build_time_start" field.
|
||||||
func (m *DbPackageMutation) ClearBuildTime() {
|
func (m *DbPackageMutation) ClearBuildTimeStart() {
|
||||||
m.build_time = nil
|
m.build_time_start = nil
|
||||||
m.clearedFields[dbpackage.FieldBuildTime] = struct{}{}
|
m.clearedFields[dbpackage.FieldBuildTimeStart] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildTimeCleared returns if the "build_time" field was cleared in this mutation.
|
// BuildTimeStartCleared returns if the "build_time_start" field was cleared in this mutation.
|
||||||
func (m *DbPackageMutation) BuildTimeCleared() bool {
|
func (m *DbPackageMutation) BuildTimeStartCleared() bool {
|
||||||
_, ok := m.clearedFields[dbpackage.FieldBuildTime]
|
_, ok := m.clearedFields[dbpackage.FieldBuildTimeStart]
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetBuildTime resets all changes to the "build_time" field.
|
// ResetBuildTimeStart resets all changes to the "build_time_start" field.
|
||||||
func (m *DbPackageMutation) ResetBuildTime() {
|
func (m *DbPackageMutation) ResetBuildTimeStart() {
|
||||||
m.build_time = nil
|
m.build_time_start = nil
|
||||||
delete(m.clearedFields, dbpackage.FieldBuildTime)
|
delete(m.clearedFields, dbpackage.FieldBuildTimeStart)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBuildDuration sets the "build_duration" field.
|
// SetBuildTimeEnd sets the "build_time_end" field.
|
||||||
func (m *DbPackageMutation) SetBuildDuration(u uint64) {
|
func (m *DbPackageMutation) SetBuildTimeEnd(t time.Time) {
|
||||||
m.build_duration = &u
|
m.build_time_end = &t
|
||||||
m.addbuild_duration = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildDuration returns the value of the "build_duration" field in the mutation.
|
// BuildTimeEnd returns the value of the "build_time_end" field in the mutation.
|
||||||
func (m *DbPackageMutation) BuildDuration() (r uint64, exists bool) {
|
func (m *DbPackageMutation) BuildTimeEnd() (r time.Time, exists bool) {
|
||||||
v := m.build_duration
|
v := m.build_time_end
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return *v, true
|
return *v, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// OldBuildDuration returns the old "build_duration" field's value of the DbPackage entity.
|
// OldBuildTimeEnd returns the old "build_time_end" field's value of the DbPackage entity.
|
||||||
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
|
||||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||||
func (m *DbPackageMutation) OldBuildDuration(ctx context.Context) (v uint64, err error) {
|
func (m *DbPackageMutation) OldBuildTimeEnd(ctx context.Context) (v time.Time, err error) {
|
||||||
if !m.op.Is(OpUpdateOne) {
|
if !m.op.Is(OpUpdateOne) {
|
||||||
return v, fmt.Errorf("OldBuildDuration is only allowed on UpdateOne operations")
|
return v, fmt.Errorf("OldBuildTimeEnd is only allowed on UpdateOne operations")
|
||||||
}
|
}
|
||||||
if m.id == nil || m.oldValue == nil {
|
if m.id == nil || m.oldValue == nil {
|
||||||
return v, fmt.Errorf("OldBuildDuration requires an ID field in the mutation")
|
return v, fmt.Errorf("OldBuildTimeEnd requires an ID field in the mutation")
|
||||||
}
|
}
|
||||||
oldValue, err := m.oldValue(ctx)
|
oldValue, err := m.oldValue(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return v, fmt.Errorf("querying old value for OldBuildDuration: %w", err)
|
return v, fmt.Errorf("querying old value for OldBuildTimeEnd: %w", err)
|
||||||
}
|
}
|
||||||
return oldValue.BuildDuration, nil
|
return oldValue.BuildTimeEnd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddBuildDuration adds u to the "build_duration" field.
|
// ClearBuildTimeEnd clears the value of the "build_time_end" field.
|
||||||
func (m *DbPackageMutation) AddBuildDuration(u uint64) {
|
func (m *DbPackageMutation) ClearBuildTimeEnd() {
|
||||||
if m.addbuild_duration != nil {
|
m.build_time_end = nil
|
||||||
*m.addbuild_duration += u
|
m.clearedFields[dbpackage.FieldBuildTimeEnd] = struct{}{}
|
||||||
} else {
|
|
||||||
m.addbuild_duration = &u
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddedBuildDuration returns the value that was added to the "build_duration" field in this mutation.
|
// BuildTimeEndCleared returns if the "build_time_end" field was cleared in this mutation.
|
||||||
func (m *DbPackageMutation) AddedBuildDuration() (r uint64, exists bool) {
|
func (m *DbPackageMutation) BuildTimeEndCleared() bool {
|
||||||
v := m.addbuild_duration
|
_, ok := m.clearedFields[dbpackage.FieldBuildTimeEnd]
|
||||||
if v == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return *v, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearBuildDuration clears the value of the "build_duration" field.
|
|
||||||
func (m *DbPackageMutation) ClearBuildDuration() {
|
|
||||||
m.build_duration = nil
|
|
||||||
m.addbuild_duration = nil
|
|
||||||
m.clearedFields[dbpackage.FieldBuildDuration] = struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// BuildDurationCleared returns if the "build_duration" field was cleared in this mutation.
|
|
||||||
func (m *DbPackageMutation) BuildDurationCleared() bool {
|
|
||||||
_, ok := m.clearedFields[dbpackage.FieldBuildDuration]
|
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetBuildDuration resets all changes to the "build_duration" field.
|
// ResetBuildTimeEnd resets all changes to the "build_time_end" field.
|
||||||
func (m *DbPackageMutation) ResetBuildDuration() {
|
func (m *DbPackageMutation) ResetBuildTimeEnd() {
|
||||||
m.build_duration = nil
|
m.build_time_end = nil
|
||||||
m.addbuild_duration = nil
|
delete(m.clearedFields, dbpackage.FieldBuildTimeEnd)
|
||||||
delete(m.clearedFields, dbpackage.FieldBuildDuration)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetUpdated sets the "updated" field.
|
// SetUpdated sets the "updated" field.
|
||||||
@@ -752,11 +722,11 @@ func (m *DbPackageMutation) Fields() []string {
|
|||||||
if m.repo_version != nil {
|
if m.repo_version != nil {
|
||||||
fields = append(fields, dbpackage.FieldRepoVersion)
|
fields = append(fields, dbpackage.FieldRepoVersion)
|
||||||
}
|
}
|
||||||
if m.build_time != nil {
|
if m.build_time_start != nil {
|
||||||
fields = append(fields, dbpackage.FieldBuildTime)
|
fields = append(fields, dbpackage.FieldBuildTimeStart)
|
||||||
}
|
}
|
||||||
if m.build_duration != nil {
|
if m.build_time_end != nil {
|
||||||
fields = append(fields, dbpackage.FieldBuildDuration)
|
fields = append(fields, dbpackage.FieldBuildTimeEnd)
|
||||||
}
|
}
|
||||||
if m.updated != nil {
|
if m.updated != nil {
|
||||||
fields = append(fields, dbpackage.FieldUpdated)
|
fields = append(fields, dbpackage.FieldUpdated)
|
||||||
@@ -788,10 +758,10 @@ func (m *DbPackageMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.Version()
|
return m.Version()
|
||||||
case dbpackage.FieldRepoVersion:
|
case dbpackage.FieldRepoVersion:
|
||||||
return m.RepoVersion()
|
return m.RepoVersion()
|
||||||
case dbpackage.FieldBuildTime:
|
case dbpackage.FieldBuildTimeStart:
|
||||||
return m.BuildTime()
|
return m.BuildTimeStart()
|
||||||
case dbpackage.FieldBuildDuration:
|
case dbpackage.FieldBuildTimeEnd:
|
||||||
return m.BuildDuration()
|
return m.BuildTimeEnd()
|
||||||
case dbpackage.FieldUpdated:
|
case dbpackage.FieldUpdated:
|
||||||
return m.Updated()
|
return m.Updated()
|
||||||
case dbpackage.FieldHash:
|
case dbpackage.FieldHash:
|
||||||
@@ -821,10 +791,10 @@ func (m *DbPackageMutation) OldField(ctx context.Context, name string) (ent.Valu
|
|||||||
return m.OldVersion(ctx)
|
return m.OldVersion(ctx)
|
||||||
case dbpackage.FieldRepoVersion:
|
case dbpackage.FieldRepoVersion:
|
||||||
return m.OldRepoVersion(ctx)
|
return m.OldRepoVersion(ctx)
|
||||||
case dbpackage.FieldBuildTime:
|
case dbpackage.FieldBuildTimeStart:
|
||||||
return m.OldBuildTime(ctx)
|
return m.OldBuildTimeStart(ctx)
|
||||||
case dbpackage.FieldBuildDuration:
|
case dbpackage.FieldBuildTimeEnd:
|
||||||
return m.OldBuildDuration(ctx)
|
return m.OldBuildTimeEnd(ctx)
|
||||||
case dbpackage.FieldUpdated:
|
case dbpackage.FieldUpdated:
|
||||||
return m.OldUpdated(ctx)
|
return m.OldUpdated(ctx)
|
||||||
case dbpackage.FieldHash:
|
case dbpackage.FieldHash:
|
||||||
@@ -853,7 +823,7 @@ func (m *DbPackageMutation) SetField(name string, value ent.Value) error {
|
|||||||
m.SetPackages(v)
|
m.SetPackages(v)
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldStatus:
|
case dbpackage.FieldStatus:
|
||||||
v, ok := value.(int)
|
v, ok := value.(dbpackage.Status)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
}
|
}
|
||||||
@@ -867,7 +837,7 @@ func (m *DbPackageMutation) SetField(name string, value ent.Value) error {
|
|||||||
m.SetSkipReason(v)
|
m.SetSkipReason(v)
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldRepository:
|
case dbpackage.FieldRepository:
|
||||||
v, ok := value.(string)
|
v, ok := value.(dbpackage.Repository)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
}
|
}
|
||||||
@@ -894,19 +864,19 @@ func (m *DbPackageMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetRepoVersion(v)
|
m.SetRepoVersion(v)
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldBuildTime:
|
case dbpackage.FieldBuildTimeStart:
|
||||||
v, ok := value.(time.Time)
|
v, ok := value.(time.Time)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
}
|
}
|
||||||
m.SetBuildTime(v)
|
m.SetBuildTimeStart(v)
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldBuildDuration:
|
case dbpackage.FieldBuildTimeEnd:
|
||||||
v, ok := value.(uint64)
|
v, ok := value.(time.Time)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
}
|
}
|
||||||
m.SetBuildDuration(v)
|
m.SetBuildTimeEnd(v)
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldUpdated:
|
case dbpackage.FieldUpdated:
|
||||||
v, ok := value.(time.Time)
|
v, ok := value.(time.Time)
|
||||||
@@ -929,26 +899,13 @@ func (m *DbPackageMutation) SetField(name string, value ent.Value) error {
|
|||||||
// AddedFields returns all numeric fields that were incremented/decremented during
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
||||||
// this mutation.
|
// this mutation.
|
||||||
func (m *DbPackageMutation) AddedFields() []string {
|
func (m *DbPackageMutation) AddedFields() []string {
|
||||||
var fields []string
|
return nil
|
||||||
if m.addstatus != nil {
|
|
||||||
fields = append(fields, dbpackage.FieldStatus)
|
|
||||||
}
|
|
||||||
if m.addbuild_duration != nil {
|
|
||||||
fields = append(fields, dbpackage.FieldBuildDuration)
|
|
||||||
}
|
|
||||||
return fields
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddedField returns the numeric value that was incremented/decremented on a field
|
// AddedField returns the numeric value that was incremented/decremented on a field
|
||||||
// with the given name. The second boolean return value indicates that this field
|
// with the given name. The second boolean return value indicates that this field
|
||||||
// was not set, or was not defined in the schema.
|
// was not set, or was not defined in the schema.
|
||||||
func (m *DbPackageMutation) AddedField(name string) (ent.Value, bool) {
|
func (m *DbPackageMutation) AddedField(name string) (ent.Value, bool) {
|
||||||
switch name {
|
|
||||||
case dbpackage.FieldStatus:
|
|
||||||
return m.AddedStatus()
|
|
||||||
case dbpackage.FieldBuildDuration:
|
|
||||||
return m.AddedBuildDuration()
|
|
||||||
}
|
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -957,20 +914,6 @@ func (m *DbPackageMutation) AddedField(name string) (ent.Value, bool) {
|
|||||||
// type.
|
// type.
|
||||||
func (m *DbPackageMutation) AddField(name string, value ent.Value) error {
|
func (m *DbPackageMutation) AddField(name string, value ent.Value) error {
|
||||||
switch name {
|
switch name {
|
||||||
case dbpackage.FieldStatus:
|
|
||||||
v, ok := value.(int)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
||||||
}
|
|
||||||
m.AddStatus(v)
|
|
||||||
return nil
|
|
||||||
case dbpackage.FieldBuildDuration:
|
|
||||||
v, ok := value.(uint64)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
||||||
}
|
|
||||||
m.AddBuildDuration(v)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown DbPackage numeric field %s", name)
|
return fmt.Errorf("unknown DbPackage numeric field %s", name)
|
||||||
}
|
}
|
||||||
@@ -982,6 +925,9 @@ func (m *DbPackageMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(dbpackage.FieldPackages) {
|
if m.FieldCleared(dbpackage.FieldPackages) {
|
||||||
fields = append(fields, dbpackage.FieldPackages)
|
fields = append(fields, dbpackage.FieldPackages)
|
||||||
}
|
}
|
||||||
|
if m.FieldCleared(dbpackage.FieldStatus) {
|
||||||
|
fields = append(fields, dbpackage.FieldStatus)
|
||||||
|
}
|
||||||
if m.FieldCleared(dbpackage.FieldSkipReason) {
|
if m.FieldCleared(dbpackage.FieldSkipReason) {
|
||||||
fields = append(fields, dbpackage.FieldSkipReason)
|
fields = append(fields, dbpackage.FieldSkipReason)
|
||||||
}
|
}
|
||||||
@@ -991,11 +937,11 @@ func (m *DbPackageMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(dbpackage.FieldRepoVersion) {
|
if m.FieldCleared(dbpackage.FieldRepoVersion) {
|
||||||
fields = append(fields, dbpackage.FieldRepoVersion)
|
fields = append(fields, dbpackage.FieldRepoVersion)
|
||||||
}
|
}
|
||||||
if m.FieldCleared(dbpackage.FieldBuildTime) {
|
if m.FieldCleared(dbpackage.FieldBuildTimeStart) {
|
||||||
fields = append(fields, dbpackage.FieldBuildTime)
|
fields = append(fields, dbpackage.FieldBuildTimeStart)
|
||||||
}
|
}
|
||||||
if m.FieldCleared(dbpackage.FieldBuildDuration) {
|
if m.FieldCleared(dbpackage.FieldBuildTimeEnd) {
|
||||||
fields = append(fields, dbpackage.FieldBuildDuration)
|
fields = append(fields, dbpackage.FieldBuildTimeEnd)
|
||||||
}
|
}
|
||||||
if m.FieldCleared(dbpackage.FieldUpdated) {
|
if m.FieldCleared(dbpackage.FieldUpdated) {
|
||||||
fields = append(fields, dbpackage.FieldUpdated)
|
fields = append(fields, dbpackage.FieldUpdated)
|
||||||
@@ -1020,6 +966,9 @@ func (m *DbPackageMutation) ClearField(name string) error {
|
|||||||
case dbpackage.FieldPackages:
|
case dbpackage.FieldPackages:
|
||||||
m.ClearPackages()
|
m.ClearPackages()
|
||||||
return nil
|
return nil
|
||||||
|
case dbpackage.FieldStatus:
|
||||||
|
m.ClearStatus()
|
||||||
|
return nil
|
||||||
case dbpackage.FieldSkipReason:
|
case dbpackage.FieldSkipReason:
|
||||||
m.ClearSkipReason()
|
m.ClearSkipReason()
|
||||||
return nil
|
return nil
|
||||||
@@ -1029,11 +978,11 @@ func (m *DbPackageMutation) ClearField(name string) error {
|
|||||||
case dbpackage.FieldRepoVersion:
|
case dbpackage.FieldRepoVersion:
|
||||||
m.ClearRepoVersion()
|
m.ClearRepoVersion()
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldBuildTime:
|
case dbpackage.FieldBuildTimeStart:
|
||||||
m.ClearBuildTime()
|
m.ClearBuildTimeStart()
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldBuildDuration:
|
case dbpackage.FieldBuildTimeEnd:
|
||||||
m.ClearBuildDuration()
|
m.ClearBuildTimeEnd()
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldUpdated:
|
case dbpackage.FieldUpdated:
|
||||||
m.ClearUpdated()
|
m.ClearUpdated()
|
||||||
@@ -1073,11 +1022,11 @@ func (m *DbPackageMutation) ResetField(name string) error {
|
|||||||
case dbpackage.FieldRepoVersion:
|
case dbpackage.FieldRepoVersion:
|
||||||
m.ResetRepoVersion()
|
m.ResetRepoVersion()
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldBuildTime:
|
case dbpackage.FieldBuildTimeStart:
|
||||||
m.ResetBuildTime()
|
m.ResetBuildTimeStart()
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldBuildDuration:
|
case dbpackage.FieldBuildTimeEnd:
|
||||||
m.ResetBuildDuration()
|
m.ResetBuildTimeEnd()
|
||||||
return nil
|
return nil
|
||||||
case dbpackage.FieldUpdated:
|
case dbpackage.FieldUpdated:
|
||||||
m.ResetUpdated()
|
m.ResetUpdated()
|
||||||
|
@@ -17,22 +17,8 @@ func init() {
|
|||||||
dbpackageDescPkgbase := dbpackageFields[0].Descriptor()
|
dbpackageDescPkgbase := dbpackageFields[0].Descriptor()
|
||||||
// dbpackage.PkgbaseValidator is a validator for the "pkgbase" field. It is called by the builders before save.
|
// dbpackage.PkgbaseValidator is a validator for the "pkgbase" field. It is called by the builders before save.
|
||||||
dbpackage.PkgbaseValidator = dbpackageDescPkgbase.Validators[0].(func(string) error)
|
dbpackage.PkgbaseValidator = dbpackageDescPkgbase.Validators[0].(func(string) error)
|
||||||
// dbpackageDescStatus is the schema descriptor for status field.
|
|
||||||
dbpackageDescStatus := dbpackageFields[2].Descriptor()
|
|
||||||
// dbpackage.DefaultStatus holds the default value on creation for the status field.
|
|
||||||
dbpackage.DefaultStatus = dbpackageDescStatus.Default.(int)
|
|
||||||
// dbpackage.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
|
||||||
dbpackage.StatusValidator = dbpackageDescStatus.Validators[0].(func(int) error)
|
|
||||||
// dbpackageDescRepository is the schema descriptor for repository field.
|
|
||||||
dbpackageDescRepository := dbpackageFields[4].Descriptor()
|
|
||||||
// dbpackage.RepositoryValidator is a validator for the "repository" field. It is called by the builders before save.
|
|
||||||
dbpackage.RepositoryValidator = dbpackageDescRepository.Validators[0].(func(string) error)
|
|
||||||
// dbpackageDescMarch is the schema descriptor for march field.
|
// dbpackageDescMarch is the schema descriptor for march field.
|
||||||
dbpackageDescMarch := dbpackageFields[5].Descriptor()
|
dbpackageDescMarch := dbpackageFields[5].Descriptor()
|
||||||
// dbpackage.MarchValidator is a validator for the "march" field. It is called by the builders before save.
|
// dbpackage.MarchValidator is a validator for the "march" field. It is called by the builders before save.
|
||||||
dbpackage.MarchValidator = dbpackageDescMarch.Validators[0].(func(string) error)
|
dbpackage.MarchValidator = dbpackageDescMarch.Validators[0].(func(string) error)
|
||||||
// dbpackageDescBuildDuration is the schema descriptor for build_duration field.
|
|
||||||
dbpackageDescBuildDuration := dbpackageFields[9].Descriptor()
|
|
||||||
// dbpackage.BuildDurationValidator is a validator for the "build_duration" field. It is called by the builders before save.
|
|
||||||
dbpackage.BuildDurationValidator = dbpackageDescBuildDuration.Validators[0].(func(uint64) error)
|
|
||||||
}
|
}
|
||||||
|
@@ -15,14 +15,14 @@ func (DbPackage) Fields() []ent.Field {
|
|||||||
return []ent.Field{
|
return []ent.Field{
|
||||||
field.String("pkgbase").NotEmpty().Immutable().Unique(),
|
field.String("pkgbase").NotEmpty().Immutable().Unique(),
|
||||||
field.Strings("packages").Optional(),
|
field.Strings("packages").Optional(),
|
||||||
field.Int("status").Min(0).Default(6),
|
field.Enum("status").Values("skipped", "failed", "build", "queued", "building", "latest", "signing", "unknown").Default("unknown").Optional(),
|
||||||
field.String("skip_reason").Optional(),
|
field.String("skip_reason").Optional(),
|
||||||
field.String("repository").NotEmpty(),
|
field.Enum("repository").Values("extra", "core", "community"),
|
||||||
field.String("march").NotEmpty(),
|
field.String("march").NotEmpty(),
|
||||||
field.String("version").Optional(),
|
field.String("version").Optional(),
|
||||||
field.String("repo_version").Optional(),
|
field.String("repo_version").Optional(),
|
||||||
field.Time("build_time").Optional(),
|
field.Time("build_time_start").Optional(),
|
||||||
field.Uint64("build_duration").Positive().Optional(),
|
field.Time("build_time_end").Optional(),
|
||||||
field.Time("updated").Optional(),
|
field.Time("updated").Optional(),
|
||||||
field.String("hash").Optional(),
|
field.String("hash").Optional(),
|
||||||
}
|
}
|
||||||
|
89
main.go
89
main.go
@@ -22,7 +22,6 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -36,7 +35,6 @@ var (
|
|||||||
rePkgFile = regexp.MustCompile(`^(.*)-.*-.*-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`)
|
rePkgFile = regexp.MustCompile(`^(.*)-.*-.*-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`)
|
||||||
buildManager BuildManager
|
buildManager BuildManager
|
||||||
db *ent.Client
|
db *ent.Client
|
||||||
dbLock sync.RWMutex
|
|
||||||
journalLog = flag.Bool("journal", false, "Log to systemd journal instead of stdout")
|
journalLog = flag.Bool("journal", false, "Log to systemd journal instead of stdout")
|
||||||
checkInterval = flag.Int("interval", 5, "How often svn2git should be checked in minutes (default: 5)")
|
checkInterval = flag.Int("interval", 5, "How often svn2git should be checked in minutes (default: 5)")
|
||||||
)
|
)
|
||||||
@@ -62,9 +60,7 @@ func (b *BuildManager) buildWorker(id int) {
|
|||||||
log.Infof("[%s/%s] Build starting", pkg.FullRepo, pkg.Pkgbase)
|
log.Infof("[%s/%s] Build starting", pkg.FullRepo, pkg.Pkgbase)
|
||||||
|
|
||||||
dbPkg := getDbPackage(pkg)
|
dbPkg := getDbPackage(pkg)
|
||||||
dbLock.Lock()
|
dbPkg = dbPkg.Update().SetStatus(dbpackage.StatusBuilding).SetBuildTimeStart(time.Now().UTC()).SetSkipReason("").SaveX(context.Background())
|
||||||
dbPkg.Update().SetStatus(BUILDING).SetBuildTime(time.Now().UTC()).SetSkipReason("").SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
err := importKeys(pkg)
|
err := importKeys(pkg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -124,10 +120,7 @@ func (b *BuildManager) buildWorker(id int) {
|
|||||||
check(os.MkdirAll(filepath.Join(conf.Basedir.Repo, "logs"), os.ModePerm))
|
check(os.MkdirAll(filepath.Join(conf.Basedir.Repo, "logs"), os.ModePerm))
|
||||||
check(os.WriteFile(filepath.Join(conf.Basedir.Repo, "logs", pkg.Pkgbase+".log"), out.Bytes(), os.ModePerm))
|
check(os.WriteFile(filepath.Join(conf.Basedir.Repo, "logs", pkg.Pkgbase+".log"), out.Bytes(), os.ModePerm))
|
||||||
|
|
||||||
dbPkg := getDbPackage(pkg)
|
dbPkg.Update().SetStatus(dbpackage.StatusFailed).SetBuildTimeEnd(time.Now()).SetHash(pkg.Hash).ExecX(context.Background())
|
||||||
dbLock.Lock()
|
|
||||||
dbPkg.Update().SetStatus(FAILED).SetBuildTime(time.Now()).SetBuildDuration(uint64(time.Now().Sub(start).Milliseconds())).SetHash(pkg.Hash).SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
// purge failed package from repo
|
// purge failed package from repo
|
||||||
b.repoPurge[pkg.FullRepo] <- pkg
|
b.repoPurge[pkg.FullRepo] <- pkg
|
||||||
@@ -180,10 +173,7 @@ func (b *BuildManager) buildWorker(id int) {
|
|||||||
check(os.Remove(filepath.Join(conf.Basedir.Repo, "logs", pkg.Pkgbase+".log")))
|
check(os.Remove(filepath.Join(conf.Basedir.Repo, "logs", pkg.Pkgbase+".log")))
|
||||||
}
|
}
|
||||||
|
|
||||||
dbPkg = getDbPackage(pkg)
|
dbPkg.Update().SetStatus(dbpackage.StatusBuild).SetBuildTimeEnd(time.Now().UTC()).ExecX(context.Background())
|
||||||
dbLock.Lock()
|
|
||||||
dbPkg.Update().SetStatus(BUILD).SetBuildDuration(uint64(time.Now().Sub(start).Milliseconds())).SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
log.Infof("[%s/%s] Build successful (%s)", pkg.FullRepo, pkg.Pkgbase, time.Now().Sub(start))
|
log.Infof("[%s/%s] Build successful (%s)", pkg.FullRepo, pkg.Pkgbase, time.Now().Sub(start))
|
||||||
b.repoAdd[pkg.FullRepo] <- pkg
|
b.repoAdd[pkg.FullRepo] <- pkg
|
||||||
@@ -210,22 +200,16 @@ func (b *BuildManager) parseWorker() {
|
|||||||
pkg.Version = constructVersion(pkg.Srcinfo.Pkgver, pkg.Srcinfo.Pkgrel, pkg.Srcinfo.Epoch)
|
pkg.Version = constructVersion(pkg.Srcinfo.Pkgver, pkg.Srcinfo.Pkgrel, pkg.Srcinfo.Epoch)
|
||||||
|
|
||||||
dbPkg := getDbPackage(pkg)
|
dbPkg := getDbPackage(pkg)
|
||||||
dbLock.Lock()
|
|
||||||
dbPkg = dbPkg.Update().SetUpdated(time.Now()).SetVersion(pkg.Version).SaveX(context.Background())
|
dbPkg = dbPkg.Update().SetUpdated(time.Now()).SetVersion(pkg.Version).SaveX(context.Background())
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
skipping := false
|
skipping := false
|
||||||
if contains(info.Arch, "any") {
|
if contains(info.Arch, "any") {
|
||||||
log.Debugf("Skipped %s: any-Package", info.Pkgbase)
|
log.Debugf("Skipped %s: any-Package", info.Pkgbase)
|
||||||
dbPkg.SkipReason = "arch = any"
|
dbPkg.SkipReason = "arch = any"
|
||||||
dbPkg.Hash = pkg.Hash
|
|
||||||
dbPkg.Status = SKIPPED
|
|
||||||
skipping = true
|
skipping = true
|
||||||
} else if contains(conf.Blacklist.Packages, info.Pkgbase) {
|
} else if contains(conf.Blacklist.Packages, info.Pkgbase) {
|
||||||
log.Debugf("Skipped %s: blacklisted package", info.Pkgbase)
|
log.Debugf("Skipped %s: blacklisted package", info.Pkgbase)
|
||||||
dbPkg.SkipReason = "blacklisted"
|
dbPkg.SkipReason = "blacklisted"
|
||||||
dbPkg.Hash = pkg.Hash
|
|
||||||
dbPkg.Status = SKIPPED
|
|
||||||
skipping = true
|
skipping = true
|
||||||
} else if contains(info.MakeDepends, "ghc") || contains(info.MakeDepends, "haskell-ghc") || contains(info.Depends, "ghc") || contains(info.Depends, "haskell-ghc") {
|
} else if contains(info.MakeDepends, "ghc") || contains(info.MakeDepends, "haskell-ghc") || contains(info.Depends, "ghc") || contains(info.Depends, "haskell-ghc") {
|
||||||
// Skip Haskell packages for now, as we are facing linking problems with them,
|
// Skip Haskell packages for now, as we are facing linking problems with them,
|
||||||
@@ -233,35 +217,25 @@ func (b *BuildManager) parseWorker() {
|
|||||||
// https://git.harting.dev/anonfunc/ALHP.GO/issues/11
|
// https://git.harting.dev/anonfunc/ALHP.GO/issues/11
|
||||||
log.Debugf("Skipped %s: haskell package", info.Pkgbase)
|
log.Debugf("Skipped %s: haskell package", info.Pkgbase)
|
||||||
dbPkg.SkipReason = "blacklisted (haskell)"
|
dbPkg.SkipReason = "blacklisted (haskell)"
|
||||||
dbPkg.Hash = pkg.Hash
|
|
||||||
dbPkg.Status = SKIPPED
|
|
||||||
skipping = true
|
skipping = true
|
||||||
} else if isPkgFailed(pkg) {
|
} else if isPkgFailed(pkg) {
|
||||||
log.Debugf("Skipped %s: failed build", info.Pkgbase)
|
log.Debugf("Skipped %s: failed build", info.Pkgbase)
|
||||||
dbPkg.SkipReason = ""
|
dbPkg.SkipReason = ""
|
||||||
dbPkg.Hash = pkg.Hash
|
|
||||||
dbPkg.Status = FAILED
|
|
||||||
skipping = true
|
skipping = true
|
||||||
}
|
}
|
||||||
dbLock.Lock()
|
|
||||||
dbPkg = dbPkg.Update().SetStatus(dbPkg.Status).SetSkipReason(dbPkg.SkipReason).SetHash(dbPkg.Hash).SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
if skipping {
|
if skipping {
|
||||||
|
dbPkg = dbPkg.Update().SetStatus(dbpackage.StatusSkipped).SetSkipReason(dbPkg.SkipReason).SetHash(pkg.Hash).SaveX(context.Background())
|
||||||
b.repoPurge[pkg.FullRepo] <- pkg
|
b.repoPurge[pkg.FullRepo] <- pkg
|
||||||
b.parseWG.Done()
|
b.parseWG.Done()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
repoVer := getVersionFromRepo(pkg)
|
repoVer := getVersionFromRepo(pkg)
|
||||||
dbLock.Lock()
|
|
||||||
dbPkg = dbPkg.Update().SetRepoVersion(repoVer).SaveX(context.Background())
|
dbPkg = dbPkg.Update().SetRepoVersion(repoVer).SaveX(context.Background())
|
||||||
dbLock.Unlock()
|
|
||||||
if repoVer != "" && alpm.VerCmp(repoVer, pkg.Version) > 0 {
|
if repoVer != "" && alpm.VerCmp(repoVer, pkg.Version) > 0 {
|
||||||
log.Debugf("Skipped %s: Version in repo higher than in PKGBUILD (%s < %s)", info.Pkgbase, pkg.Version, repoVer)
|
log.Debugf("Skipped %s: Version in repo higher than in PKGBUILD (%s < %s)", info.Pkgbase, pkg.Version, repoVer)
|
||||||
dbLock.Lock()
|
dbPkg = dbPkg.Update().SetStatus(dbpackage.StatusLatest).SetSkipReason("").SetHash(pkg.Hash).SaveX(context.Background())
|
||||||
dbPkg = dbPkg.Update().SetStatus(LATEST).SetSkipReason("").SetHash(pkg.Hash).SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
b.parseWG.Done()
|
b.parseWG.Done()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -273,38 +247,28 @@ func (b *BuildManager) parseWorker() {
|
|||||||
log.Warningf("[%s/%s] Problem solving dependencies: %v", pkg.FullRepo, info.Pkgbase, err)
|
log.Warningf("[%s/%s] Problem solving dependencies: %v", pkg.FullRepo, info.Pkgbase, err)
|
||||||
case MultiplePKGBUILDError:
|
case MultiplePKGBUILDError:
|
||||||
log.Debugf("Skipped %s: Multiple PKGBUILDs for dependency found: %v", info.Pkgbase, err)
|
log.Debugf("Skipped %s: Multiple PKGBUILDs for dependency found: %v", info.Pkgbase, err)
|
||||||
dbLock.Lock()
|
dbPkg = dbPkg.Update().SetStatus(dbpackage.StatusSkipped).SetSkipReason("multiple PKGBUILD for dep. found").SaveX(context.Background())
|
||||||
dbPkg = dbPkg.Update().SetStatus(SKIPPED).SetSkipReason("multiple PKGBUILD for dep. found").SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
b.repoPurge[pkg.FullRepo] <- pkg
|
b.repoPurge[pkg.FullRepo] <- pkg
|
||||||
b.parseWG.Done()
|
b.parseWG.Done()
|
||||||
continue
|
continue
|
||||||
case UnableToSatisfyError:
|
case UnableToSatisfyError:
|
||||||
log.Debugf("Skipped %s: unable to resolve dependencies: %v", info.Pkgbase, err)
|
log.Debugf("Skipped %s: unable to resolve dependencies: %v", info.Pkgbase, err)
|
||||||
dbLock.Lock()
|
dbPkg = dbPkg.Update().SetStatus(dbpackage.StatusSkipped).SetSkipReason("unable to resolve dependencies").SaveX(context.Background())
|
||||||
dbPkg = dbPkg.Update().SetStatus(SKIPPED).SetSkipReason("unable to resolve dependencies").SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
b.repoPurge[pkg.FullRepo] <- pkg
|
b.repoPurge[pkg.FullRepo] <- pkg
|
||||||
b.parseWG.Done()
|
b.parseWG.Done()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbLock.Lock()
|
dbPkg = dbPkg.Update().SetStatus(dbpackage.StatusQueued).SaveX(context.Background())
|
||||||
dbPkg = dbPkg.Update().SetStatus(QUEUED).SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
if !isLatest {
|
if !isLatest {
|
||||||
if local != nil {
|
if local != nil {
|
||||||
log.Infof("Delayed %s: not all dependencies are up to date (local: %s==%s, sync: %s==%s)", info.Pkgbase, local.Name(), local.Version(), local.Name(), syncVersion)
|
log.Infof("Delayed %s: not all dependencies are up to date (local: %s==%s, sync: %s==%s)", info.Pkgbase, local.Name(), local.Version(), local.Name(), syncVersion)
|
||||||
dbLock.Lock()
|
dbPkg.Update().SetSkipReason(fmt.Sprintf("waiting for %s==%s", local.Name(), syncVersion)).ExecX(context.Background())
|
||||||
dbPkg = dbPkg.Update().SetSkipReason(fmt.Sprintf("waiting for %s==%s", local.Name(), syncVersion)).SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
} else {
|
} else {
|
||||||
log.Infof("Delayed %s: not all dependencies are up to date or resolvable", info.Pkgbase)
|
log.Infof("Delayed %s: not all dependencies are up to date or resolvable", info.Pkgbase)
|
||||||
dbLock.Lock()
|
dbPkg.Update().SetSkipReason("waiting for mirror").ExecX(context.Background())
|
||||||
dbPkg = dbPkg.Update().SetSkipReason("waiting for mirror").SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purge delayed packages in case delay is caused by inconsistencies in svn2git.
|
// Purge delayed packages in case delay is caused by inconsistencies in svn2git.
|
||||||
@@ -364,9 +328,7 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
Name: repo,
|
Name: repo,
|
||||||
}
|
}
|
||||||
|
|
||||||
dbLock.RLock()
|
pkgs := db.DbPackage.Query().Order(ent.Asc(dbpackage.FieldPkgbase)).Where(dbpackage.MarchEQ(march), dbpackage.RepositoryEQ(dbpackage.Repository(repo))).AllX(context.Background())
|
||||||
pkgs := db.DbPackage.Query().Order(ent.Asc(dbpackage.FieldPkgbase)).Where(dbpackage.MarchEQ(march), dbpackage.RepositoryEQ(repo)).AllX(context.Background())
|
|
||||||
dbLock.RUnlock()
|
|
||||||
|
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
status, class := statusId2string(pkg.Status)
|
status, class := statusId2string(pkg.Status)
|
||||||
@@ -380,21 +342,19 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
Svn2GitVersion: pkg.Version,
|
Svn2GitVersion: pkg.Version,
|
||||||
}
|
}
|
||||||
|
|
||||||
if pkg.BuildDuration > 0 {
|
if !pkg.BuildTimeEnd.IsZero() && !pkg.BuildTimeStart.IsZero() {
|
||||||
duration, err := time.ParseDuration(strconv.Itoa(int(pkg.BuildDuration)) + "ms")
|
addPkg.BuildDuration = pkg.BuildTimeEnd.Sub(pkg.BuildTimeStart)
|
||||||
check(err)
|
|
||||||
addPkg.BuildDuration = duration
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !pkg.BuildTime.IsZero() {
|
if !pkg.BuildTimeStart.IsZero() {
|
||||||
addPkg.BuildDate = pkg.BuildTime.UTC().Format(time.RFC3339)
|
addPkg.BuildDate = pkg.BuildTimeStart.UTC().Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !pkg.Updated.IsZero() {
|
if !pkg.Updated.IsZero() {
|
||||||
addPkg.Checked = pkg.Updated.UTC().Format(time.RFC3339)
|
addPkg.Checked = pkg.Updated.UTC().Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
|
|
||||||
if pkg.Status == FAILED {
|
if pkg.Status == dbpackage.StatusFailed {
|
||||||
addPkg.Log = fmt.Sprintf("logs/%s.log", pkg.Pkgbase)
|
addPkg.Log = fmt.Sprintf("logs/%s.log", pkg.Pkgbase)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,9 +392,7 @@ func (b *BuildManager) repoWorker(repo string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbPkg := getDbPackage(pkg)
|
dbPkg := getDbPackage(pkg)
|
||||||
dbLock.Lock()
|
dbPkg = dbPkg.Update().SetStatus(dbpackage.StatusLatest).SetSkipReason("").SetRepoVersion(pkg.Version).SetHash(pkg.Hash).SaveX(context.Background())
|
||||||
dbPkg = dbPkg.Update().SetStatus(LATEST).SetSkipReason("").SetRepoVersion(pkg.Version).SetHash(pkg.Hash).SaveX(context.Background())
|
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
cmd = exec.Command("paccache",
|
cmd = exec.Command("paccache",
|
||||||
"-rc", filepath.Join(conf.Basedir.Repo, pkg.FullRepo, "os", conf.Arch),
|
"-rc", filepath.Join(conf.Basedir.Repo, pkg.FullRepo, "os", conf.Arch),
|
||||||
@@ -472,9 +430,7 @@ func (b *BuildManager) repoWorker(repo string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbPkg := getDbPackage(pkg)
|
dbPkg := getDbPackage(pkg)
|
||||||
dbLock.Lock()
|
|
||||||
dbPkg = dbPkg.Update().SetRepoVersion("").SaveX(context.Background())
|
dbPkg = dbPkg.Update().SetRepoVersion("").SaveX(context.Background())
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
for _, file := range pkg.PkgFiles {
|
for _, file := range pkg.PkgFiles {
|
||||||
check(os.Remove(file))
|
check(os.Remove(file))
|
||||||
@@ -553,9 +509,10 @@ func (b *BuildManager) syncWorker() {
|
|||||||
|
|
||||||
// compare b3sum of PKGBUILD file to hash in database, only proceed if hash differs
|
// compare b3sum of PKGBUILD file to hash in database, only proceed if hash differs
|
||||||
// reduces the amount of PKGBUILDs that need to be parsed with makepkg, which is _really_ slow, significantly
|
// reduces the amount of PKGBUILDs that need to be parsed with makepkg, which is _really_ slow, significantly
|
||||||
dbLock.RLock()
|
dbPkg, dbErr := db.DbPackage.Query().Where(dbpackage.And(
|
||||||
dbPkg, dbErr := db.DbPackage.Query().Where(dbpackage.And(dbpackage.Pkgbase(sPkgbuild[len(sPkgbuild)-4]), dbpackage.Repository(strings.Split(repo, "-")[0]))).Only(context.Background())
|
dbpackage.Pkgbase(sPkgbuild[len(sPkgbuild)-4]),
|
||||||
dbLock.RUnlock()
|
dbpackage.RepositoryEQ(dbpackage.Repository(strings.Split(repo, "-")[0]))),
|
||||||
|
).Only(context.Background())
|
||||||
|
|
||||||
if dbErr != nil {
|
if dbErr != nil {
|
||||||
switch dbErr.(type) {
|
switch dbErr.(type) {
|
||||||
@@ -581,7 +538,7 @@ func (b *BuildManager) syncWorker() {
|
|||||||
b.parse <- &BuildPackage{
|
b.parse <- &BuildPackage{
|
||||||
Pkgbuild: pkgbuild,
|
Pkgbuild: pkgbuild,
|
||||||
Pkgbase: sPkgbuild[len(sPkgbuild)-4],
|
Pkgbase: sPkgbuild[len(sPkgbuild)-4],
|
||||||
Repo: strings.Split(repo, "-")[0],
|
Repo: dbpackage.Repository(strings.Split(repo, "-")[0]),
|
||||||
March: march,
|
March: march,
|
||||||
FullRepo: strings.Split(repo, "-")[0] + "-" + march,
|
FullRepo: strings.Split(repo, "-")[0] + "-" + march,
|
||||||
Hash: b3s,
|
Hash: b3s,
|
||||||
@@ -621,7 +578,7 @@ func main() {
|
|||||||
err = os.MkdirAll(conf.Basedir.Repo, os.ModePerm)
|
err = os.MkdirAll(conf.Basedir.Repo, os.ModePerm)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
db, err = ent.Open("sqlite3", "file:"+conf.Basedir.Db+"?_fk=1&cache=shared")
|
db, err = ent.Open("sqlite3", "file:"+conf.Basedir.Db+"?_journal_mode=WAL&_fk=1&cache=shared&_sync=NORMAL")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("Failed to open database %s: %v", conf.Basedir.Db, err)
|
log.Panicf("Failed to open database %s: %v", conf.Basedir.Db, err)
|
||||||
}
|
}
|
||||||
|
74
utils.go
74
utils.go
@@ -24,13 +24,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SKIPPED = iota
|
|
||||||
FAILED = iota
|
|
||||||
BUILD = iota
|
|
||||||
QUEUED = iota
|
|
||||||
BUILDING = iota
|
|
||||||
LATEST = iota
|
|
||||||
UNKNOWN = iota
|
|
||||||
pacmanConf = "/usr/share/devtools/pacman-extra.conf"
|
pacmanConf = "/usr/share/devtools/pacman-extra.conf"
|
||||||
makepkgConf = "/usr/share/devtools/makepkg-x86_64.conf"
|
makepkgConf = "/usr/share/devtools/makepkg-x86_64.conf"
|
||||||
logDir = "logs"
|
logDir = "logs"
|
||||||
@@ -42,7 +35,7 @@ type BuildPackage struct {
|
|||||||
Pkgbuild string
|
Pkgbuild string
|
||||||
Srcinfo *srcinfo.Srcinfo
|
Srcinfo *srcinfo.Srcinfo
|
||||||
PkgFiles []string
|
PkgFiles []string
|
||||||
Repo string
|
Repo dbpackage.Repository
|
||||||
March string
|
March string
|
||||||
FullRepo string
|
FullRepo string
|
||||||
Version string
|
Version string
|
||||||
@@ -129,19 +122,19 @@ func containsSubStr(str string, subList []string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func statusId2string(status int) (string, string) {
|
func statusId2string(s dbpackage.Status) (string, string) {
|
||||||
switch status {
|
switch s {
|
||||||
case SKIPPED:
|
case dbpackage.StatusSkipped:
|
||||||
return "SKIPPED", "table-" + conf.Status.Class.Skipped
|
return "SKIPPED", "table-" + conf.Status.Class.Skipped
|
||||||
case QUEUED:
|
case dbpackage.StatusQueued:
|
||||||
return "QUEUED", "table-" + conf.Status.Class.Queued
|
return "QUEUED", "table-" + conf.Status.Class.Queued
|
||||||
case LATEST:
|
case dbpackage.StatusLatest:
|
||||||
return "LATEST", "table-" + conf.Status.Class.Latest
|
return "LATEST", "table-" + conf.Status.Class.Latest
|
||||||
case FAILED:
|
case dbpackage.StatusFailed:
|
||||||
return "FAILED", "table-" + conf.Status.Class.Failed
|
return "FAILED", "table-" + conf.Status.Class.Failed
|
||||||
case BUILD:
|
case dbpackage.StatusSigning:
|
||||||
return "SIGNING", "table-" + conf.Status.Class.Signing
|
return "SIGNING", "table-" + conf.Status.Class.Signing
|
||||||
case BUILDING:
|
case dbpackage.StatusBuilding:
|
||||||
return "BUILDING", "table-" + conf.Status.Class.Building
|
return "BUILDING", "table-" + conf.Status.Class.Building
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN", "table-" + conf.Status.Class.Unknown
|
return "UNKNOWN", "table-" + conf.Status.Class.Unknown
|
||||||
@@ -420,8 +413,6 @@ func getDBPkgFromPkgfile(pkg string) (*ent.DbPackage, error) {
|
|||||||
fNameSplit := strings.Split(pkg, "-")
|
fNameSplit := strings.Split(pkg, "-")
|
||||||
pkgname := strings.Join(fNameSplit[0:len(fNameSplit)-3], "-")
|
pkgname := strings.Join(fNameSplit[0:len(fNameSplit)-3], "-")
|
||||||
|
|
||||||
dbLock.RLock()
|
|
||||||
defer dbLock.RUnlock()
|
|
||||||
dbPkgs, err := db.DbPackage.Query().Where(dbpackage.PackagesNotNil()).All(context.Background())
|
dbPkgs, err := db.DbPackage.Query().Where(dbpackage.PackagesNotNil()).All(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.(type) {
|
switch err.(type) {
|
||||||
@@ -463,11 +454,36 @@ func housekeeping() error {
|
|||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
for _, pkgfile := range packages {
|
for _, pkgfile := range packages {
|
||||||
|
dbPkg, err := getDBPkgFromPkgfile(pkgfile)
|
||||||
|
pkg := &BuildPackage{
|
||||||
|
Pkgbase: dbPkg.Pkgbase,
|
||||||
|
Repo: dbPkg.Repository,
|
||||||
|
FullRepo: dbPkg.Repository.String() + "-" + dbPkg.March,
|
||||||
|
}
|
||||||
|
|
||||||
// check if pkg signature is valid
|
// check if pkg signature is valid
|
||||||
valid, err := isSignatureValid(pkgfile)
|
valid, err := isSignatureValid(pkgfile)
|
||||||
check(err)
|
check(err)
|
||||||
if !valid {
|
if !valid {
|
||||||
// TODO: purge pkg to trigger rebuild -> need srcinfo
|
// TODO: purge pkg to trigger rebuild -> need srcinfo
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var upstream string
|
||||||
|
switch dbPkg.Repository {
|
||||||
|
case dbpackage.RepositoryCore, dbpackage.RepositoryExtra:
|
||||||
|
upstream = "upstream-core-extra"
|
||||||
|
case dbpackage.RepositoryCommunity:
|
||||||
|
upstream = "upstream-community"
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg.Srcinfo, err = genSRCINFO(filepath.Join(conf.Basedir.Upstream, upstream, dbPkg.Pkgbase, "repos", dbPkg.Repository.String()+"-"+conf.Arch, "PKGBUILD"))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
buildManager.repoPurge[pkg.FullRepo] <- pkg
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: compare db-version with repo version
|
// TODO: compare db-version with repo version
|
||||||
@@ -509,12 +525,10 @@ func findPkgFiles(pkg *BuildPackage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getDbPackage(pkg *BuildPackage) *ent.DbPackage {
|
func getDbPackage(pkg *BuildPackage) *ent.DbPackage {
|
||||||
dbLock.Lock()
|
|
||||||
dbPkg, err := db.DbPackage.Query().Where(dbpackage.Pkgbase(pkg.Pkgbase)).Only(context.Background())
|
dbPkg, err := db.DbPackage.Query().Where(dbpackage.Pkgbase(pkg.Pkgbase)).Only(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dbPkg = db.DbPackage.Create().SetPkgbase(pkg.Pkgbase).SetMarch(pkg.March).SetPackages(packages2slice(pkg.Srcinfo.Packages)).SetRepository(pkg.Repo).SaveX(context.Background())
|
dbPkg = db.DbPackage.Create().SetPkgbase(pkg.Pkgbase).SetMarch(pkg.March).SetPackages(packages2slice(pkg.Srcinfo.Packages)).SetRepository(dbpackage.Repository(pkg.Repo)).SaveX(context.Background())
|
||||||
}
|
}
|
||||||
dbLock.Unlock()
|
|
||||||
|
|
||||||
return dbPkg
|
return dbPkg
|
||||||
}
|
}
|
||||||
@@ -533,18 +547,18 @@ func syncMarchs() {
|
|||||||
for _, march := range conf.March {
|
for _, march := range conf.March {
|
||||||
setupMakepkg(march)
|
setupMakepkg(march)
|
||||||
for _, repo := range conf.Repos {
|
for _, repo := range conf.Repos {
|
||||||
tRepo := fmt.Sprintf("%s-%s", repo, march)
|
fRepo := fmt.Sprintf("%s-%s", repo, march)
|
||||||
repos = append(repos, tRepo)
|
repos = append(repos, fRepo)
|
||||||
buildManager.repoAdd[tRepo] = make(chan *BuildPackage, conf.Build.Worker)
|
buildManager.repoAdd[fRepo] = make(chan *BuildPackage, conf.Build.Worker)
|
||||||
buildManager.repoPurge[tRepo] = make(chan *BuildPackage, 10000)
|
buildManager.repoPurge[fRepo] = make(chan *BuildPackage, 10000)
|
||||||
go buildManager.repoWorker(tRepo)
|
go buildManager.repoWorker(fRepo)
|
||||||
|
|
||||||
if _, err := os.Stat(filepath.Join(filepath.Join(conf.Basedir.Repo, tRepo, "os", conf.Arch))); os.IsNotExist(err) {
|
if _, err := os.Stat(filepath.Join(filepath.Join(conf.Basedir.Repo, fRepo, "os", conf.Arch))); os.IsNotExist(err) {
|
||||||
log.Debugf("Creating path %s", filepath.Join(conf.Basedir.Repo, tRepo, "os", conf.Arch))
|
log.Debugf("Creating path %s", filepath.Join(conf.Basedir.Repo, fRepo, "os", conf.Arch))
|
||||||
check(os.MkdirAll(filepath.Join(conf.Basedir.Repo, tRepo, "os", conf.Arch), os.ModePerm))
|
check(os.MkdirAll(filepath.Join(conf.Basedir.Repo, fRepo, "os", conf.Arch), os.ModePerm))
|
||||||
}
|
}
|
||||||
|
|
||||||
if i := find(eRepos, tRepo); i != -1 {
|
if i := find(eRepos, fRepo); i != -1 {
|
||||||
eRepos = append(eRepos[:i], eRepos[i+1:]...)
|
eRepos = append(eRepos[:i], eRepos[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user