mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
add file size
This commit is contained in:
@@ -23,6 +23,8 @@ const (
|
||||
FieldDate = "date"
|
||||
// FieldTargetDir holds the string denoting the target_dir field in the database.
|
||||
FieldTargetDir = "target_dir"
|
||||
// FieldSize holds the string denoting the size field in the database.
|
||||
FieldSize = "size"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// FieldSaved holds the string denoting the saved field in the database.
|
||||
@@ -39,6 +41,7 @@ var Columns = []string{
|
||||
FieldSourceTitle,
|
||||
FieldDate,
|
||||
FieldTargetDir,
|
||||
FieldSize,
|
||||
FieldStatus,
|
||||
FieldSaved,
|
||||
}
|
||||
@@ -53,6 +56,11 @@ func ValidColumn(column string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// DefaultSize holds the default value on creation for the "size" field.
|
||||
DefaultSize int
|
||||
)
|
||||
|
||||
// Status defines the type for the "status" enum field.
|
||||
type Status string
|
||||
|
||||
@@ -111,6 +119,11 @@ func ByTargetDir(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTargetDir, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySize orders the results by the size field.
|
||||
func BySize(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSize, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||
|
||||
@@ -79,6 +79,11 @@ func TargetDir(v string) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldTargetDir, v))
|
||||
}
|
||||
|
||||
// Size applies equality check predicate on the "size" field. It's identical to SizeEQ.
|
||||
func Size(v int) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldSize, v))
|
||||
}
|
||||
|
||||
// Saved applies equality check predicate on the "saved" field. It's identical to SavedEQ.
|
||||
func Saved(v string) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldSaved, v))
|
||||
@@ -334,6 +339,46 @@ func TargetDirContainsFold(v string) predicate.History {
|
||||
return predicate.History(sql.FieldContainsFold(FieldTargetDir, v))
|
||||
}
|
||||
|
||||
// SizeEQ applies the EQ predicate on the "size" field.
|
||||
func SizeEQ(v int) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldSize, v))
|
||||
}
|
||||
|
||||
// SizeNEQ applies the NEQ predicate on the "size" field.
|
||||
func SizeNEQ(v int) predicate.History {
|
||||
return predicate.History(sql.FieldNEQ(FieldSize, v))
|
||||
}
|
||||
|
||||
// SizeIn applies the In predicate on the "size" field.
|
||||
func SizeIn(vs ...int) predicate.History {
|
||||
return predicate.History(sql.FieldIn(FieldSize, vs...))
|
||||
}
|
||||
|
||||
// SizeNotIn applies the NotIn predicate on the "size" field.
|
||||
func SizeNotIn(vs ...int) predicate.History {
|
||||
return predicate.History(sql.FieldNotIn(FieldSize, vs...))
|
||||
}
|
||||
|
||||
// SizeGT applies the GT predicate on the "size" field.
|
||||
func SizeGT(v int) predicate.History {
|
||||
return predicate.History(sql.FieldGT(FieldSize, v))
|
||||
}
|
||||
|
||||
// SizeGTE applies the GTE predicate on the "size" field.
|
||||
func SizeGTE(v int) predicate.History {
|
||||
return predicate.History(sql.FieldGTE(FieldSize, v))
|
||||
}
|
||||
|
||||
// SizeLT applies the LT predicate on the "size" field.
|
||||
func SizeLT(v int) predicate.History {
|
||||
return predicate.History(sql.FieldLT(FieldSize, v))
|
||||
}
|
||||
|
||||
// SizeLTE applies the LTE predicate on the "size" field.
|
||||
func SizeLTE(v int) predicate.History {
|
||||
return predicate.History(sql.FieldLTE(FieldSize, v))
|
||||
}
|
||||
|
||||
// StatusEQ applies the EQ predicate on the "status" field.
|
||||
func StatusEQ(v Status) predicate.History {
|
||||
return predicate.History(sql.FieldEQ(FieldStatus, v))
|
||||
|
||||
Reference in New Issue
Block a user