Documentation
¶
Index ¶
- Constants
- type App
- func (this *App) Config() *ConfigFile
- func (this *App) Delete(method string, fn ...Handler)
- func (this *App) Get(method string, fn ...Handler)
- func (this *App) GetString(key string) string
- func (this *App) NotFound(h Handler)
- func (this *App) Post(method string, fn ...Handler)
- func (this *App) Put(method string, fn ...Handler)
- func (this *App) Route(method, key string, fn ...Handler)
- func (this *App) Run()
- func (this *App) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (this *App) Static(h Handler)
- type ConfigFile
- func (this *ConfigFile) Bool(key string) (bool, error)
- func (this *ConfigFile) Float64(key string) (float64, error)
- func (this *ConfigFile) GetValue(key string) (string, error)
- func (this *ConfigFile) Int(key string) (int, error)
- func (this *ConfigFile) Int64(key string) (int64, error)
- func (this *ConfigFile) MustBool(key string, defaultValue ...bool) bool
- func (this *ConfigFile) MustFloat64(key string, defaultValue ...float64) float64
- func (this *ConfigFile) MustInt(key string, defaultValue ...int) int
- func (this *ConfigFile) MustInt64(key string, defaultValue ...int64) int64
- func (this *ConfigFile) MustValue(key string, defaultValue ...string) string
- func (this *ConfigFile) SetData(key, val string)
- type Context
- func (this *Context) App() *App
- func (this *Context) ContentType(contentType string)
- func (this *Context) Cookie(key string, value ...string) string
- func (this *Context) Do(e string, args ...interface{}) [][]interface{}
- func (this *Context) Download(file string)
- func (this *Context) End()
- func (this *Context) Func(name string, fn interface{})
- func (this *Context) GetHeader(key string) string
- func (this *Context) Json(data interface{})
- func (this *Context) MustString(key, def string) string
- func (this *Context) On(e string, fn interface{})
- func (this *Context) Redirect(url string, status ...int)
- func (this *Context) Render(tpl string, data map[string]interface{})
- func (this *Context) Send()
- func (this *Context) String(key string) string
- func (this *Context) Strings(key string) []string
- func (this *Context) Throw(status int, message ...interface{})
- func (this *Context) Tpl(tpl string, data map[string]interface{}) string
- type Handler
- type Route
- type Router
- func (this *Router) Delete(pattern string, fn ...Handler)
- func (this *Router) Find(url, method string) (params map[string]string, fn []Handler)
- func (this *Router) Get(pattern string, fn ...Handler)
- func (this *Router) Post(pattern string, fn ...Handler)
- func (this *Router) Put(pattern string, fn ...Handler)
- func (this *Router) Router(method, pattern string, fn ...Handler)
- type View
Constants ¶
View Source
const ( CONTEXT_RENDERED = "context_rendered" CONTEXT_END = "context_end" CONTEXT_SEND = "context_send" )
View Source
const ( ROUTER_METHOD_GET = "GET" ROUTER_METHOD_POST = "POST" ROUTER_METHOD_PUT = "PUT" ROUTER_METHOD_DELETE = "DELETE" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) Config ¶
func (this *App) Config() *ConfigFile
type ConfigFile ¶
type ConfigFile struct {
BlockMode bool
// contains filtered or unexported fields
}
func LoadConfigFile ¶
func LoadConfigFile(fileName string, moreFiles ...string) *ConfigFile
*
- 加载配置文件初始化函数 *
- @author Vckai.
- @date 2014-04-03
func (*ConfigFile) Float64 ¶
func (this *ConfigFile) Float64(key string) (float64, error)
*
- 获取配置值, 并转换为浮点型
func (*ConfigFile) Int64 ¶
func (this *ConfigFile) Int64(key string) (int64, error)
*
- 获取配置值, 并转换为64位整型
func (*ConfigFile) MustBool ¶
func (this *ConfigFile) MustBool(key string, defaultValue ...bool) bool
func (*ConfigFile) MustFloat64 ¶
func (this *ConfigFile) MustFloat64(key string, defaultValue ...float64) float64
func (*ConfigFile) MustInt64 ¶
func (this *ConfigFile) MustInt64(key string, defaultValue ...int64) int64
type Context ¶
type Context struct {
Request *http.Request
BaseUrl string
Url string
RequestUrl string
Method string
Ip string
UserAgent string
Referer string
Host string
Ext string
IsSSH bool
IsAjax bool
Response http.ResponseWriter
Status int
Header map[string]string
Body []byte
RouteParams map[string]string
IsSend bool
IsEnd bool
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) ContentType ¶
ContentType sets content-type string.
func (*Context) Json ¶
func (this *Context) Json(data interface{})
Json set json response with data and proper header.
func (*Context) MustString ¶
func (*Context) Redirect ¶
Redirect does redirection response to url string and status int optional.
func (*Context) Render ¶
Render does template and layout rendering with data. The result bytes are assigned to context.Body. If error, panic.
func (*Context) Send ¶
func (this *Context) Send()
Send does response sending. If response is sent, do not sent again.
Click to show internal directories.
Click to hide internal directories.