Created
November 7, 2018 12:07
-
-
Save gavinzhou/398e92a24c9e6cb091b0120093bc1a3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package util | |
| import ( | |
| "github.com/Unknwon/com" | |
| "github.com/gin-gonic/gin" | |
| "github.com/gavinzhou/hello-gin/pkg/setting" | |
| ) | |
| func GetPage(c *gin.Context) int { | |
| result := 0 | |
| page, _ := com.StrTo(c.Query("page")).Int() | |
| if page > 0 { | |
| result = (page - 1) * setting.PageSize | |
| } | |
| return result | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment