feat: improve support for pt

This commit is contained in:
Simon Ding
2024-08-01 19:12:14 +08:00
parent 35d299b60c
commit 408ff163ef
13 changed files with 450 additions and 80 deletions

View File

@@ -27,6 +27,8 @@ const (
FieldSize = "size"
// FieldDownloadClientID holds the string denoting the download_client_id field in the database.
FieldDownloadClientID = "download_client_id"
// FieldIndexerID holds the string denoting the indexer_id field in the database.
FieldIndexerID = "indexer_id"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldSaved holds the string denoting the saved field in the database.
@@ -45,6 +47,7 @@ var Columns = []string{
FieldTargetDir,
FieldSize,
FieldDownloadClientID,
FieldIndexerID,
FieldStatus,
FieldSaved,
}
@@ -132,6 +135,11 @@ func ByDownloadClientID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDownloadClientID, opts...).ToFunc()
}
// ByIndexerID orders the results by the indexer_id field.
func ByIndexerID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIndexerID, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()