Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func Bind ¶
Changed the c.MustBindWith() -> c.ShouldBindWith(). I don't want to auto return 400 when error happened. origin function is here: https://github.com/gin-gonic/gin/blob/master/context.go
func RandStringBytes ¶
Types ¶
type CommonError ¶
type CommonError struct {
Errors map[string]interface{} `json:"errors"`
}
CommonError will help to return customized Error info {"database": {"hello":"no such table", error: "not_exists"}}
func NewError ¶
func NewError(key string, err error) CommonError
NewError warps the error info in a object
func NewValidatorError ¶
func NewValidatorError(err error) CommonError
NewValidatorError handles the error returned by c.Bind in gin framework https://github.com/go-playground/validator/blob/v9/_examples/translations/main.go
Click to show internal directories.
Click to hide internal directories.