本文整理汇总了Golang中github.com/revel/revel.InterceptMethod函数的典型用法代码示例。如果您正苦于以下问题:Golang InterceptMethod函数的具体用法?Golang InterceptMethod怎么用?Golang InterceptMethod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InterceptMethod函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
// Filters is the default set of global filters.
revel.Filters = []revel.Filter{
revel.PanicFilter, // Recover from panics and display an error page instead.
revel.RouterFilter, // Use the routing table to select the right Action
revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
revel.ParamsFilter, // Parse parameters into Controller.Params.
revel.SessionFilter, // Restore and write the session cookie.
revel.FlashFilter, // Restore and write the flash cookie.
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
revel.I18nFilter, // Resolve the requested language
HeaderFilter, // Add some security based headers
revel.InterceptorFilter, // Run interceptors around the action.
revel.CompressFilter, // Compress the result.
revel.ActionInvoker, // Invoke the action.
}
// register startup functions with OnAppStart
// ( order dependent )
revel.OnAppStart(controllers.InitDB)
revel.InterceptMethod((*controllers.GormController).Begin, revel.BEFORE)
revel.InterceptMethod((*controllers.GormController).Commit, revel.AFTER)
revel.InterceptMethod((*controllers.GormController).Rollback, revel.FINALLY)
// revel.OnAppStart(FillCache)
}
开发者ID:ehrudxo,项目名称:GoMap,代码行数:25,代码来源:init.go
示例2: init
func init() {
revel.OnAppStart(Initialize)
revel.InterceptMethod((*DatabaseController).Begin, revel.BEFORE)
//revel.InterceptMethod((*Profile).Index, revel.BEFORE)
revel.InterceptMethod((*DatabaseController).Commit, revel.AFTER)
revel.InterceptMethod((*DatabaseController).Rollback, revel.FINALLY)
}
开发者ID:revolvingcow,项目名称:grassfed,代码行数:7,代码来源:init.go
示例3: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE)
revel.InterceptMethod((*GorpController).Commit, revel.AFTER)
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY)
}
开发者ID:wp132422,项目名称:GOBOARD,代码行数:7,代码来源:init.go
示例4: init
func init() {
revel.InterceptMethod((*XormController).Attach, revel.BEFORE)
revel.InterceptMethod((*XormController).Commit, revel.AFTER)
revel.InterceptMethod((*XormController).Detach, revel.FINALLY)
revel.InterceptMethod((*XormSessionController).Attach, revel.BEFORE)
revel.OnAppStart(Init)
}
开发者ID:nashtsai,项目名称:xormrevelmodule,代码行数:7,代码来源:plugin.go
示例5: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE)
revel.InterceptMethod(Application.AddUser, revel.BEFORE)
revel.InterceptMethod(Hotels.checkUser, revel.BEFORE)
revel.InterceptMethod((*GorpController).Commit, revel.AFTER)
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY)
}
开发者ID:R510,项目名称:revel,代码行数:8,代码来源:init.go
示例6: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptMethod((*XOrmController).Begin, revel.BEFORE)
revel.InterceptMethod((*XOrmTnController).Begin, revel.BEFORE)
revel.InterceptMethod((*XOrmTnController).Commit, revel.AFTER)
revel.InterceptMethod((*XOrmTnController).Rollback, revel.PANIC)
}
开发者ID:netw0rm,项目名称:reweb,代码行数:8,代码来源:init.go
示例7: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE)
revel.InterceptMethod(Application.authorize, revel.BEFORE)
revel.InterceptMethod(Application.setLoginUrl, revel.BEFORE)
revel.InterceptMethod((*GorpController).Commit, revel.AFTER)
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY)
}
开发者ID:k0kubun,项目名称:pr_viewer,代码行数:8,代码来源:init.go
示例8: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE)
revel.InterceptMethod(Application.SetAccount, revel.BEFORE)
revel.InterceptMethod(Dashboard.checkAccount, revel.BEFORE)
revel.InterceptMethod((*GorpController).Commit, revel.AFTER)
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY)
}
开发者ID:joho,项目名称:firesize,代码行数:8,代码来源:init.go
示例9: init
// in your app initialization..
func init() {
revel.TemplateFuncs["appendjs"] = func(renderArgs map[string]interface{}, key string, value interface{}) template.HTML {
s := value.(string)
js_code := template.JS(s)
if renderArgs[key] == nil {
renderArgs[key] = []interface{}{js_code}
} else {
renderArgs[key] = append(renderArgs[key].([]interface{}), js_code)
}
return template.HTML("")
}
// Filters is the default set of global filters.
revel.Filters = []revel.Filter{
revel.PanicFilter, // Recover from panics and display an error page instead.
revel.RouterFilter, // Use the routing table to select the right Action
revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
revel.ParamsFilter, // Parse parameters into Controller.Params.
revel.SessionFilter, // Restore and write the session cookie.
revel.FlashFilter, // Restore and write the flash cookie.
csrf.CSRFFilter, // CSRF prevention.
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
revel.I18nFilter, // Resolve the requested language
HeaderFilter, // Add some security based headers
revel.InterceptorFilter, // Run interceptors around the action.
revel.ActionInvoker, // Invoke the action.
}
revel.OnAppStart(func() {
appPath := revel.BasePath
for _, AC := range compilers {
path := filepath.Join(appPath, AC.Path)
revel.INFO.Printf("Listening: %q\n", path)
revel.MainWatcher.Listen(AC, path)
}
})
// DB related stuff
// add interceptors
revel.InterceptMethod((*ctrl.DbController).Begin, revel.BEFORE)
revel.InterceptMethod(ctrl.App.RenderArgsFill, revel.BEFORE)
revel.InterceptMethod(ctrl.User.CheckLoggedIn, revel.BEFORE)
revel.InterceptMethod((*ctrl.DbController).Commit, revel.AFTER)
revel.InterceptMethod((*ctrl.DbController).Rollback, revel.FINALLY)
// revel.InterceptMethod((*ctrl.DbController).GetUserLogin, revel.BEFORE)
revel.OnAppStart(func() {
ctrl.InitDB()
if revel.RunMode == "dev" {
ctrl.SetupDevDB()
}
if revel.RunMode == "prod" {
ctrl.SetupTables()
}
})
}
开发者ID:kcolls,项目名称:revel-modz,代码行数:59,代码来源:init.go
示例10: init
func init() {
revel.OnAppStart(InitDB) // DBやテーブルの作成
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE) // transaction開始
revel.InterceptMethod((*GorpController).Commit, revel.AFTER) // 変更反映
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY) // 異常時処理
revel.InterceptMethod(App.AddUser, revel.BEFORE) // ログインユーザーの追加
revel.InterceptMethod(Events.checkUser, revel.BEFORE) // ログインの確認
}
开发者ID:akaimo,项目名称:iidaPro-2015-Server,代码行数:9,代码来源:init.go
示例11: init
func init() {
revel.OnAppStart(GorpInit)
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE)
revel.InterceptMethod((*User).getUserLogin, revel.BEFORE)
revel.InterceptMethod((*GorpController).Commit, revel.AFTER)
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY)
revel.TemplateFuncs["eq"] = func(a, b interface{}) bool { return a == b }
}
开发者ID:kcolls,项目名称:revel-modz,代码行数:10,代码来源:init.go
示例12: StartApp
func StartApp() {
revel.INFO.Printf("Beginning Initialization Process...")
// Load Database Connections
revel.INFO.Printf("Connecting to Database...")
session, err := mgo.Dial("mongodb://leath:[email protected]:10000/list")
if err != nil {
panic(err)
}
collection = session.DB("list").C("classes")
users = session.DB("list").C("users")
rand.Seed(time.Now().UnixNano())
// Start Parsing Lou's List
revel.INFO.Printf("Launching Parser...")
jobs.Now(Parser{})
jobs.Every(1*time.Hour, Parser{})
// Regex to Recognize Classes
revel.INFO.Printf("Compiling Regular Expressions...")
classRegex = regexp.MustCompile(`([A-z]{1,4})\s?(\d{4})\s?(?::{((?:,?\s?\d{1,3})+)})?`)
sectionRegex = regexp.MustCompile(`\d{1,3}`)
/* revel.INFO.Printf("Adding Template Functions...")
CreateTemplateFunctions()*/
// Interceptions
revel.INFO.Printf("Starting Interceptors...")
revel.InterceptMethod(App.Init, revel.BEFORE)
revel.INFO.Printf("Initialization Complete")
}
开发者ID:huntaub,项目名称:list,代码行数:33,代码来源:init.go
示例13: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptFunc(checkUser, revel.BEFORE, &Post{})
revel.InterceptFunc(checkUser, revel.BEFORE, &Profile{})
revel.InterceptFunc(checkUser, revel.BEFORE, &Asset{})
revel.InterceptFunc(adminOnly, revel.BEFORE, &Contributor{})
revel.InterceptFunc(adminOnly, revel.BEFORE, &SiteInfo{})
//revel.InterceptFunc(adminOnly, revel.BEFORE, &Category{})
revel.InterceptMethod((*GormController).Begin, revel.BEFORE)
revel.InterceptMethod((*GormController).Commit, revel.AFTER)
revel.InterceptMethod((*GormController).RollBack, revel.FINALLY)
revel.TemplateFuncs["config"] = func(key string) string {
return revel.Config.StringDefault(key, "")
}
}
开发者ID:bertzzie,项目名称:obrolansubuh-backend,代码行数:17,代码来源:init.go
示例14: init
func init() {
revel.OnAppStart(Init)
revel.InterceptMethod((*Application).checkUser, revel.BEFORE)
revel.TemplateFuncs["eqis"] = func(i int64, s string) bool {
return strconv.FormatInt(i, 10) == s
}
}
开发者ID:nashtsai,项目名称:gorevel,代码行数:8,代码来源:init.go
示例15: init
func init() {
// Set up the database.
revel.OnAppStart(InitDB)
// Start running the probes.
revel.OnAppStart(func() {
jobs.Every(10*time.Second, ProbeJob{})
})
// Before a request, make sure the right API token is set.
revel.InterceptMethod((*GorpController).CheckToken, revel.BEFORE)
// Before a request, we want to start a transaction.
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE)
// revel.InterceptMethod(Application.AddUser, revel.BEFORE)
// revel.InterceptMethod(Hotels.checkUser, revel.BEFORE)
// When a request is done, we want to commit the transaction.
revel.InterceptMethod((*GorpController).Commit, revel.AFTER)
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY)
}
开发者ID:hackerlist,项目名称:monty,代码行数:22,代码来源:init.go
示例16: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptMethod((*GorpController).Begin, revel.BEFORE)
revel.InterceptMethod(Account.AddAppName, revel.BEFORE)
revel.InterceptMethod(Account.AddRenderMode, revel.BEFORE)
revel.InterceptMethod(Account.AddUser, revel.BEFORE)
revel.InterceptMethod((*GorpController).Commit, revel.AFTER)
revel.InterceptMethod((*GorpController).Rollback, revel.FINALLY)
}
开发者ID:jango2015,项目名称:baseapp,代码行数:9,代码来源:init.go
示例17: init
func init() {
revel.InterceptMethod((*MongoController).Open, revel.BEFORE)
revel.InterceptMethod((*MongoController).Close, revel.AFTER)
revel.InterceptMethod((*MongoController).Error, revel.PANIC)
}
开发者ID:dbenson24,项目名称:revel-testing,代码行数:5,代码来源:mongodb.go
示例18: init
func init() {
revel.InterceptMethod((*Nodes).Before, revel.BEFORE)
}
开发者ID:huoshiqiu,项目名称:mediom,代码行数:3,代码来源:nodes.go
示例19: init
func init() {
// revel.OnAppStart(InitDb)
revel.InterceptMethod((*AbstractController).Begin, revel.BEFORE)
revel.InterceptMethod((*AbstractController).Commit, revel.AFTER)
revel.InterceptMethod((*AbstractController).Rollback, revel.FINALLY)
}
开发者ID:nangong92t,项目名称:go_src,代码行数:6,代码来源:init.go
示例20: init
func init() {
revel.InterceptMethod((*Users).Before, revel.BEFORE)
// revel.InterceptMethod((*Users).After, revel.AFTER)
}
开发者ID:codedogfish,项目名称:mediom,代码行数:4,代码来源:users.go
注:本文中的github.com/revel/revel.InterceptMethod函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论