Documentation ¶
Index ¶
- Variables
- func BindAndValidateReq(c echo.Context, i interface{}) error
- func GetCurrentUser(c echo.Context) (*model.User, error)
- func GetUserName(c echo.Context) string
- func JSONBaseErrorReq(c echo.Context, err error) error
- func ReadFileContent(c echo.Context, name string) (content string, fileExist bool, err error)
- func Validate(i interface{}) error
- func ValidateCron(fl validator.FieldLevel) bool
- func ValidateName(fl validator.FieldLevel) bool
- func ValidatePort(fl validator.FieldLevel) bool
- type BaseRes
- type CustomValidator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ValidNameTag = "name" ValidPortTag = "port" ValidCronTag = "cron" )
View Source
var ValidateNameRegexpPattern = `^[a-zA-Z][a-zA-Z0-9\_\-]{0,59}$`
Functions ¶
func BindAndValidateReq ¶
func BindAndValidateReq(c echo.Context, i interface{}) error
func GetCurrentUser ¶
func GetUserName ¶
func GetUserName(c echo.Context) string
func JSONBaseErrorReq ¶
func ReadFileContent ¶
ReadFileContent read content from http body by name if file exist, the name is a http form data key, not file name.
func ValidateCron ¶
func ValidateCron(fl validator.FieldLevel) bool
ValidateCron implements validator.Func
func ValidateName ¶
func ValidateName(fl validator.FieldLevel) bool
ValidateName implements validator.Func
func ValidatePort ¶
func ValidatePort(fl validator.FieldLevel) bool
ValidatePort implements validator.Func
Types ¶
type BaseRes ¶
type BaseRes struct { Code int `json:"code" example:"0"` Message string `json:"message" example:"ok"` }
func NewBaseReq ¶
type CustomValidator ¶
type CustomValidator struct {
// contains filtered or unexported fields
}
func NewCustomValidator ¶
func NewCustomValidator() *CustomValidator
func (*CustomValidator) RegisterTranslation ¶
func (cv *CustomValidator) RegisterTranslation(tag, enText, zhText string, params ...string) error
Click to show internal directories.
Click to hide internal directories.