feat: support download client priority

This commit is contained in:
Simon Ding
2024-10-04 11:12:06 +08:00
parent 7dfa4eafc4
commit 3af5f96cb0
13 changed files with 172 additions and 155 deletions

View File

@@ -27,8 +27,8 @@ const (
FieldPassword = "password"
// FieldSettings holds the string denoting the settings field in the database.
FieldSettings = "settings"
// FieldOrdering holds the string denoting the ordering field in the database.
FieldOrdering = "ordering"
// FieldPriority1 holds the string denoting the priority1 field in the database.
FieldPriority1 = "priority1"
// FieldRemoveCompletedDownloads holds the string denoting the remove_completed_downloads field in the database.
FieldRemoveCompletedDownloads = "remove_completed_downloads"
// FieldRemoveFailedDownloads holds the string denoting the remove_failed_downloads field in the database.
@@ -49,7 +49,7 @@ var Columns = []string{
FieldUser,
FieldPassword,
FieldSettings,
FieldOrdering,
FieldPriority1,
FieldRemoveCompletedDownloads,
FieldRemoveFailedDownloads,
FieldTags,
@@ -72,10 +72,10 @@ var (
DefaultPassword string
// DefaultSettings holds the default value on creation for the "settings" field.
DefaultSettings string
// DefaultOrdering holds the default value on creation for the "ordering" field.
DefaultOrdering int
// OrderingValidator is a validator for the "ordering" field. It is called by the builders before save.
OrderingValidator func(int) error
// DefaultPriority1 holds the default value on creation for the "priority1" field.
DefaultPriority1 int
// Priority1Validator is a validator for the "priority1" field. It is called by the builders before save.
Priority1Validator func(int) error
// DefaultRemoveCompletedDownloads holds the default value on creation for the "remove_completed_downloads" field.
DefaultRemoveCompletedDownloads bool
// DefaultRemoveFailedDownloads holds the default value on creation for the "remove_failed_downloads" field.
@@ -150,9 +150,9 @@ func BySettings(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSettings, opts...).ToFunc()
}
// ByOrdering orders the results by the ordering field.
func ByOrdering(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrdering, opts...).ToFunc()
// ByPriority1 orders the results by the priority1 field.
func ByPriority1(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPriority1, opts...).ToFunc()
}
// ByRemoveCompletedDownloads orders the results by the remove_completed_downloads field.

View File

@@ -83,9 +83,9 @@ func Settings(v string) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldEQ(FieldSettings, v))
}
// Ordering applies equality check predicate on the "ordering" field. It's identical to OrderingEQ.
func Ordering(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldEQ(FieldOrdering, v))
// Priority1 applies equality check predicate on the "priority1" field. It's identical to Priority1EQ.
func Priority1(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldEQ(FieldPriority1, v))
}
// RemoveCompletedDownloads applies equality check predicate on the "remove_completed_downloads" field. It's identical to RemoveCompletedDownloadsEQ.
@@ -458,44 +458,44 @@ func SettingsContainsFold(v string) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldContainsFold(FieldSettings, v))
}
// OrderingEQ applies the EQ predicate on the "ordering" field.
func OrderingEQ(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldEQ(FieldOrdering, v))
// Priority1EQ applies the EQ predicate on the "priority1" field.
func Priority1EQ(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldEQ(FieldPriority1, v))
}
// OrderingNEQ applies the NEQ predicate on the "ordering" field.
func OrderingNEQ(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldNEQ(FieldOrdering, v))
// Priority1NEQ applies the NEQ predicate on the "priority1" field.
func Priority1NEQ(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldNEQ(FieldPriority1, v))
}
// OrderingIn applies the In predicate on the "ordering" field.
func OrderingIn(vs ...int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldIn(FieldOrdering, vs...))
// Priority1In applies the In predicate on the "priority1" field.
func Priority1In(vs ...int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldIn(FieldPriority1, vs...))
}
// OrderingNotIn applies the NotIn predicate on the "ordering" field.
func OrderingNotIn(vs ...int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldNotIn(FieldOrdering, vs...))
// Priority1NotIn applies the NotIn predicate on the "priority1" field.
func Priority1NotIn(vs ...int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldNotIn(FieldPriority1, vs...))
}
// OrderingGT applies the GT predicate on the "ordering" field.
func OrderingGT(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldGT(FieldOrdering, v))
// Priority1GT applies the GT predicate on the "priority1" field.
func Priority1GT(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldGT(FieldPriority1, v))
}
// OrderingGTE applies the GTE predicate on the "ordering" field.
func OrderingGTE(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldGTE(FieldOrdering, v))
// Priority1GTE applies the GTE predicate on the "priority1" field.
func Priority1GTE(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldGTE(FieldPriority1, v))
}
// OrderingLT applies the LT predicate on the "ordering" field.
func OrderingLT(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldLT(FieldOrdering, v))
// Priority1LT applies the LT predicate on the "priority1" field.
func Priority1LT(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldLT(FieldPriority1, v))
}
// OrderingLTE applies the LTE predicate on the "ordering" field.
func OrderingLTE(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldLTE(FieldOrdering, v))
// Priority1LTE applies the LTE predicate on the "priority1" field.
func Priority1LTE(v int) predicate.DownloadClients {
return predicate.DownloadClients(sql.FieldLTE(FieldPriority1, v))
}
// RemoveCompletedDownloadsEQ applies the EQ predicate on the "remove_completed_downloads" field.