This commit is contained in:
xing 2023-02-26 22:03:30 +08:00
parent 477d8fe6f9
commit 5ae0ad646e

View File

@ -50,21 +50,22 @@ func pagination[T Model](db dbQuery, ctx context.Context, q QueryCondition) (r [
}
q.Offset = offset
m := ctx.Value("handle=>")
if m != nil {
mm, ok := m.(string)
if ok && mm == "toMap" {
v := ctx.Value("map")
mx, er := findToStringMap[T](db, ctx, q)
if er != nil {
err = er
return
}
vv := v.(*[]map[string]string)
*vv = mx
if m == nil {
r, err = finds[T](db, ctx, q)
return
}
mm, ok := m.(string)
if ok && mm == "toMap" {
v := ctx.Value("map")
mx, er := findToStringMap[T](db, ctx, q)
if er != nil {
err = er
return
}
vv := v.(*[]map[string]string)
*vv = mx
return
}
r, err = finds[T](db, ctx, q)
return
}