Thank you this is good
for those using gin , you can dynamically pick the parameters like this
page, _ := strconv.Atoi(context.Query("page")) if page <= 0 { page = 1 } pageSize, _ := strconv.Atoi(context.Query("per_page")) sort := context.Query("sort") var sortWithDirection string if sort != "" { direction := context.Query("sortDesc") if direction != "" { if direction == "true" { sortWithDirection = sort + " desc" } else if direction == "false" { sortWithDirection = sort + " asc" } } } switch { case pageSize <= 0: pageSize = 10 }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you this is good
for those using gin , you can dynamically pick the parameters like this