chore: change select values case
This commit is contained in:
parent
4ba04fa7db
commit
e707d6b26e
@ -45,20 +45,20 @@ func SortFiles(objs []Obj, orderBy, orderDirection string) {
|
|||||||
case "name":
|
case "name":
|
||||||
{
|
{
|
||||||
c := strings.Compare(objs[i].GetName(), objs[j].GetName())
|
c := strings.Compare(objs[i].GetName(), objs[j].GetName())
|
||||||
if orderDirection == "DESC" {
|
if orderDirection == "desc" {
|
||||||
return c >= 0
|
return c >= 0
|
||||||
}
|
}
|
||||||
return c <= 0
|
return c <= 0
|
||||||
}
|
}
|
||||||
case "size":
|
case "size":
|
||||||
{
|
{
|
||||||
if orderDirection == "DESC" {
|
if orderDirection == "desc" {
|
||||||
return objs[i].GetSize() >= objs[j].GetSize()
|
return objs[i].GetSize() >= objs[j].GetSize()
|
||||||
}
|
}
|
||||||
return objs[i].GetSize() <= objs[j].GetSize()
|
return objs[i].GetSize() <= objs[j].GetSize()
|
||||||
}
|
}
|
||||||
case "updated_at":
|
case "updated_at":
|
||||||
if orderDirection == "DESC" {
|
if orderDirection == "desc" {
|
||||||
return objs[i].ModTime().After(objs[j].ModTime())
|
return objs[i].ModTime().After(objs[j].ModTime())
|
||||||
}
|
}
|
||||||
return objs[i].ModTime().Before(objs[j].ModTime())
|
return objs[i].ModTime().Before(objs[j].ModTime())
|
||||||
|
@ -98,7 +98,7 @@ func getMainItems(config driver.Config) []driver.Item {
|
|||||||
}, {
|
}, {
|
||||||
Name: "order_direction",
|
Name: "order_direction",
|
||||||
Type: conf.TypeSelect,
|
Type: conf.TypeSelect,
|
||||||
Values: "ASC,DESC",
|
Values: "asc,desc",
|
||||||
}}...)
|
}}...)
|
||||||
}
|
}
|
||||||
items = append(items, driver.Item{
|
items = append(items, driver.Item{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user