修正分页截取范围

This commit is contained in:
2024-11-08 09:13:38 +08:00
parent 08266046b8
commit a541d2b263
2 changed files with 6 additions and 2 deletions

View File

@@ -549,11 +549,13 @@ func NewSchema(config Config) (graphql.Schema, error) {
}
}
if args.First != 0 {
// 如果截取范围小于列表长度
if args.First != 0 && args.First < len(list) {
list = list[:args.First]
}
if args.Last != 0 {
// 如果截取范围小于列表长度
if args.Last != 0 && args.Last < len(list) {
list = list[len(list)-args.Last:]
}