Versions in this module Expand all Collapse all v1 v1.2.0 Nov 16, 2021 Changes in this version + var PreflightHandler = func(ctx *Context) error v1.1.0 Nov 16, 2021 Changes in this version + const CONNECT + const DELETE + const GET + const HEAD + const OPTIONS + const PATCH + const POST + const PUT + const TRACE + func MethodNotAllowedHandler(ctx *Context) error + func NotFoundHandler(ctx *Context) error + type Context struct + Req *http.Request + Resp *responseWriter + func NewContext(w http.ResponseWriter, r *http.Request, sg *SGo) *Context + func (ctx *Context) Error(code int, error string) + func (ctx *Context) FormFile(key string) (multipart.File, *multipart.FileHeader, error) + func (ctx *Context) Get(key string) interface{} + func (ctx *Context) GetCookie(name string) string + func (ctx *Context) Gets() map[string]interface{} + func (ctx *Context) Init(w http.ResponseWriter, r *http.Request) + func (ctx *Context) JSON(code, flag int, msg string, data interface{}) error + func (ctx *Context) JSONP(code int, callback string, data interface{}) error + func (ctx *Context) Method() string + func (ctx *Context) Next() + func (ctx *Context) Param(key string) string + func (ctx *Context) Params() url.Values + func (ctx *Context) Path() string + func (ctx *Context) Redirect(code int, url string) + func (ctx *Context) Referer() string + func (ctx *Context) Render(code int, tplname string) error + func (ctx *Context) SaveFile(name, saveDir string) (string, error) + func (ctx *Context) Set(key string, val interface{}) + func (ctx *Context) SetCookie(name, value string) + func (ctx *Context) Status() int + func (ctx *Context) Text(code int, body string) error + func (ctx *Context) UserAgent() string + func (ctx *Context) Write(data []byte) (n int, err error) + type HandlerFunc func(*Context) error + type SGo struct + MethodNotAllowedHandler HandlerFunc + Middlewares []HandlerFunc + NotFoundHandler HandlerFunc + Pool *sync.Pool + PreflightHandler func(ctx *Context) error + Templates *Templates + Tree *Trie + func New() *SGo + func (sg *SGo) Any(path string, handler HandlerFunc) + func (sg *SGo) CONNECT(path string, handler HandlerFunc) + func (sg *SGo) DELETE(path string, handler HandlerFunc) + func (sg *SGo) GET(path string, handler HandlerFunc) + func (sg *SGo) HEAD(path string, handler HandlerFunc) + func (sg *SGo) Handle(method, path string, handler HandlerFunc) + func (sg *SGo) OPTIONS(path string, handler HandlerFunc) + func (sg *SGo) PATCH(path string, handler HandlerFunc) + func (sg *SGo) POST(path string, handler HandlerFunc) + func (sg *SGo) PUT(path string, handler HandlerFunc) + func (sg *SGo) Run(addr string) error + func (sg *SGo) RunOverTLS(addr, certFile, keyFile string) error + func (sg *SGo) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (sg *SGo) SetTemplates(tplDir string, funcMap template.FuncMap) + func (sg *SGo) TRACE(path string, handler HandlerFunc) + func (sg *SGo) USE(middlewares ...HandlerFunc) + type Templates struct + Dir string + FuncMap template.FuncMap + Suffix string + func NewTemplates(tplDir string, funcMap template.FuncMap) *Templates + func (tpl *Templates) Render(w io.Writer, tplname string, data interface{}) error + type Trie struct + func (t *Trie) Insert(method, path string, handler HandlerFunc) + func (t *Trie) Search(components []string, params url.Values) *Trie