Documentation
¶
Overview ¶
Package toys gives you a simple web toolkit with a small collection of rules
Index ¶
- type Context
- func (c *Context) BasePath(p string) string
- func (c *Context) Cookie(name string, filter bool) string
- func (c *Context) Get(name string, filter bool) string
- func (c *Context) Info(key InfoKey) string
- func (c *Context) Init(w http.ResponseWriter, r *http.Request)
- func (c *Context) Post(name string, filter bool) string
- func (c *Context) Print(a ...interface{})
- func (c *Context) Printf(format string, a ...interface{})
- func (c *Context) Redirect(url string, code int)
- func (c *Context) SetPath(p string)
- type InfoKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Request *http.Request http.ResponseWriter // contains filtered or unexported fields }
Context is the main struct of toys framework. Use it to handle the request.
func (*Context) BasePath ¶
BasePath return the relative url base on the path seted with SetPath. BasePath will return the origin value if p is an absolute url.
func (*Context) Cookie ¶
Cookie return the cookis value with given name. It call template.HTMLEscapeString for the output if filter is true.
func (*Context) Get ¶
Get returns the first value for the named component of the GET or HEAD query. It call template.HTMLEscapeString for the output if filter is true.
func (*Context) Init ¶
func (c *Context) Init(w http.ResponseWriter, r *http.Request)
Init initial the Context given a http.ResponseWriter and *http.Request. You must call Init right after create new Context for each request.
func (*Context) Post ¶
POST returns the string value for the named component of the POST or GET query. It call template.HTMLEscapeString for the output if filter is true.
func (*Context) Print ¶
func (c *Context) Print(a ...interface{})
Print formats using the default formats for its operands and writes to web browser. It returns the number of bytes written and any write error encountered.
func (*Context) Printf ¶
Printf formats according to a format specifier and writes to web browser. It returns the number of bytes written and any write error encountered.
Directories
¶
Path | Synopsis |
---|---|
Package locale help you do build a internationalize your app.
|
Package locale help you do build a internationalize your app. |
Package model provide some interfaces to support application development on multiple database platforms.
|
Package model provide some interfaces to support application development on multiple database platforms. |
Package secure provide some convenient package to secure you web application.
|
Package secure provide some convenient package to secure you web application. |
membership
Package membership provide a interface to easy authorization for your web application.
|
Package membership provide a interface to easy authorization for your web application. |
membership/sessions
Package session provide an interface to handle web application session.
|
Package session provide an interface to handle web application session. |
util
|
|
Package view implements a basic template system on top of html/template package.
|
Package view implements a basic template system on top of html/template package. |