本文整理汇总了Golang中github.com/astaxie/beego.AddFuncMap函数的典型用法代码示例。如果您正苦于以下问题:Golang AddFuncMap函数的具体用法?Golang AddFuncMap怎么用?Golang AddFuncMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddFuncMap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
beego.AddFuncMap("Preview", common.Preview)
beego.AddFuncMap("GetId", common.GetId)
beego.AddFuncMap("LoadTimes", common.LoadTimes)
beego.AddFuncMap("GetTagSlug", common.GetTagSlug)
beego.Run()
}
示例2: AddFuncMap
func AddFuncMap() {
beego.AddFuncMap("balance", ParseBalance)
beego.AddFuncMap("checkstr", CheckStr)
beego.AddFuncMap("lockStatusStr", LockStatusStr)
beego.AddFuncMap("calcPrice", CalcPrice)
beego.AddFuncMap("parseOrderDate", ParseOrderDate)
}
示例3: main
func main() {
initialize()
go catchExit()
beego.Info(beego.AppName, APP_VER)
// Register routers.
beego.Router("/", &routers.HomeRouter{})
beego.Router("/refresh", &routers.RefreshRouter{})
beego.Router("/search", &routers.SearchRouter{})
beego.Router("/index", &routers.IndexRouter{})
// beego.Router("/label", &routers.LabelsRouter{})
beego.Router("/function", &routers.FuncsRouter{})
beego.Router("/example", &routers.ExamplesRouter{})
beego.Router("/about", &routers.AboutRouter{})
beego.Router("/api/v1/badge", &routers.ApiRouter{}, "get:Badge")
// Register template functions.
beego.AddFuncMap("i18n", i18n.Tr)
beego.AddFuncMap("isHasEleS", isHasEleS)
beego.AddFuncMap("isHasEleE", isHasEleE)
beego.AddFuncMap("isNotEmptyS", isNotEmptyS)
// "robot.txt"
beego.Router("/robots.txt", &routers.RobotRouter{})
// For all unknown pages.
beego.Router("/:all", &routers.HomeRouter{})
// Static path.
beego.SetStaticPath("/public", "public")
beego.Run()
}
示例4: BeegoInit
func BeegoInit() {
beego.RunMode = config.AppConfig.RunMode
beego.AppName = config.AppConfig.Name
beego.HttpPort = config.AppConfig.Port
beego.BeegoServerName = config.AppConfig.ServerName
beego.SessionOn = true
beego.SessionName = "ckeyer"
// beego.SessionDomain = "fxgcj.org"
beego.SessionAutoSetCookie = true
beego.AddFuncMap("showMonth", func(m int) string {
mstr := fmt.Sprint(m)
if len(mstr) == 6 {
return fmt.Sprintf("%s-%s", mstr[:4], mstr[4:])
}
return mstr
})
beego.AddFuncMap("showDate", func(t time.Time) string {
return fmt.Sprintf("%d-%02d-%02d %02d:%02d", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute())
})
beego.AddFuncMap("showObjectID", func(obj bson.ObjectId) string {
return obj.Hex()
})
beego.AddFuncMap("setURLMonth", func(m string) string {
mstr := strings.Split(m, "-")
if len(mstr) == 2 {
return fmt.Sprintf("%s/%s", mstr[0], mstr[1])
}
return ""
})
beego.AddFuncMap("Add", func(a, b int) string {
return fmt.Sprint(a + b)
})
routers.LoadRouters()
}
示例5: main
func main() {
beego.AddFuncMap("fileConv", convertTypetoIcon)
beego.AddFuncMap("genBackBtn", genBackBtn)
beego.AddFuncMap("genLink", genLink)
beego.AddFuncMap("converTime", converTime)
beego.Run()
}
示例6: init
func init() {
// Register template functions.
beego.AddFuncMap("date", date)
beego.AddFuncMap("datetime", datetime)
beego.AddFuncMap("datetimes", datetimes)
beego.AddFuncMap("loadtimes", loadtimes)
}
示例7: init
func init() {
Logger.SetLogger("console", "")
beego.AddFuncMap("asset_js", getAssetHelper(ASSET_JAVASCRIPT))
beego.AddFuncMap("asset_css", getAssetHelper(ASSET_STYLESHEET))
Config.extensions[ASSET_JAVASCRIPT] = []string{".js"}
Config.extensions[ASSET_STYLESHEET] = []string{".css"}
}
示例8: main
func main() {
beego.SessionOn = true
beego.AddFuncMap("Index", Index)
beego.AddFuncMap("Count", GetCount)
beego.AddFuncMap("ResCount", GetResCount)
beego.AddFilter("/admin/:all", "AfterStatic", FilterUser)
beego.Run()
}
示例9: init
/*
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
mysql> GRANT USAGE ON *.* TO 'dummy'@'localhost';
*/
func init() {
//CREATE USER user1 IDENTIFIED BY [PASSWORD] 'password1'
orm.RegisterDataBase("default", "mysql", "user1:[email protected]/beeapp?charset=utf8", 30)
orm.RegisterModel(new(models.Greeting))
beego.AddFuncMap("dateformat", dateformat)
beego.AddFuncMap("nl2br", nl2br)
}
示例10: main
func main() {
// 注册静态文件
beego.SetStaticPath("/static", "static")
// 自定义404错误页
beego.ErrorController(&controllers.ErrorController{})
// 首页路由
beego.Router("/", &controllers.IndexController{}, "get:Index")
// 文章路由
beego.Router("/:slug", &controllers.IndexController{}, "get:View")
// 内链跳转
beego.Router("/go/:caption", &controllers.IndexController{}, "get:GoLink")
// 搜索
beego.Router("/search", &controllers.IndexController{}, "get:Search")
// 标签页面
beego.Router("/tag/:tag", &controllers.IndexController{}, "get:TagList")
// 后台验证码
beego.Router("/captcha", &controllers.LoginController{}, "get:Captcha")
// 后台登录
beego.Router("/admin/login", &controllers.LoginController{}, "*:Index")
// 退出登录
beego.Router("/admin/logout", &controllers.LoginController{}, "*:Logout")
// 后台首页
beego.Router("/admin", &controllers.AdminController{}, "get:Index")
// 新建文章
beego.Router("/admin/new", &controllers.AdminController{}, "get:New")
// 编辑文章
beego.Router("/admin/edit/:id", &controllers.AdminController{}, "get:Edit")
// 提交文章
beego.Router("/admin/edit", &controllers.AdminController{}, "post:Edit")
// 删除文章
beego.Router("/admin/del/:id", &controllers.AdminController{}, "get:Del")
// 内链管理
beego.Router("/admin/redirect", &controllers.AdminController{}, "*:External")
// 内链修改
beego.Router("/admin/redirect/:id", &controllers.AdminController{}, "get:External")
// 内链删除
beego.Router("/admin/redirect/del/:id", &controllers.AdminController{}, "get:DelExternal")
// 系统设置
beego.Router("/admin/setting", &controllers.AdminController{}, "*:Setting")
// 获取汉字转拼音
beego.Router("/admin/pinyin/:str", &controllers.AdminController{}, "get:PinYin")
// 上传文件
beego.Router("/admin/upload", &controllers.AdminController{}, "post:Upload")
// 注册函数
beego.AddFuncMap("Preview", common.Preview)
beego.AddFuncMap("GetId", common.GetId)
beego.AddFuncMap("Gravatar", common.Gravatar)
beego.AddFuncMap("GetTagSlug", common.GetTagSlug)
beego.AddFuncMap("LoadTimes", common.LoadTimes)
beego.Run()
}
示例11: main
func main() {
orm.Debug = true
orm.RunSyncdb("default", false, true)
beego.SessionOn = true
//模板函数
beego.AddFuncMap("time", timeformat)
beego.AddFuncMap("time1", timeformat1)
beego.Run()
}
示例12: CtrlInit
func CtrlInit() {
staticDir = beego.AppConfig.String("staticDir")
CandDateFmt = beego.AppConfig.String("comments::cand_date_format")
TrashDateFmt = beego.AppConfig.String("comments::trash_date_format")
gitlabUrl = beego.AppConfig.String("gitlab::url")
gitlabProject = beego.AppConfig.String("gitlab::project")
beego.AddFuncMap("urlFor", beego.UrlFor)
beego.AddFuncMap("js", js)
beego.AddFuncMap("css", css)
beego.AddFuncMap("kb", kb)
beego.AddFuncMap("isImg", isImg)
beego.AddFuncMap("cutStr", CutLongText)
beego.AddFuncMap("urlContain", urlContain)
beego.AddFuncMap("T", i18n.IdentityTfunc)
beego.AddFuncMap("floatStr", floatToString)
DM = M.GetDM()
// init notify service
initNotifyService()
initBot()
}
示例13: InitHelper
func InitHelper() {
beego.AddFuncMap("TimeFormat", TimeFormat)
beego.AddFuncMap("Strcat", Strcat)
beego.AddFuncMap("ShowMenu", ShowMenu)
beego.AddFuncMap("AddInt", AddInt)
beego.AddFuncMap("GetStatusDesc", GetStatusDesc)
beego.AddFuncMap("GetStatusColor", GetStatusColor)
beego.AddFuncMap("GetTimeDiff", GetTimeDiff)
beego.AddFuncMap("GetRoleDesc", GetRoleDesc)
beego.AddFuncMap("RequiredStar", RequiredStar)
beego.AddFuncMap("TimeIsZero", TimeIsZero)
}
示例14: init
func init() {
// Register template functions.
beego.AddFuncMap("i18n", i18nHTML)
beego.AddFuncMap("boolicon", boolicon)
beego.AddFuncMap("date", date)
beego.AddFuncMap("datetime", datetime)
beego.AddFuncMap("datetimes", datetimes)
beego.AddFuncMap("dict", dict)
beego.AddFuncMap("timesince", timesince)
beego.AddFuncMap("loadtimes", loadtimes)
beego.AddFuncMap("sum", sum)
beego.AddFuncMap("loginto", loginto)
}
示例15: init
func init() {
// Register template functions.
beego.AddFuncMap("i18n", i18nHTML)
beego.AddFuncMap("boolicon", boolicon)
beego.AddFuncMap("date", date)
beego.AddFuncMap("datetime", datetime)
beego.AddFuncMap("dict", dict)
beego.AddFuncMap("timesince", timesince)
beego.AddFuncMap("loadtimes", loadtimes)
beego.AddFuncMap("sum", sum)
beego.AddFuncMap("loginto", loginto)
beego.AddFuncMap("initajaxurl", generateInitialAjaxUrlVariable)
}