• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang beego.AddFuncMap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/astaxie/beego.AddFuncMap函数的典型用法代码示例。如果您正苦于以下问题:Golang AddFuncMap函数的具体用法?Golang AddFuncMap怎么用?Golang AddFuncMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AddFuncMap函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
}
开发者ID:vv1133,项目名称:vvblog,代码行数:7,代码来源:main.go


示例2: AddFuncMap

func AddFuncMap() {
	beego.AddFuncMap("balance", ParseBalance)
	beego.AddFuncMap("checkstr", CheckStr)
	beego.AddFuncMap("lockStatusStr", LockStatusStr)
	beego.AddFuncMap("calcPrice", CalcPrice)
	beego.AddFuncMap("parseOrderDate", ParseOrderDate)
}
开发者ID:vickysongang,项目名称:POIWolaiMonitor,代码行数:7,代码来源:TemplateFunc.go


示例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()
}
开发者ID:juju2013,项目名称:gowalker,代码行数:34,代码来源:gowalker.go


示例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()
}
开发者ID:fxgcj,项目名称:website,代码行数:35,代码来源:main.go


示例5: main

func main() {
	beego.AddFuncMap("fileConv", convertTypetoIcon)
	beego.AddFuncMap("genBackBtn", genBackBtn)
	beego.AddFuncMap("genLink", genLink)
	beego.AddFuncMap("converTime", converTime)
	beego.Run()
}
开发者ID:youxidev,项目名称:upyun_sync,代码行数:7,代码来源:main.go


示例6: init

func init() {
	// Register template functions.
	beego.AddFuncMap("date", date)
	beego.AddFuncMap("datetime", datetime)
	beego.AddFuncMap("datetimes", datetimes)
	beego.AddFuncMap("loadtimes", loadtimes)
}
开发者ID:codeshredder,项目名称:infoboard,代码行数:7,代码来源:date.go


示例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"}

}
开发者ID:saturn4er,项目名称:beego-assets,代码行数:8,代码来源:init.go


示例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()
}
开发者ID:Cheng-Bin,项目名称:GO-BBS,代码行数:8,代码来源:main.go


示例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)

}
开发者ID:pazjacket,项目名称:kwgch-_-beeapp,代码行数:17,代码来源:main.go


示例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()
}
开发者ID:carvenli,项目名称:SCBlog,代码行数:56,代码来源:SCBlog.go


示例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()
}
开发者ID:zhongjianscau,项目名称:goblog,代码行数:10,代码来源:main.go


示例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()

}
开发者ID:grr89,项目名称:hrkb,代码行数:26,代码来源:base.go


示例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)
}
开发者ID:zbzzbd,项目名称:beego,代码行数:12,代码来源:init.go


示例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)
}
开发者ID:yubo,项目名称:falcon,代码行数:13,代码来源:template.go


示例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)
}
开发者ID:thuongdinh,项目名称:beegowebapp,代码行数:13,代码来源:template.go


示例16: main

func main() {
	beego.SessionOn = true
	beego.ErrorController(&controllers.ErrorController{})
	beego.AddFuncMap("i18n", i18n.Tr)

	beego.EnableAdmin = true // Port 8088

	beego.SetLogger("file", `{"filename":"logs/juna.log"}`)
	beego.SetLevel(beego.LevelInformational)
	beego.SetLogFuncCall(true)

	beego.AddFuncMap("news", news)
	beego.Run()
}
开发者ID:shenyp09,项目名称:juna,代码行数:14,代码来源:main.go


示例17: main

func main() {

	initialize()

	beego.Info(beego.AppName, APP_VER)

	beego.InsertFilter("/docs/images/:all", beego.BeforeRouter, routers.DocsStatic)

	if !routers.IsPro {
		beego.SetStaticPath("/static_source", "static_source")
		beego.DirectoryIndex = true
	}

	beego.SetStaticPath("/products/images", "products/images/")

	// Register routers.
	beego.Router("/", &routers.HomeRouter{})
	beego.Router("/community", &routers.CommunityRouter{})
	beego.Router("/quickstart", &routers.QuickStartRouter{})
	beego.Router("/video", &routers.VideoRouter{})
	beego.Router("/products", &routers.ProductsRouter{})
	beego.Router("/team", &routers.PageRouter{})
	beego.Router("/about", &routers.AboutRouter{})
	beego.Router("/donate", &routers.DonateRouter{})
	beego.Router("/docs/", &routers.DocsRouter{})
	beego.Router("/docs/:all", &routers.DocsRouter{})
	beego.Router("/blog", &routers.BlogRouter{})
	beego.Router("/blog/:all", &routers.BlogRouter{})

	// Register template functions.
	beego.AddFuncMap("i18n", i18n.Tr)

	beego.Run()
}
开发者ID:ningjh,项目名称:beeweb,代码行数:34,代码来源:beeweb.go


示例18: init

func init() {
	setting, err := compress.LoadJsonConf("conf/compress.json", true, "/")
	if err != nil {
		panic("LoadJsonConf compress.json err:" + err.Error())
	}

	setting.RunCommand()

	setting.RunCompress(true, false, true)

	beego.AddFuncMap("compress_js", setting.Js.CompressJs)
	beego.AddFuncMap("compress_css", setting.Css.CompressCss)
	beego.AddFuncMap("i18n", i18n)
	beego.AddFuncMap("config", config)
	beego.AddFuncMap("docs", docs)
}
开发者ID:ronggenliu,项目名称:ngbee,代码行数:16,代码来源:tplfunc.go


示例19: main

func main() {

	initialize()

	beego.Info(beego.AppName, APP_VER)

	beego.AddFilter("/docs/images/:all", "BeforeRouter", routers.DocsStatic)

	// Register routers.
	beego.Router("/", &routers.HomeRouter{})
	beego.Router("/community", &routers.CommunityRouter{})
	beego.Router("/quickstart", &routers.QuickStartRouter{})
	beego.Router("/team", &routers.PageRouter{})
	beego.Router("/about", &routers.AboutRouter{})
	beego.Router("/donate", &routers.DonateRouter{})
	beego.Router("/docs/", &routers.DocsRouter{})
	beego.Router("/docs/:all", &routers.DocsRouter{})
	beego.Router("/blog", &routers.BlogRouter{})
	beego.Router("/blog/:all", &routers.BlogRouter{})
	// beego.Router("/samples", &routers.SamplesRouter{})
	// beego.Router("/samples/:all", &routers.SamplesRouter{})

	// Register template functions.
	beego.AddFuncMap("i18n", i18n.Tr)

	beego.Run()
}
开发者ID:858806258,项目名称:beeweb,代码行数:27,代码来源:beeweb.go


示例20: main

func main() {

	//初始化
	initialize()

	beego.Info(beego.AppName, APP_VER)

	if !controllers.IsPro {
		beego.SetStaticPath("/static_source", "static_source")
		beego.DirectoryIndex = true
	}

	// 开启 ORM 调试模式
	orm.Debug = true
	// 自动建表
	orm.RunSyncdb("default", false, true)

	beego.Router("/", &controllers.MainController{})
	beego.Router("/user/reg", &controllers.UserController{}, "post:reg")

	// Register template functions.
	beego.AddFuncMap("i18n", i18n.Tr)

	beego.Run()
}
开发者ID:javazhen,项目名称:blog,代码行数:25,代码来源:main.go



注:本文中的github.com/astaxie/beego.AddFuncMap函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang beego.AddNamespace函数代码示例发布时间:2022-05-24
下一篇:
Golang context.Context类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap