controller

package
v1.2112.0-pre1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2021 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

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 GetCurrentUser(c echo.Context) (*model.User, error)

func GetUserName

func GetUserName(c echo.Context) string

func JSONBaseErrorReq

func JSONBaseErrorReq(c echo.Context, err error) error

func ReadFileContent

func ReadFileContent(c echo.Context, name string) (content string, fileExist bool, err error)

ReadFileContent read content from http body by name if file exist, the name is a http form data key, not file name.

func Validate

func Validate(i interface{}) error

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

func NewBaseReq(err error) BaseRes

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL