app

package
v0.0.0-...-ac5d97d Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Quit chan bool
)

Functions

func ContextMiddleware

func ContextMiddleware() echo.MiddlewareFunc

func NewEcho

func NewEcho(cfg *EchoConfig) (e *echo.Echo)

func Panic

func Panic(params ...any)

func RecoverMiddleware

func RecoverMiddleware() echo.MiddlewareFunc

func UserMiddleware

func UserMiddleware(skipper middleware.Skipper) echo.MiddlewareFunc

func UserTypeAgentMiddleware

func UserTypeAgentMiddleware() echo.MiddlewareFunc

func UserTypeManagerMiddleware

func UserTypeManagerMiddleware() echo.MiddlewareFunc

func UserTypeManagerOrMaintainerMiddleware

func UserTypeManagerOrMaintainerMiddleware() echo.MiddlewareFunc

func UserTypeMiddleware

func UserTypeMiddleware(typs ...adapter.UserType) echo.MiddlewareFunc

Types

type ApiResponse

type ApiResponse = adapter.Response[any]

func CreateResponse

func CreateResponse(params ...any) *ApiResponse

CreateResponse 创建response结构体 int: code error: message string: message 其他: data

type BaseContext

type BaseContext struct {
	echo.Context
	User *adapter.User
}

func Context

func Context(c echo.Context) *BaseContext

func ContextAndBinding

func ContextAndBinding[T any](c echo.Context) (ctx *BaseContext, req *T)

func NewBaseContext

func NewBaseContext(c echo.Context) *BaseContext

func (*BaseContext) BindValidate

func (c *BaseContext) BindValidate(ptr any)

func (*BaseContext) SendResponse

func (c *BaseContext) SendResponse(params ...any) error

SendResponse 发送响应

type BaseService

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

func NewService

func NewService(params ...any) *BaseService

func (*BaseService) GetContext

func (s *BaseService) GetContext() context.Context

func (*BaseService) GetUser

func (s *BaseService) GetUser() *adapter.User

type DumpConfig

type DumpConfig struct {
	Skipper ew.Skipper

	RequestHeader  DumpHeaderLogger
	ResponseHeader DumpHeaderLogger

	ResponseBodySkipper ew.Skipper

	Extra func(echo.Context) []byte
}

type DumpFileConfig

type DumpFileConfig struct {
	Path string
}

type DumpFileMiddleware

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

func NewDumpFile

func NewDumpFile(params ...any) *DumpFileMiddleware

func (*DumpFileMiddleware) WithConfig

func (mw *DumpFileMiddleware) WithConfig(cfg *DumpConfig) echo.MiddlewareFunc

func (*DumpFileMiddleware) WithDefaultConfig

func (mw *DumpFileMiddleware) WithDefaultConfig() echo.MiddlewareFunc

type DumpHandler

type DumpHandler func(echo.Context, []byte, []byte)

type DumpHeader

type DumpHeader []byte
var (
	DumpHeaderRequest  DumpHeader = []byte("Request Header")
	DumpHeaderResponse DumpHeader = []byte("Response Header")
)

type DumpHeaderLogger

type DumpHeaderLogger func(c echo.Context) map[string]string

type DumpLogger

type DumpLogger func(c echo.Context) bool

type DumpResponseWriter

type DumpResponseWriter struct {
	io.Writer
	http.ResponseWriter
}

func (*DumpResponseWriter) Flush

func (w *DumpResponseWriter) Flush()

func (*DumpResponseWriter) Hijack

func (w *DumpResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (*DumpResponseWriter) Write

func (w *DumpResponseWriter) Write(b []byte) (int, error)

func (*DumpResponseWriter) WriteHeader

func (w *DumpResponseWriter) WriteHeader(code int)

type DumpZapLoggerMiddleware

type DumpZapLoggerMiddleware struct {
}

func NewDumpLoggerMiddleware

func NewDumpLoggerMiddleware() *DumpZapLoggerMiddleware

func (*DumpZapLoggerMiddleware) WithConfig

func (*DumpZapLoggerMiddleware) WithDefaultConfig

func (mw *DumpZapLoggerMiddleware) WithDefaultConfig(skipper ew.Skipper) echo.MiddlewareFunc

type EchoConfig

type EchoConfig struct {
	AuthSkipper middleware.Skipper
	Maintain    maintain.Config
	DumpSkipper middleware.Skipper
}

type Permission

type Permission bool
const (
	PermissionRequired    Permission = true
	PermissionNotRequired Permission = false
)

type StatusResponse

type StatusResponse struct {
	Status bool `json:"status"` // 是否成功
}

type Validator

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

func NewValidator

func NewValidator() *Validator

func (*Validator) Validate

func (v *Validator) Validate(i interface{}) error

Jump to

Keyboard shortcuts

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