Orivil - Go 的 Web 框架


MIT
跨平台
Google Go

软件简介

Orivil 是由 golang 开发的全新 web 框架,灵感来源于
Laravel
Symfony

注册服务

func (*Register) RegisterService(c *service.Container) {

   // 注册 session 服务
   c.Add(SvcSession, func(c *service.Container) interface{} {

      // 从容器中获取依赖
      app := c.Get(orivil.SvcApp).(*orivil.App)

      // 注入依赖
      return NewSession(app.Response, app.Request)
   })
}

获取服务

func (c *Controller) Logout() {

   // 从容器中取出服务
   session := c.Get(SvcSession).(*Session)

   session.Del("login")
}