Documentation ¶
Index ¶
- Variables
- func BindAndValidateReq(c echo.Context, i interface{}) error
- func CanThisUserBeDisabled(subjectUser, objectUser string) (err error)
- func GetCurrentUser(c echo.Context) (*model.User, error)
- func GetLimitAndOffset(pageIndex, pageSize uint32) (limit, offset uint32)
- func GetUserName(c echo.Context) string
- func JSONBaseErrorReq(c echo.Context, err error) error
- func JSONNewDataExistErr(c echo.Context, format string, a ...interface{}) error
- func JSONNewDataNotExistErr(c echo.Context, format string, a ...interface{}) error
- func JSONNewNotImplementedErr(c echo.Context) 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 CanThisUserBeDisabled ¶ added in v1.2202.0
subjectUser should be admin user.
func GetCurrentUser ¶
func GetLimitAndOffset ¶ added in v1.2202.0
func GetUserName ¶
func GetUserName(c echo.Context) string
func JSONBaseErrorReq ¶
func JSONNewDataExistErr ¶ added in v1.2202.0
func JSONNewDataNotExistErr ¶ added in v1.2202.0
func JSONNewNotImplementedErr ¶ added in v1.2202.0
func JSONNewNotImplementedErr(c echo.Context) error
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.