1uf3 / execinquery

A simple query string checker in Query function

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False positive with ShouldBindQuery using gin framework

yiannisccmath opened this issue · comments

type queryGetParams struct {
	ID          *uint64 `form:"id"`
	Pagination  *uint64 `form:"pagination"`
}

func getUsers(ctx *gin.Context) {
	params := queryGetParams{}
	if err := ctx.ShouldBindQuery(&params); err != nil {
		ctx.AbortWithStatusJSON(http.StatusBadRequest, "invalid query params")
		return
	}
}

above fails with
execinquery It's better to use Execute method instead of ShouldBindQuery method to execute `` query