Documentation ¶
Index ¶
- Constants
- func DefaultLoadTemplate(templatesDir string, funcMap template.FuncMap, templates ...string) multitemplate.Render
- func NewWebAPIControllerFunc(ctlFunc func(ctx *WebAPIContext), opts ...Option) gin.HandlerFunc
- func NewWebControllerFunc(ctlFunc func(ctx *WebContext), opts ...Option) gin.HandlerFunc
- type EngineTemplate
- type LoadTemplateFunc
- type Option
- func GlobalConstant(constant map[string]interface{}) Option
- func GlobalVariable(variable map[string]interface{}) Option
- func Layout(layout string) Option
- func PageName(pageName string) Option
- func Pjax(pjax bool) Option
- func PjaxLayout(pjaxLayout string) Option
- func StatusCode(statusCode int) Option
- func Template(template string) Option
- type Options
- type WebAPIContext
- type WebContext
Constants ¶
View Source
const SessionCurrentAccount = "current_account"
SessionCurrentAccount ...
Variables ¶
This section is empty.
Functions ¶
func DefaultLoadTemplate ¶
func DefaultLoadTemplate(templatesDir string, funcMap template.FuncMap, templates ...string) multitemplate.Render
DefaultLoadTemplate ...
func NewWebAPIControllerFunc ¶
func NewWebAPIControllerFunc(ctlFunc func(ctx *WebAPIContext), opts ...Option) gin.HandlerFunc
NewWebAPIControllerFunc WebAPI控制器函数
func NewWebControllerFunc ¶
func NewWebControllerFunc(ctlFunc func(ctx *WebContext), opts ...Option) gin.HandlerFunc
NewWebControllerFunc Web控制器函数
Types ¶
type EngineTemplate ¶
type EngineTemplate struct { Errors <-chan error // contains filtered or unexported fields }
EngineTemplate gin引擎模板
func NewEngineTemplate ¶
func NewEngineTemplate(templateDir string, engine *gin.Engine, tmplFunc LoadTemplateFunc, funcMap template.FuncMap, templates ...string) (*EngineTemplate, error)
NewEngineTemplate 创建一个gin引擎模板
func (*EngineTemplate) LoadTemplate ¶
func (tmpl *EngineTemplate) LoadTemplate() multitemplate.Render
LoadTemplate 加载模板
func (*EngineTemplate) Watching ¶
func (tmpl *EngineTemplate) Watching() error
Watching 监听模板文件夹中是否有变动
type LoadTemplateFunc ¶
type LoadTemplateFunc func(templatesDir string, funcMap template.FuncMap, templates ...string) multitemplate.Render
LoadTemplateFunc 加载模板函数类
type Option ¶
type Option func(*Options)
Option 为可选参数赋值的函数
func GlobalConstant ¶
GlobalConstant ...
func GlobalVariable ¶
GlobalVariable ...
type Options ¶
type Options struct { StatusCode int Layout string PageName string Template string Pjax bool PjaxLayout string GlobalVariable map[string]interface{} GlobalConstant map[string]interface{} SessionCurrentAccountKey string }
Options 可选参数列表
type WebAPIContext ¶
WebAPIContext Web上下文
func (*WebAPIContext) DelCurrentAccount ¶
func (ctx *WebAPIContext) DelCurrentAccount() error
DelCurrentAccount 删除当前账户
func (*WebAPIContext) GetCurrentAccount ¶
func (ctx *WebAPIContext) GetCurrentAccount() interface{}
GetCurrentAccount 设置当前账户
func (*WebAPIContext) ResultError ¶
func (ctx *WebAPIContext) ResultError(err error)
ResultError 返回错误
func (*WebAPIContext) SetCurrentAccount ¶
func (ctx *WebAPIContext) SetCurrentAccount(data interface{}) error
SetCurrentAccount 设置当前账户
type WebContext ¶
WebContext Web上下文
func (*WebContext) DelCurrentAccount ¶
func (ctx *WebContext) DelCurrentAccount() error
DelCurrentAccount 删除当前账户
func (*WebContext) GetCurrentAccount ¶
func (ctx *WebContext) GetCurrentAccount() interface{}
GetCurrentAccount 设置当前账户
func (*WebContext) RenderPage ¶
func (ctx *WebContext) RenderPage(data gin.H, opts ...Option)
RenderPage 渲染页面
func (*WebContext) RenderSinglePage ¶
func (ctx *WebContext) RenderSinglePage(data gin.H, opts ...Option)
RenderSinglePage 渲染单页面
func (*WebContext) SetCurrentAccount ¶
func (ctx *WebContext) SetCurrentAccount(data interface{}) error
SetCurrentAccount 设置当前账户
Source Files ¶
Click to show internal directories.
Click to hide internal directories.