Documentation
¶
Index ¶
- Constants
- func ParsePattern(pattern string) (regex *regexp.Regexp, params []string)
- type Context
- type Gow
- type Handler
- type RequestMethod
- type Response
- func (res *Response) Commit()
- func (res *Response) ContentType(contentType string)
- func (res *Response) Cookie(key string, value ...string) string
- func (res *Response) Download(file string)
- func (res *Response) Interrupt()
- func (res *Response) Json(data interface{})
- func (res *Response) Redirect(url string, status ...int)
- func (res *Response) Text(str string)
- func (res *Response) Throw(status int)
- func (res *Response) Xml(data interface{})
- type Route
- type Router
- func (r *Router) Add(method RequestMethod, pattern string, fn ...Handler) *Router
- func (r *Router) After(h Handler) *Router
- func (r *Router) ApplyStatic()
- func (r *Router) Before(h Handler) *Router
- func (r *Router) Delete(pattern string, fn ...Handler) *Router
- func (rt *Router) Find(url string, method string) (params map[string]string, fn []Handler)
- func (r *Router) Get(pattern string, fn ...Handler) *Router
- func (r *Router) NotFound(h Handler) *Router
- func (r *Router) Post(pattern string, fn ...Handler) *Router
- func (r *Router) Put(pattern string, fn ...Handler) *Router
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Static(v ...string) *Router
- func (r *Router) Use(m ...Handler) *Router
- type TemplateEngine
Constants ¶
View Source
const ( RequestMethodANY = RequestMethod("ANY") RequestMethodGet = RequestMethod("GET") RequestMethodPost = RequestMethod("POST") RequestMethodPut = RequestMethod("PUT") RequestMethodDelete = RequestMethod("DELETE") RequestMethodPatch = RequestMethod("PATCH") RequestMethodHead = RequestMethod("HEAD") RequestMethodOptions = RequestMethod("OPTIONS") NOT_FOUND = "not_found" STATIC_RES = "static_resource" BEFORE_EXEC = "before_exec" AFTER_EXEC = "after_exec" )
View Source
const ( COMM_TPL_COMMONS = "commons" COMM_TPL_INCLUDES = "includes" COMM_TPL_LAYOUTS = "layouts" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context interface { Base() string Header(key string, value ...string) string Host() string Ip() string Url() string Uri() string Ext() string Method() string UserAgent() string Referer() string IsSSL() bool IsAjax() bool Request() *http.Request Response() *Response Text(text string) Param(key string) string QueryParam(key string) string Input() map[string]string String(key string) string Strings(key string) []string Flash(key string, v ...interface{}) interface{} SetBody(body []byte) Status(code int) Json(data interface{}) ContentType(contentType string) Render(tpl string, model map[string]interface{}) Tpl(tpl string, data map[string]interface{}) string }
func NewContext ¶
func NewContext(w http.ResponseWriter, req *http.Request) Context
type Gow ¶
type RequestMethod ¶
type RequestMethod string
type Response ¶
type Response struct { http.ResponseWriter Status int IsInterrupt bool IsCommit bool Body []byte Headers map[string]string // contains filtered or unexported fields }
func NewResponse ¶
func NewResponse(w http.ResponseWriter) *Response
func (*Response) ContentType ¶
ContentType sets content-type string.
func (*Response) Cookie ¶
Cookie gets cookie value by given key when give only string. Cookie sets cookie value by given key, value and expire time string.
func (*Response) Json ¶
func (res *Response) Json(data interface{})
Json set json response with data and proper header.
type Router ¶
func (*Router) Add ¶
func (r *Router) Add(method RequestMethod, pattern string, fn ...Handler) *Router
func (*Router) ApplyStatic ¶
func (r *Router) ApplyStatic()
type TemplateEngine ¶
func NewTemplateEngine ¶
func NewTemplateEngine() *TemplateEngine
func (*TemplateEngine) CreateTemplate ¶
func (tple *TemplateEngine) CreateTemplate(tplName string) *template.Template
func (*TemplateEngine) Init ¶
func (tple *TemplateEngine) Init()
Click to show internal directories.
Click to hide internal directories.