Documentation ¶
Index ¶
- Variables
- func Handle(method, path string, handle Handler)
- func R() *httprouter.Router
- func T(t *testing.T, cases ...TCase)
- type Context
- func (c *Context) ATTACHMENT(filepath, filename string)
- func (c *Context) AllQuery() url.Values
- func (c *Context) BodyBytes() ([]byte, error)
- func (c *Context) Deadline() (deadline time.Time, ok bool)
- func (c *Context) Done() <-chan struct{}
- func (c *Context) Err() error
- func (c *Context) FILE(filepath string)
- func (c *Context) Get(key string) (any, bool)
- func (c *Context) GetAuthorization() string
- func (c *Context) GetContentType() string
- func (c *Context) GetHeader(key string) string
- func (c *Context) GetRequestId() string
- func (c *Context) GetString(key string) string
- func (c *Context) JSON(code int, v any)
- func (c *Context) JSONOK(v any)
- func (c *Context) Param(key string) string
- func (c *Context) Query(key string) string
- func (c *Context) Set(key string, value any)
- func (c *Context) SetHeader(key, value string)
- func (c *Context) SetStatusCode(statusCode int)
- func (c *Context) TEXT(s string, v ...any)
- func (c *Context) Value(key any) any
- func (c *Context) WithContext(ctx context.Context) *Context
- type Error
- type Group
- type Handler
- type M
- type Middleware
- type Param
- type Params
- type TCase
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBadRequest = NewError(http.StatusBadRequest, "bad request") ErrForbidden = NewError(http.StatusForbidden, "forbidden") ErrNotFound = NewError(http.StatusNotFound, "not found") ErrMethodNotAllowed = NewError(http.StatusMethodNotAllowed, "method not allowed") ErrConflict = NewError(http.StatusConflict, "conflict") ErrInternal = NewError(http.StatusInternalServerError, "internal server error") )
Functions ¶
func R ¶
func R() *httprouter.Router
Types ¶
type Context ¶
type Context struct { Request *http.Request Writer http.ResponseWriter // contains filtered or unexported fields }
func (*Context) ATTACHMENT ¶ added in v1.7.1
func (*Context) GetAuthorization ¶
func (*Context) GetContentType ¶
func (*Context) GetRequestId ¶
func (*Context) SetStatusCode ¶ added in v1.7.1
type Error ¶
type Error struct { Code int `json:"code" xml:"code"` Message string `json:"message,omitempty" xml:"message,omitempty"` Metadata map[string]any `json:"metadata,omitempty" xml:"metadata,omitempty"` // contains filtered or unexported fields }
func (*Error) AppendMetadata ¶
func (*Error) WithMetadata ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func NewGroup ¶
func NewGroup(prefix string, middlewares ...Middleware) *Group
type Middleware ¶
type Param ¶
type Param = httprouter.Param
type Params ¶
type Params = httprouter.Params
Source Files ¶
Click to show internal directories.
Click to hide internal directories.