コード例 #1
0
func _registerRestControllers() {

	framework.SetFactory("controllers.UserController", func() interface{} {
		service := framework.GetFactory("services.UserService").(services.UserService)
		return rest.NewUserController(service)
	})

	framework.SetFactory("controllers.EventController", func() interface{} {
		service := framework.GetFactory("services.EventService").(services.EventService)
		return rest.NewEventController(service)
	})
}
コード例 #2
0
func _registerAuthControllers() {

	framework.SetFactory("controllers.GoogleController", func() interface{} {
		service := framework.GetFactory("services.UserService").(services.UserService)
		return auth.NewGoogleController(service)
	})

	framework.SetFactory("controllers.FacebookController", func() interface{} {
		service := framework.GetFactory("services.UserService").(services.UserService)
		return auth.NewFacebookController(service)
	})
}
コード例 #3
0
func _registerRepositories() {
	framework.SetFactory("repositories.UserRepository", func() interface{} {
		return mongo.NewUserRepository()
	})

	framework.SetFactory("repositories.EventRepository", func() interface{} {
		return mongo.NewEventRepository()
	})

	framework.SetFactory("repositories.SessionRepository", func() interface{} {
		return mongo.NewSessionRepository()
	})
}
コード例 #4
0
func _registerServices() {
	framework.SetFactory("services.UserService", func() interface{} {

		repository := framework.GetFactory("repositories.UserRepository").(repositories.UserRepository)
		return servicesimpl.NewUserService(repository)
	})

	framework.SetFactory("services.EventService", func() interface{} {

		repository := framework.GetFactory("repositories.EventRepository").(repositories.EventRepository)
		return servicesimpl.NewEventService(repository)
	})

	framework.SetFactory("services.SessionService", func() interface{} {

		repository := framework.GetFactory("repositories.SessionRepository").(repositories.SessionRepository)
		return servicesimpl.NewSessionService(repository)
	})
}