From 5cf1744ee742aa7029938fb187855822bf2d15ba Mon Sep 17 00:00:00 2001 From: dark <255317@qq.com> Date: Thu, 14 Mar 2024 00:40:09 +0800 Subject: [PATCH] add page size --- demo.api | 2 ++ internal/logic/espressuretestlogic.go | 2 +- internal/types/types.go | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/demo.api b/demo.api index fb0dca9..d54f01b 100644 --- a/demo.api +++ b/demo.api @@ -7,6 +7,8 @@ type Request { type EsQueryName { Name string `json:"name"` + Page int32 `json:"page"` + Size int32 `json:"size"` } // 通用api返回参数 diff --git a/internal/logic/espressuretestlogic.go b/internal/logic/espressuretestlogic.go index 14a8bf7..ff15887 100644 --- a/internal/logic/espressuretestlogic.go +++ b/internal/logic/espressuretestlogic.go @@ -40,7 +40,7 @@ func (l *EsPressureTestLogic) EsPressureTest(req *types.EsQueryName) (resp *type ` esQueryStr := fmt.Sprintf(esQuery, req.Name) - doc, err := es.EsServiceApp.EsSearchDocWithStr(l.ctx, esQueryStr, 0, 100) + doc, err := es.EsServiceApp.EsSearchDocWithStr(l.ctx, esQueryStr, int(req.Page), int(req.Size)) if err != nil { return nil, err } diff --git a/internal/types/types.go b/internal/types/types.go index 7521fbe..4ff0586 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -7,6 +7,8 @@ type Request struct { type EsQueryName struct { Name string `json:"name"` + Page int32 `json:"page"` + Size int32 `json:"size"` } type Response struct {