sort desc

This commit is contained in:
Simon Ding
2024-07-21 11:44:01 +08:00
parent cee5debe1c
commit f7d858f920

View File

@@ -19,6 +19,7 @@ import (
"time" "time"
"entgo.io/ent/dialect" "entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@@ -430,7 +431,7 @@ func (c *Client) SetHistoryStatus(id int, status history.Status) error {
} }
func (c *Client) GetHistories() ent.Histories { func (c *Client) GetHistories() ent.Histories {
h, err := c.ent.History.Query().All(context.TODO()) h, err := c.ent.History.Query().Order(history.ByID(sql.OrderDesc())).All(context.TODO())
if err != nil { if err != nil {
return nil return nil
} }