gmvc

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gmvc provides basic object classes for MVC.

Index

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 // 返回数据对象(r.Response)
	Server   *ghttp.Server   // Web Server对象(r.Server)
	Cookie   *ghttp.Cookie   // COOKIE操作对象(r.Cookie)
	Session  *ghttp.Session  // SESSION操作对象
	View     *View           // 视图对象
}

控制器基类

func (*Controller) Exit

func (c *Controller) Exit()

退出请求执行

func (*Controller) Init

func (c *Controller) Init(r *ghttp.Request)

控制器初始化接口方法

func (*Controller) Shut

func (c *Controller) Shut()

控制器结束请求接口方法

type Model

type Model struct {
}

MVC模型基类

type View

type View struct {
	// contains filtered or unexported fields
}

基于控制器注册的MVC视图基类(一个请求一个视图对象,用完即销毁)

func NewView

func NewView(w *ghttp.Response) *View

创建一个MVC请求中使用的视图对象

func (*View) Assign

func (view *View) Assign(key string, value interface{})

绑定模板变量,即调用之后每个线程都会生效,因此有并发安全控制

func (*View) Assigns

func (view *View) Assigns(data gview.Params)

批量绑定模板变量,即调用之后每个线程都会生效,因此有并发安全控制

func (*View) Display

func (view *View) Display(file ...string) error

解析并显示指定模板

func (*View) DisplayContent

func (view *View) DisplayContent(content string) error

解析并显示模板内容

func (*View) LockFunc

func (view *View) LockFunc(f func(data gview.Params))

使用自定义方法对模板变量执行加锁修改操作

func (*View) Parse

func (view *View) Parse(file string) (string, error)

解析模板,并返回解析后的内容

func (*View) ParseContent

func (view *View) ParseContent(content string) (string, error)

直接解析模板内容,并返回解析后的内容

func (*View) RLockFunc

func (view *View) RLockFunc(f func(data gview.Params))

使用自定义方法对模板变量执行加锁读取操作

Jump to

Keyboard shortcuts

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