Documentation
¶
Index ¶
- type Contain
- type Context
- func (c *Context) Abort()
- func (c *Context) AbortWithStatus(code int)
- func (c *Context) AjaxError(code int, message string, data any)
- func (c *Context) AjaxJson(code int, message string, data any)
- func (c *Context) AjaxSuccess(message string, data any)
- func (c *Context) Authorization() string
- func (c *Context) Cookie(key string) string
- func (c *Context) Ctx() context.Context
- func (c *Context) Error(message string, code int)
- func (c *Context) IsAborted() bool
- func (c *Context) JSON(httpCode int, data any)
- func (c *Context) JSONArgs(v schema.ISchema) error
- func (c *Context) Next()
- func (c *Context) NotFound()
- func (c *Context) PostForm(key string) string
- func (c *Context) Query(key string) string
- func (c *Context) QueryArray(key string) []string
- func (c *Context) QueryInt(key string, missing int) int
- func (c *Context) QueryInt64(key string, missing int64) int64
- func (c *Context) QueryMap() url.Values
- func (c *Context) Redirect(code int, url string)
- func (c *Context) Request() *http.Request
- func (c *Context) Response() http.ResponseWriter
- func (c *Context) SetAuthorization(s string)
- func (c *Context) SetCookie(key string, value []byte, expired time.Duration)
- func (c *Context) SetCookieV2(cookie *http.Cookie)
- func (c *Context) SetDomain(domain string)
- func (c *Context) SetUserValue(key string, value interface{})
- func (c *Context) String(code int, text string)
- func (c *Context) UserValue(key string) any
- type Engine
- func (e *Engine) DELETE(path string, fn ...HandlerFunc)
- func (e *Engine) GET(path string, fn ...HandlerFunc)
- func (e *Engine) OPTIONS(path string, fn ...HandlerFunc)
- func (e *Engine) PATCH(path string, fn ...HandlerFunc)
- func (e *Engine) POST(path string, fn ...HandlerFunc)
- func (e *Engine) PUT(path string, fn ...HandlerFunc)
- func (e *Engine) Rest(path string, rest any)
- func (e *Engine) Run() (err error)
- func (e *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (e *Engine) SetAddr(addr string)
- func (e *Engine) SetGuard(gd Guard)
- func (e *Engine) SetRest(path string, rest any)
- func (e *Engine) Union(methods []string, path string, fn ...HandlerFunc)
- func (e *Engine) Use(pos HookPos, matcher IMatcher, fn HandlerFunc)
- type Guard
- type HandlerFunc
- type Hook
- type HookOpts
- type HookPos
- type HttpMethod
- type IEnginOpt
- type IHttpCONNECT
- type IHttpDELETE
- type IHttpGET
- type IHttpHEAD
- type IHttpOPTIONS
- type IHttpPATCH
- type IHttpPOST
- type IHttpPUT
- type IHttpTRACE
- type IMatcher
- type IRouter
- type Identically
- type Pre
- type Reg
- type Route
- type Routes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(w http.ResponseWriter, r *http.Request) *Context
func (*Context) AbortWithStatus ¶
func (*Context) AjaxSuccess ¶
func (*Context) Authorization ¶
func (*Context) QueryArray ¶
func (*Context) Response ¶
func (c *Context) Response() http.ResponseWriter
func (*Context) SetAuthorization ¶
func (*Context) SetCookieV2 ¶
func (*Context) SetUserValue ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) DELETE ¶
func (e *Engine) DELETE(path string, fn ...HandlerFunc)
func (*Engine) GET ¶
func (e *Engine) GET(path string, fn ...HandlerFunc)
func (*Engine) OPTIONS ¶
func (e *Engine) OPTIONS(path string, fn ...HandlerFunc)
func (*Engine) PATCH ¶
func (e *Engine) PATCH(path string, fn ...HandlerFunc)
func (*Engine) POST ¶
func (e *Engine) POST(path string, fn ...HandlerFunc)
func (*Engine) PUT ¶
func (e *Engine) PUT(path string, fn ...HandlerFunc)
type Guard ¶
type Guard struct {
Method HttpMethod
Pos HookPos
HandlerFunc HandlerFunc
}
func Cors ¶
func Cors(fn HandlerFunc) Guard
type HandlerFunc ¶
type HandlerFunc func(ctx *Context)
type Hook ¶
type Hook struct {
Pos HookPos
HandlerFunc HandlerFunc
// contains filtered or unexported fields
}
type HttpMethod ¶
type HttpMethod string
const ( MethodGet HttpMethod = "GET" MethodHead HttpMethod = "HEAD" MethodPost HttpMethod = "POST" MethodPut HttpMethod = "PUT" MethodPatch HttpMethod = "PATCH" // RFC 5789 MethodDelete HttpMethod = "DELETE" MethodConnect HttpMethod = "CONNECT" MethodOptions HttpMethod = "OPTIONS" MethodTrace HttpMethod = "TRACE" )
type IHttpCONNECT ¶
type IHttpCONNECT interface {
CONNECT(ctx *Context)
}
type IHttpDELETE ¶
type IHttpDELETE interface {
DELETE(ctx *Context)
}
type IHttpOPTIONS ¶
type IHttpOPTIONS interface {
OPTIONS(ctx *Context)
}
type IHttpPATCH ¶
type IHttpPATCH interface {
PATCH(ctx *Context)
}
type IHttpTRACE ¶
type IHttpTRACE interface {
TRACE(ctx *Context)
}
type IRouter ¶
type IRouter interface {
POST(path string, fn ...HandlerFunc)
GET(path string, fn ...HandlerFunc)
PUT(path string, fn ...HandlerFunc)
DELETE(path string, fn ...HandlerFunc)
OPTIONS(path string, fn ...HandlerFunc)
Use(pos HookPos, matcher IMatcher, fn HandlerFunc)
Rest(path string, rest any)
Union(methods []string, path string, fn ...HandlerFunc)
SetGuard(gd Guard)
}
type Identically ¶
type Identically struct {
// contains filtered or unexported fields
}
func Identical ¶
func Identical(path string) *Identically
func (*Identically) Match ¶
func (i *Identically) Match(method, path string) bool
type Route ¶
type Route struct {
Method string
Methods int
Path string
BeforeHooks []HandlerFunc
AfterHooks []HandlerFunc
HandlerFuncs []HandlerFunc
}
Click to show internal directories.
Click to hide internal directories.