add sorting for list blobs

Signed-off-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
Wang Yan 2021-02-26 11:52:53 +08:00
parent fba6dd799e
commit 5c2d43ea38
1 changed files with 3 additions and 0 deletions

View File

@ -223,6 +223,9 @@ func (d *dao) ListBlobs(ctx context.Context, query *q.Query) ([]*models.Blob, er
return nil, err
}
if query.Sorting != "" {
qs = qs.OrderBy(query.Sorting)
}
blobs := []*models.Blob{}
if _, err = qs.All(&blobs); err != nil {
return nil, err