PageRenderTime 84ms CodeModel.GetById 79ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/app/controller/_init.go

http://github.com/sut-go/gon
Go | 27 lines | 13 code | 5 blank | 9 comment | 0 complexity | e56195c6bf75f047684a84043e063e7f MD5 | raw file
 1package controller
 2
 3import "reflect"
 4import "app/controller/hello"
 5import "app/controller/signup"
 6
 7var Controllers = map[string]reflect.Type{}
 8// var Injectables = map[string]reflect.Value{}
 9
10func registerController(s string, c interface{}) {
11    // v := reflect.ValueOf(c)
12    t := reflect.Indirect(reflect.ValueOf(c)).Type()
13    Controllers[s] = t
14}
15
16/*
17func registerInjectable(s string, c interface{}) {
18    v := reflect.ValueOf(c)
19    Injectables[s] = v
20}
21*/
22
23func init() {
24    registerController("hello", new(hello.HelloController))
25    registerController("signup", new(signup.SignupController))
26    // registerInjectable("hello.Session", hello.Session)
27}