Skip to content

Commit

Permalink
Add helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
levichevdmitry committed Nov 13, 2020
1 parent 11ad4c2 commit 9ce84e7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions services/RestService.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,3 +434,25 @@ func (c *RestService) DecodeBody(req *http.Request, target interface{}) error {
}
return nil
}

func (c *RestService) GetPagingParams(req *http.Request) *cdata.PagingParams {

pagingParams := make(map[string]string, 0)
pagingParams["skip"] = c.GetParam(req, "skip")
pagingParams["take"] = c.GetParam(req, "take")
pagingParams["total"] = c.GetParam(req, "total")

return cdata.NewPagingParamsFromValue(pagingParams)
}

func (c *RestService) GetFilterParams(req *http.Request) *cdata.FilterParams {

params := req.URL.Query()

delete(params, "skip")
delete(params, "take")
delete(params, "total")
delete(params, "correlation_id")

return cdata.NewFilterParamsFromValue(params)
}

0 comments on commit 9ce84e7

Please sign in to comment.