22 lines
383 B
Go
22 lines
383 B
Go
|
package gmodel
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
)
|
||
|
|
||
|
// TODO: 使用model的属性做你想做的
|
||
|
|
||
|
func (m *FsFontModel) FindAllOrderSortByDesc(ctx context.Context) ([]*FsFont, error) {
|
||
|
|
||
|
var fonts []*FsFont
|
||
|
err := m.db.Model(&FsFont{}).Order("sort desc").Find(&fonts).Error
|
||
|
switch err {
|
||
|
case nil:
|
||
|
return fonts, nil
|
||
|
case ErrRecordNotFound:
|
||
|
return nil, nil
|
||
|
default:
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|