middleware

package
v0.0.0-...-33bd00a Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTranslator

func RegisterTranslator(tag string, msg string) validator.RegisterTranslationsFunc

func Translate

func Translate(trans unTrans.Translator, fe validator.FieldError) string

Types

type AuthxMiddleware

type AuthxMiddleware struct {
	CasbinEnforcer *casbin.Enforcer
	Route2CodeFunc func(r *http.Request) string
}

func NewAuthxMiddleware

func NewAuthxMiddleware(casbinEnforcer *casbin.Enforcer, route2codeFunc func(r *http.Request) string) *AuthxMiddleware

func (*AuthxMiddleware) Handle

type Body

type Body struct {
	Data any    `json:"data"`
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type ErrorMiddleware

type ErrorMiddleware struct{}

func NewErrorMiddleware

func NewErrorMiddleware() *ErrorMiddleware

func (*ErrorMiddleware) Handle

func (e *ErrorMiddleware) Handle(ctx context.Context, err error) (int, any)

type I18nMiddleware

type I18nMiddleware struct {
}

func NewI18nMiddleware

func NewI18nMiddleware() *I18nMiddleware

func (*I18nMiddleware) Handle

type OkMiddleware

type OkMiddleware struct{}

func NewOkMiddleware

func NewOkMiddleware() *OkMiddleware

func (*OkMiddleware) Handle

func (o *OkMiddleware) Handle(_ context.Context, data any) any

type ValidatorMiddleware

type ValidatorMiddleware struct {
	// contains filtered or unexported fields
}

func NewValidatorMiddleware

func NewValidatorMiddleware() *ValidatorMiddleware

func (*ValidatorMiddleware) Validate

func (v *ValidatorMiddleware) Validate(r *http.Request, data any) error

Jump to

Keyboard shortcuts

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