toys

package module
v0.0.0-...-f5f780e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2013 License: BSD-2-Clause Imports: 5 Imported by: 4

README

Toys

Toys is another web toolkit for the Go programming language.

License

Toys is licensed under the New BSD License.

Documentation

Overview

Package toys gives you a simple web toolkit with a small collection of rules

Index

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

func (c *Context) BasePath(p string) string

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

func (c *Context) Cookie(name string, filter bool) string

Cookie return the cookis value with given name. It call template.HTMLEscapeString for the output if filter is true.

func (*Context) Get

func (c *Context) Get(name string, filter bool) string

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) Info

func (c *Context) Info(key InfoKey) string

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

func (c *Context) Post(name string, filter bool) string

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

func (c *Context) Printf(format string, a ...interface{})

Printf formats according to a format specifier and writes to web browser. It returns the number of bytes written and any write error encountered.

func (*Context) Redirect

func (c *Context) Redirect(url string, code int)

Redirect send the redirect header with the url destination and the status code.

func (*Context) SetPath

func (c *Context) SetPath(p string)

SetPath sets path of the application. For example, if you want you application handle the address example.com/toysapp/ then the input for SetPath should be "/toysapp/".

type InfoKey

type InfoKey uint8
const (
	RequestMethod InfoKey = iota
	RequestHost
	RequestPath
	RequestQuery
	RemoteAddress
)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL