25 lines
408 B
Go
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),
|
|
})
|
|
}
|