/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

  1. package controller
  2. import "reflect"
  3. import "app/controller/hello"
  4. import "app/controller/signup"
  5. var Controllers = map[string]reflect.Type{}
  6. // var Injectables = map[string]reflect.Value{}
  7. func registerController(s string, c interface{}) {
  8. // v := reflect.ValueOf(c)
  9. t := reflect.Indirect(reflect.ValueOf(c)).Type()
  10. Controllers[s] = t
  11. }
  12. /*
  13. func registerInjectable(s string, c interface{}) {
  14. v := reflect.ValueOf(c)
  15. Injectables[s] = v
  16. }
  17. */
  18. func init() {
  19. registerController("hello", new(hello.HelloController))
  20. registerController("signup", new(signup.SignupController))
  21. // registerInjectable("hello.Session", hello.Session)
  22. }