当前位置: 首页>>代码示例>>Golang>>正文


Golang beego.AddFuncMap函数代码示例

本文整理汇总了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()
}
开发者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


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