Documentation ¶
Overview ¶
Package gmvc provides basic object classes for MVC.
Index ¶
- type Controller
- type M
- type Model
- type View
- func (view *View) Assign(key string, value interface{})
- func (view *View) Assigns(data gview.Params)
- func (view *View) BindFunc(name string, function interface{})
- func (view *View) BindFuncMap(funcMap gview.FuncMap)
- func (view *View) Display(file ...string) error
- func (view *View) DisplayContent(content string) error
- func (view *View) LockFunc(f func(data gview.Params))
- func (view *View) Parse(file string) (string, error)
- func (view *View) ParseContent(content string) (string, error)
- func (view *View) RLockFunc(f func(data gview.Params))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { Request *ghttp.Request Response *ghttp.Response Server *ghttp.Server Cookie *ghttp.Cookie Session *ghttp.Session View *View }
Controller is used for controller register of ghttp.Server.
func (*Controller) Init ¶
func (c *Controller) Init(r *ghttp.Request)
Init is the callback function for each request initialization.
func (*Controller) Shut ¶
func (c *Controller) Shut()
Shut is the callback function for each request close.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is the view object for controller. It's initialized when controller request initializes and destroyed when the controller request closes.
func (*View) BindFunc ¶
BindFunc registers customized template function named <name> with given function <function> to current view object. The <name> is the function name which can be called in template content.
func (*View) BindFuncMap ¶
BindFuncMap registers customized template functions by map to current view object. The key of map is the template function name and the value of map is the address of customized function.
func (*View) DisplayContent ¶
DisplayContent parses and writes the parsed content to http response.
func (*View) Parse ¶
Parse parses given template file <tpl> with assigned template variables and returns the parsed template content.
func (*View) ParseContent ¶
ParseContent parses given template file <file> with assigned template variables and returns the parsed template content.