uniugm/admin/lib/web/model.go
2025-04-18 17:17:23 +08:00

25 lines
408 B
Go

package web
import (
"fmt"
"io"
)
type Context interface {
SetRawContext(ctx RawContext)
GetRawContext() RawContext
}
type HandlerFunc any
type RawContext interface {
Json(code int, v any)
Writer() io.Writer
}
var ParseParamsErrorHandler = func(ctx Context, path string, err error) {
ctx.GetRawContext().Json(501, map[string]interface{}{
"MSG": fmt.Sprintf("parse params error:%v", err),
})
}