本文整理匯總了Golang中github.com/revel/revel.Init函數的典型用法代碼示例。如果您正苦於以下問題:Golang Init函數的具體用法?Golang Init怎麽用?Golang Init使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Init函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: packageApp
func packageApp(args []string) {
if len(args) == 0 {
fmt.Fprint(os.Stderr, cmdPackage.Long)
return
}
// Determine the run mode.
mode := "dev"
if len(args) >= 2 {
mode = args[1]
}
appImportPath := args[0]
revel.Init(mode, appImportPath, "")
// Remove the archive if it already exists.
destFile := filepath.Base(revel.BasePath) + ".tar.gz"
os.Remove(destFile)
// Collect stuff in a temp directory.
tmpDir, err := ioutil.TempDir("", filepath.Base(revel.BasePath))
panicOnError(err, "Failed to get temp dir")
buildApp([]string{args[0], tmpDir, mode})
// Create the zip file.
archiveName := mustTarGzDir(destFile, tmpDir)
fmt.Println("Your archive is ready:", archiveName)
}
示例2: main
func main() {
// go run main.go
// 生成routes.go, main.go
revel.Init("", "github.com/leanote/leanote", "")
_, err := harness.Build() // ok, err
if err != nil {
panic(err)
}
fmt.Println("Ok")
// panicOnError(reverr, "Failed to build")
}
示例3: BenchmarkProcessBookingSource
func BenchmarkProcessBookingSource(b *testing.B) {
revel.Init("", "github.com/revel/revel/samples/booking", "")
revel.TRACE = log.New(ioutil.Discard, "", 0)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := ProcessSource(revel.CodePaths)
if err != nil {
b.Error("Unexpected error:", err)
}
}
}
示例4: generateFiles
func generateFiles(args []string) {
if len(args) != 2 {
fmt.Fprintf(os.Stderr, "%s\n%s", cmdBuild.UsageLine, cmdBuild.Long)
return
}
appImportPath, destPath := args[0], args[1]
if !revel.Initialized {
revel.Init("", appImportPath, "")
}
reverr := harness.Generate(destPath, true)
panicOnError(reverr, "Failed to build")
}
示例5: runApp
func runApp(args []string) {
if len(args) == 0 {
errorf("No import path given.\nRun 'revel help run' for usage.\n")
}
// Determine the run mode.
mode := "dev"
if len(args) >= 2 {
mode = args[1]
}
// Find and parse app.conf
revel.Init(mode, args[0], "")
revel.LoadMimeConfig()
// Determine the override port, if any.
port := revel.HttpPort
if len(args) == 3 {
var err error
if port, err = strconv.Atoi(args[2]); err != nil {
errorf("Failed to parse port as integer: %s", args[2])
}
}
revel.INFO.Printf("Running %s (%s) in %s mode\n", revel.AppName, revel.ImportPath, mode)
revel.TRACE.Println("Base path:", revel.BasePath)
// If the app is run in "watched" mode, use the harness to run it.
if revel.Config.BoolDefault("watch", true) && revel.Config.BoolDefault("watch.code", true) {
revel.TRACE.Println("Running in watched mode.")
revel.HttpPort = port
harness.NewHarness().Run() // Never returns.
}
// Else, just build and run the app.
revel.TRACE.Println("Running in live build mode.")
app, err := harness.Build()
if err != nil {
errorf("Failed to build app: %s", err)
}
app.Port = port
app.Cmd().Run()
}
示例6: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
10: []string{},
},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.DefaultValidationKeys = map[string]map[int]string{}
testing.TestSuites = []interface{}{}
revel.Run(*port)
}
示例7: TestProcessBookingSource
func TestProcessBookingSource(t *testing.T) {
revel.Init("prod", "github.com/revel/revel/samples/booking", "")
sourceInfo, err := ProcessSource([]string{revel.AppPath})
if err != nil {
t.Fatal("Failed to process booking source with error:", err)
}
CONTROLLER_PKG := "github.com/revel/revel/samples/booking/app/controllers"
expectedControllerSpecs := []*TypeInfo{
{"GorpController", CONTROLLER_PKG, "controllers", nil, nil},
{"Application", CONTROLLER_PKG, "controllers", nil, nil},
{"Hotels", CONTROLLER_PKG, "controllers", nil, nil},
}
if len(sourceInfo.ControllerSpecs()) != len(expectedControllerSpecs) {
t.Errorf("Unexpected number of controllers found. Expected %d, Found %d",
len(expectedControllerSpecs), len(sourceInfo.ControllerSpecs()))
}
NEXT_TEST:
for _, expected := range expectedControllerSpecs {
for _, actual := range sourceInfo.ControllerSpecs() {
if actual.StructName == expected.StructName {
if actual.ImportPath != expected.ImportPath {
t.Errorf("%s expected to have import path %s, actual %s",
actual.StructName, expected.ImportPath, actual.ImportPath)
}
if actual.PackageName != expected.PackageName {
t.Errorf("%s expected to have package name %s, actual %s",
actual.StructName, expected.PackageName, actual.PackageName)
}
continue NEXT_TEST
}
}
t.Errorf("Expected to find controller %s, but did not. Actuals: %s",
expected.StructName, sourceInfo.ControllerSpecs())
}
}
示例8: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "admin", Type: reflect.TypeOf((**models.Admin)(nil))},
},
RenderArgNames: map[int][]string{
55: []string{
"title",
},
},
},
&revel.MethodType{
Name: "Main",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "admin", Type: reflect.TypeOf((**models.Admin)(nil))},
},
RenderArgNames: map[int][]string{
106: []string{
"title",
"admin_info",
"system_info",
"panel_list",
},
108: []string{
"title",
},
},
},
})
revel.RegisterController((*controllers0.Category)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"title",
"categorys",
},
29: []string{
"title",
},
},
},
&revel.MethodType{
Name: "Add",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{
51: []string{
"title",
"categorys",
"Id",
},
55: []string{
"title",
"categorys",
},
},
},
&revel.MethodType{
Name: "Edit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{
217: []string{
"title",
"categorys",
"category_info",
},
223: []string{
"title",
"categorys",
},
},
},
&revel.MethodType{
Name: "Delete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.Content)(nil),
[]*revel.MethodType{
&revel.MethodType{
//.........這裏部分代碼省略.........
示例9: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
33: []string{},
},
},
&revel.MethodType{
Name: "UserIndex",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
38: []string{},
},
},
&revel.MethodType{
Name: "UserAdd",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerName", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "UserDelete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerId", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "GameIndex",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
53: []string{},
},
},
&revel.MethodType{
Name: "GameDelete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "platformId", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "gameId", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "SummonerIndex",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
62: []string{},
},
},
&revel.MethodType{
Name: "Summoner",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerName", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
67: []string{},
},
},
&revel.MethodType{
Name: "Record",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "gameId", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "encryptionKey", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerId", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Version",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Metadata",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "id", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "LastChunkInfo",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "id", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "end", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
//.........這裏部分代碼省略.........
示例10: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.Application)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
10: []string{},
},
},
})
revel.RegisterController((*controllers.Sample2)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
12: []string{},
},
},
&revel.MethodType{
Name: "HandleSubmit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "username", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "firstname", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "lastname", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "age", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "passwordConfirm", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "email", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "emailConfirm", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "termsOfUse", Type: reflect.TypeOf((*bool)(nil))},
},
RenderArgNames: map[int][]string{
46: []string{
"username",
"firstname",
"lastname",
"age",
"password",
"email",
},
},
},
})
revel.RegisterController((*controllers.Sample3)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
13: []string{},
},
},
&revel.MethodType{
Name: "HandleSubmit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "user", Type: reflect.TypeOf((**models.User)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"user",
},
},
},
})
revel.RegisterController((*controllers.Sample4)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
13: []string{},
},
},
&revel.MethodType{
Name: "HandleSubmit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "user", Type: reflect.TypeOf((**models.User)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"user",
},
},
},
})
revel.RegisterController((*controllers.Sample1)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
//.........這裏部分代碼省略.........
示例11: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
17: []string{},
},
},
&revel.MethodType{
Name: "AddUser",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Logout",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
70: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
107: []string{},
},
},
&revel.MethodType{
Name: "List",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Users)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Login",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "login", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Signup",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
43: []string{},
},
},
&revel.MethodType{
Name: "SaveUser",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "login", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
//.........這裏部分代碼省略.........
示例12: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.AbstractController)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Begin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Commit",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Rollback",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "RenderLogin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "RenderNoAdmin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.User)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "GetUsers",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "userId", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "GetUserByName",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "name", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"user",
"nil",
},
},
},
&revel.MethodType{
Name: "Setting",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "sid", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "gender", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "age", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "lllness", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{
39: []string{
"res",
"err",
},
},
},
&revel.MethodType{
Name: "GetTopicList",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "uid", Type: reflect.TypeOf((*int64)(nil))},
&revel.MethodArg{Name: "page", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "limit", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{
51: []string{
//.........這裏部分代碼省略.........
示例13: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
10: []string{},
},
},
})
revel.RegisterController((*controllers.Auth)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Callback",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Logout",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Home)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
24: []string{},
},
},
})
revel.RegisterController((*controllers.Tasks)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "tag", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
24: []string{
"tasks",
"username",
"userimg",
"tags",
"tag",
},
},
},
&revel.MethodType{
Name: "New",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "task", Type: reflect.TypeOf((*models.Task)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Complete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "id", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "complete", Type: reflect.TypeOf((*bool)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Completed",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
59: []string{
"tasks",
"username",
"userimg",
"tags",
},
},
},
})
revel.RegisterController((*controllers0.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
46: []string{
"testSuites",
//.........這裏部分代碼省略.........
示例14: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.DatabaseController)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Begin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Commit",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Rollback",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
46: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
69: []string{
"error",
},
},
},
&revel.MethodType{
Name: "List",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Application)(nil),
[]*revel.MethodType{})
revel.RegisterController((*controllers.Home)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
31: []string{},
},
},
&revel.MethodType{
Name: "About",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
35: []string{},
},
},
&revel.MethodType{
Name: "Overview",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
//.........這裏部分代碼省略.........
示例15: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.BaseController)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Before",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
70: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
107: []string{},
},
},
&revel.MethodType{
Name: "List",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Admin)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "ListUser",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "limit", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "offset", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{
73: []string{
"users",
"profiles",
"depts",
"pages",
"userLevel",
},
},
},
&revel.MethodType{
Name: "AddUser",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
85: []string{
"depts",
"userLevel",
"employmentType",
},
},
},
&revel.MethodType{
Name: "DoAddUser",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "username", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "name", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "phone", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "phone1", Type: reflect.TypeOf((*string)(nil))},
//.........這裏部分代碼省略.........