initial commit example

This commit is contained in:
2023-03-29 18:54:45 -05:00
commit f1033c67ac
18 changed files with 4433 additions and 0 deletions

18
httputil/error.go Normal file
View File

@@ -0,0 +1,18 @@
package httputil
import "github.com/gin-gonic/gin"
// NewError example
func NewError(ctx *gin.Context, status int, err error) {
er := HTTPError{
Code: status,
Message: err.Error(),
}
ctx.JSON(status, er)
}
// HTTPError example
type HTTPError struct {
Code int `json:"code" example:"400"`
Message string `json:"message" example:"status bad request"`
}