forked from ALHP/ALHP.GO
added LTO status to db and status page
This commit is contained in:
@@ -35,6 +35,8 @@ const (
|
||||
FieldUpdated = "updated"
|
||||
// FieldHash holds the string denoting the hash field in the database.
|
||||
FieldHash = "hash"
|
||||
// FieldLto holds the string denoting the lto field in the database.
|
||||
FieldLto = "lto"
|
||||
// Table holds the table name of the dbpackage in the database.
|
||||
Table = "db_packages"
|
||||
)
|
||||
@@ -54,6 +56,7 @@ var Columns = []string{
|
||||
FieldBuildTimeEnd,
|
||||
FieldUpdated,
|
||||
FieldHash,
|
||||
FieldLto,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
@@ -128,3 +131,30 @@ func RepositoryValidator(r Repository) error {
|
||||
return fmt.Errorf("dbpackage: invalid enum value for repository field: %q", r)
|
||||
}
|
||||
}
|
||||
|
||||
// Lto defines the type for the "lto" enum field.
|
||||
type Lto string
|
||||
|
||||
// LtoUnknown is the default value of the Lto enum.
|
||||
const DefaultLto = LtoUnknown
|
||||
|
||||
// Lto values.
|
||||
const (
|
||||
LtoEnabled Lto = "enabled"
|
||||
LtoUnknown Lto = "unknown"
|
||||
LtoDisabled Lto = "disabled"
|
||||
)
|
||||
|
||||
func (l Lto) String() string {
|
||||
return string(l)
|
||||
}
|
||||
|
||||
// LtoValidator is a validator for the "lto" field enum values. It is called by the builders before save.
|
||||
func LtoValidator(l Lto) error {
|
||||
switch l {
|
||||
case LtoEnabled, LtoUnknown, LtoDisabled:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("dbpackage: invalid enum value for lto field: %q", l)
|
||||
}
|
||||
}
|
||||
|
@@ -1271,6 +1271,68 @@ func HashContainsFold(v string) predicate.DbPackage {
|
||||
})
|
||||
}
|
||||
|
||||
// LtoEQ applies the EQ predicate on the "lto" field.
|
||||
func LtoEQ(v Lto) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldLto), v))
|
||||
})
|
||||
}
|
||||
|
||||
// LtoNEQ applies the NEQ predicate on the "lto" field.
|
||||
func LtoNEQ(v Lto) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldLto), v))
|
||||
})
|
||||
}
|
||||
|
||||
// LtoIn applies the In predicate on the "lto" field.
|
||||
func LtoIn(vs ...Lto) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldLto), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// LtoNotIn applies the NotIn predicate on the "lto" field.
|
||||
func LtoNotIn(vs ...Lto) predicate.DbPackage {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldLto), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// LtoIsNil applies the IsNil predicate on the "lto" field.
|
||||
func LtoIsNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldLto)))
|
||||
})
|
||||
}
|
||||
|
||||
// LtoNotNil applies the NotNil predicate on the "lto" field.
|
||||
func LtoNotNil() predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldLto)))
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.DbPackage) predicate.DbPackage {
|
||||
return predicate.DbPackage(func(s *sql.Selector) {
|
||||
|
Reference in New Issue
Block a user