Documentation ¶
Index ¶
- Variables
- func Body[T any](c Context) (T, error)
- func ServeFile(c Context, filesystem fs.FS, file string) error
- type ApiHandler
- type ApiHandlerFunc
- type Context
- type Error
- type ErrorType
- type Files
- type FormApiHandler
- type FormFileSpec
- type FormSpec
- type Group
- type Handler
- type NoContentError
- type NormalHandler
- type NormalHandlerFunc
- type Response
- type Router
- type Server
- type ServerConfig
- type ServerGroup
- type ServerRouter
- type Transformable
Constants ¶
This section is empty.
Variables ¶
View Source
var GlobalErrors = []ErrorType{ ErrTypeUnknownError, ErrTypeRouteNotFound, ErrTypeValidationError, ErrTypeFormValidationError, ErrTypeEmptyBody, ErrTypeBadContentType, }
Functions ¶
Types ¶
type ApiHandler ¶ added in v0.8.1
type ApiHandlerFunc ¶ added in v0.8.1
type Error ¶ added in v0.8.3
type Error struct { Code int `json:"code"` Type ErrorType `json:"type"` Message string `json:"message"` Extra any `json:"extra,omitempty"` }
func BadContentType ¶ added in v0.12.0
func FormValidationError ¶ added in v0.12.0
func RouteNotFound ¶ added in v0.8.3
func RouteNotFound() *Error
func ValidationError ¶ added in v0.8.3
type ErrorType ¶ added in v0.8.3
type ErrorType string
const ( ErrTypeUnknownError ErrorType = "UNKNOWN_ERROR" ErrTypeRouteNotFound ErrorType = "ROUTE_NOT_FOUND" ErrTypeValidationError ErrorType = "VALIDATION_ERROR" ErrTypeFormValidationError ErrorType = "FORM_VALIDATION_ERROR" ErrTypeEmptyBody ErrorType = "EMPTY_BODY_ERROR" ErrTypeBadContentType ErrorType = "BAD_CONTENT_TYPE_ERROR" )
type Files ¶ added in v0.12.0
type Files []*multipart.FileHeader
type FormApiHandler ¶ added in v0.12.0
type FormFileSpec ¶ added in v0.12.0
type FormFileSpec struct {
NumExpected int
}
type FormSpec ¶ added in v0.12.0
type FormSpec struct { BodyType any Files map[string]FormFileSpec }
type NoContentError ¶ added in v0.13.0
type NoContentError struct {
Code int `json:"code"`
}
func NoContentNotFound ¶ added in v0.13.0
func NoContentNotFound() *NoContentError
func (*NoContentError) Error ¶ added in v0.13.0
func (e *NoContentError) Error() string
type NormalHandler ¶ added in v0.8.1
type NormalHandler struct { Name string Method string Path string Middlewares []echo.MiddlewareFunc HandlerFunc NormalHandlerFunc }
type NormalHandlerFunc ¶ added in v0.8.1
type Response ¶ added in v0.8.3
type Response struct { Success bool `json:"success"` Data any `json:"data,omitempty"` Error *Error `json:"error,omitempty"` }
func ErrorResponse ¶ added in v0.8.3
func SuccessResponse ¶ added in v0.8.3
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(config *ServerConfig) *Server
func (*Server) Group ¶
func (s *Server) Group(prefix string, m ...echo.MiddlewareFunc) *ServerGroup
type ServerConfig ¶
type ServerGroup ¶
type ServerGroup struct {
// contains filtered or unexported fields
}
func (*ServerGroup) Register ¶
func (g *ServerGroup) Register(handlers ...Handler)
type ServerRouter ¶
type ServerRouter struct {
// contains filtered or unexported fields
}
func (*ServerRouter) Group ¶
func (r *ServerRouter) Group(prefix string) Group
type Transformable ¶ added in v0.10.0
type Transformable interface {
Transform()
}
Click to show internal directories.
Click to hide internal directories.