Skip to content

Commit

Permalink
pageRequest nil judge
Browse files Browse the repository at this point in the history
  • Loading branch information
孙 莹波 committed Jul 20, 2022
1 parent b2e8282 commit 82f7127
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions types/query/format_page_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ package query
import sdk "github.com/irisnet/core-sdk-go/types"

const (
PageReqNilErrMsg = "pageRequest error: PageRequest cannot be nil"
CountTotalErrMsg = "pageRequest error: CountTotal is not supported, must be false"
LimitErrMsg = "pageRequest error: Limit cannot be empty and cannot exceed 100"
)

func FormatPageRequest(pageReq *PageRequest) (*PageRequest, sdk.Error) {
if pageReq == nil {
return pageReq, sdk.Wrapf(PageReqNilErrMsg)
}
if pageReq.CountTotal {
return pageReq, sdk.Wrapf(CountTotalErrMsg)
}
Expand Down

0 comments on commit 82f7127

Please sign in to comment.