Documentation
¶
Index ¶
- Constants
- func DebugPrintRoute(httpMethod, absolutePath, _ string, _ int)
- func Dir(root string, listDirectory bool) http.FileSystem
- func IsDebugging() bool
- func LastChar(str string) uint8
- func SetHandler(e Handler)
- func SetMode(value string)
- type Context
- type Error
- type Handler
- type HandlerFunc
- type HandlersChain
- type RouterGroup
- func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup
- func (group *RouterGroup) Handle(httpMethod, relativePath string, handlerFuncs ...HandlerFunc)
- func (group *RouterGroup) Static(relativePath, root string)
- func (group *RouterGroup) StaticFS(relativePath string, fs http.FileSystem)
- func (group *RouterGroup) Use(middleware ...HandlerFunc)
- type Web
Constants ¶
View Source
const ( // DebugMode indicates gin mode is debug. DebugMode = "debug" // ReleaseMode indicates gin mode is release. ReleaseMode = "release" // TestMode indicates gin mode is test. TestMode = "test" )
Variables ¶
This section is empty.
Functions ¶
func DebugPrintRoute ¶
DebugPrintRoute defined TODO
func IsDebugging ¶
func IsDebugging() bool
IsDebugging returns true if the framework is running in debug mode.
Types ¶
type Context ¶
type Context interface {
// Set/Get is used to store a new key/value pair exclusively for this context.
Set(string, interface{})
Get(string) interface{}
// Next
Next()
Abort()
// /user/:id
Param(string) string
// /path?id=1234&name=Manu&value=
Query(key string) string
// parsed multipart form, including file uploads
MultipartForm() (*multipart.Form, error)
// http header
Header(key, value string)
GetHeader(key string) string
// return stream data.
ShouldBindWith(interface{}) error
GetRawData() ([]byte, error)
// Set-Cookie header to the ResponseWriter's headers
SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool)
Cookie(name string) (string, error)
// render reponse
HTML(io.Reader, ...interface{})
XML(io.Reader, ...interface{})
File(io.Reader, string, ...interface{})
String(string, ...interface{})
// net/http
Request() *http.Request
SetRequest(r *http.Request)
ResponseWriter() http.ResponseWriter
// context
Deadline() (time.Time, bool)
Done() <-chan struct{}
Err() error
Value(interface{}) interface{}
// std reponse json
JSON(code int, i interface{})
Success(interface{})
Fail(error)
}
Context defined TODO
type Handler ¶
type Handler interface {
Handler() http.Handler
Handle(string, string, ...HandlerFunc)
}
Handler defined TODO
type HandlerFunc ¶
type HandlerFunc interface{}
type HandlersChain ¶
type HandlersChain []HandlerFunc
type RouterGroup ¶
type RouterGroup struct {
Handlers []HandlerFunc
// contains filtered or unexported fields
}
routerGroup defined TODO
func (*RouterGroup) Group ¶
func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup
Group defined TODO
func (*RouterGroup) Handle ¶
func (group *RouterGroup) Handle(httpMethod, relativePath string, handlerFuncs ...HandlerFunc)
Handle defined TODO
func (*RouterGroup) Static ¶
func (group *RouterGroup) Static(relativePath, root string)
Static defined TODO
func (*RouterGroup) StaticFS ¶
func (group *RouterGroup) StaticFS(relativePath string, fs http.FileSystem)
StaticFS defined TODO
Click to show internal directories.
Click to hide internal directories.