Documentation ¶
Index ¶
- Constants
- type Args
- type Context
- func (ctx *Context) Arg(name string) string
- func (ctx *Context) Args() Args
- func (ctx *Context) Finalize()
- func (ctx *Context) Param(name string) ([]string, bool)
- func (ctx *Context) ParamSingle(name string) string
- func (ctx *Context) Params() Params
- func (ctx *Context) Redirect(uri string)
- func (ctx *Context) RenderJSON(stat int, data interface{})
- func (ctx *Context) RenderText(stat int, text string)
- func (ctx *Context) Req() *Request
- func (ctx *Context) Res() *Response
- func (ctx *Context) View() *View
- func (ctx *Context) WriteResponse(w http.ResponseWriter) error
- type Controller
- func (c *Controller) AddRoute(method, path string, hf HandlerFunc)
- func (c *Controller) DELETE(path string, hf HandlerFunc)
- func (c *Controller) GET(path string, hf HandlerFunc)
- func (c *Controller) PATCH(path string, hf HandlerFunc)
- func (c *Controller) POST(path string, hf HandlerFunc)
- func (c *Controller) PUT(path string, hf HandlerFunc)
- func (c *Controller) Routes() []*Handler
- type Ctx
- type CtxBuilder
- type Dispacher
- type Handler
- type HandlerFunc
- type JSONRenderer
- type Ksatriya
- func (k *Ksatriya) AddRoute(method, path string, hf HandlerFunc)
- func (k *Ksatriya) DELETE(path string, hf HandlerFunc)
- func (k *Ksatriya) GET(path string, hf HandlerFunc)
- func (k *Ksatriya) PATCH(path string, hf HandlerFunc)
- func (k *Ksatriya) POST(path string, hf HandlerFunc)
- func (k *Ksatriya) PUT(path string, hf HandlerFunc)
- func (k *Ksatriya) RegisterController(d Dispacher)
- func (k *Ksatriya) Root() *Root
- func (k *Ksatriya) Router() *Router
- func (k *Ksatriya) Run(addr string)
- func (k *Ksatriya) ServeFiles()
- func (k *Ksatriya) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (k *Ksatriya) SetCtxBuilder(f CtxBuilder)
- type Params
- type Renderer
- type Request
- type Response
- func (res *Response) Body() string
- func (res *Response) Header() http.Header
- func (res *Response) SetBody(val string)
- func (res *Response) SetContentType(val string)
- func (res *Response) SetHeader(key, val string)
- func (res *Response) SetStatusCode(val int)
- func (res *Response) StatusCode() int
- func (res *Response) WriteBody(w http.ResponseWriter)
- func (res *Response) WriteHeader(w http.ResponseWriter)
- func (res *Response) WriteHeaderAndBody(w http.ResponseWriter)
- type Root
- type Router
- type TextRenderer
- type View
Constants ¶
View Source
const ( RootPathDefault = "/static" RootDirDefault = "static" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct {
httprouter.Params
}
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) ParamSingle ¶
func (*Context) RenderJSON ¶
func (*Context) RenderText ¶
func (*Context) WriteResponse ¶
func (ctx *Context) WriteResponse(w http.ResponseWriter) error
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController() *Controller
func (*Controller) AddRoute ¶
func (c *Controller) AddRoute(method, path string, hf HandlerFunc)
func (*Controller) DELETE ¶
func (c *Controller) DELETE(path string, hf HandlerFunc)
func (*Controller) GET ¶
func (c *Controller) GET(path string, hf HandlerFunc)
func (*Controller) PATCH ¶
func (c *Controller) PATCH(path string, hf HandlerFunc)
func (*Controller) POST ¶
func (c *Controller) POST(path string, hf HandlerFunc)
func (*Controller) PUT ¶
func (c *Controller) PUT(path string, hf HandlerFunc)
func (*Controller) Routes ¶
func (c *Controller) Routes() []*Handler
type Ctx ¶
type Ctx interface { Req() *Request Res() *Response View() *View Args() Args Arg(string) string Params() Params Param(string) ([]string, bool) ParamSingle(string) string RenderText(int, string) RenderJSON(int, interface{}) Redirect(string) WriteResponse(http.ResponseWriter) error Finalize() }
func NewContext ¶
type CtxBuilder ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) HandlerFunc ¶
func (h *Handler) HandlerFunc() HandlerFunc
type HandlerFunc ¶
type HandlerFunc func(Ctx)
type JSONRenderer ¶
type JSONRenderer struct {
// contains filtered or unexported fields
}
func NewJSONRenderer ¶
func NewJSONRenderer(data interface{}) *JSONRenderer
func (*JSONRenderer) Render ¶
func (r *JSONRenderer) Render() (string, error)
type Ksatriya ¶
type Ksatriya struct {
// contains filtered or unexported fields
}
func (*Ksatriya) AddRoute ¶
func (k *Ksatriya) AddRoute(method, path string, hf HandlerFunc)
func (*Ksatriya) DELETE ¶
func (k *Ksatriya) DELETE(path string, hf HandlerFunc)
func (*Ksatriya) GET ¶
func (k *Ksatriya) GET(path string, hf HandlerFunc)
func (*Ksatriya) PATCH ¶
func (k *Ksatriya) PATCH(path string, hf HandlerFunc)
func (*Ksatriya) POST ¶
func (k *Ksatriya) POST(path string, hf HandlerFunc)
func (*Ksatriya) PUT ¶
func (k *Ksatriya) PUT(path string, hf HandlerFunc)
func (*Ksatriya) RegisterController ¶
func (*Ksatriya) ServeFiles ¶
func (k *Ksatriya) ServeFiles()
func (*Ksatriya) SetCtxBuilder ¶
func (k *Ksatriya) SetCtxBuilder(f CtxBuilder)
type Request ¶
func NewRequest ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func NewResponse ¶
func NewResponse() *Response
func (*Response) SetContentType ¶
func (*Response) SetStatusCode ¶
func (*Response) StatusCode ¶
func (*Response) WriteBody ¶
func (res *Response) WriteBody(w http.ResponseWriter)
func (*Response) WriteHeader ¶
func (res *Response) WriteHeader(w http.ResponseWriter)
func (*Response) WriteHeaderAndBody ¶
func (res *Response) WriteHeaderAndBody(w http.ResponseWriter)
type Root ¶
type Root struct {
// contains filtered or unexported fields
}
func (*Root) Dir ¶
func (root *Root) Dir() http.FileSystem
type TextRenderer ¶
type TextRenderer struct {
// contains filtered or unexported fields
}
func NewTextRenderer ¶
func NewTextRenderer(text string) *TextRenderer
func (*TextRenderer) Render ¶
func (r *TextRenderer) Render() (string, error)
Click to show internal directories.
Click to hide internal directories.