Skip to content

Commit eb20c28

Browse files
committed
addWith
1 parent 50ef284 commit eb20c28

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

paginator.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,17 @@ func (h *HttpResult) SearchByParams(params map[string]string, excepts ...string)
5050
return h
5151
}
5252

53-
func (r *HttpResult) ResultPagination(dest any) (http.Response, error) {
53+
func (r *HttpResult) ResultPagination(dest any,withes ...string) (http.Response, error) {
5454
request := r.Context.Request()
5555
ctx:=r.Context
5656
pageSize := request.Query("pageSize", "10")
5757
pageSizeInt := cast.ToInt(pageSize)
5858
currentPage := request.Query("currentPage", "1")
5959
currentPageInt := cast.ToInt(currentPage)
6060
total := int64(0)
61+
for _, with := range withes {
62+
r.Query.With(with)
63+
}
6164
r.Query.Model(dest).Paginate(currentPageInt, pageSizeInt, dest, &total)
6265

6366
URL_PATH := ctx.Request().Origin().URL.Path

0 commit comments

Comments
 (0)