docs: 计划Task4 List Count() int→int64 转换修正
This commit is contained in:
@@ -458,12 +458,14 @@ func (d *errorMemoryDao) Upsert(ctx context.Context, m *entity.ErrorMemory) (err
|
||||
}
|
||||
|
||||
// List 分页查询(按 id 倒序)
|
||||
// 注:GoFrame v2 的 Model.Count() 返回 int,而公开签名 total 为 int64,须显式转换(实现时按此修正)。
|
||||
func (d *errorMemoryDao) List(ctx context.Context, page, pageSize int) (list []entity.ErrorMemory, total int64, err error) {
|
||||
model := gfdb.DB(ctx, public.DbNameModelGateway).Model(ctx, public.TableNameErrorMemory)
|
||||
total, err = model.Count()
|
||||
if err != nil {
|
||||
var n int
|
||||
if n, err = model.Count(); err != nil {
|
||||
return
|
||||
}
|
||||
total = int64(n)
|
||||
err = model.Page(page, pageSize).OrderDesc(entity.ErrorMemoryCol.Id).Scan(&list)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user