Refine the context and Try to fix the nil issue.

This commit is contained in:
zicla
2019-04-28 00:36:21 +08:00
parent fa28bbb83f
commit 3ffc4090e0
34 changed files with 246 additions and 167 deletions

View File

@ -1 +1,30 @@
package core
import (
"github.com/eyebluecn/tank/code/tool/cache"
"github.com/jinzhu/gorm"
"net/http"
)
type Context interface {
//获取数据库链接
GetDB() *gorm.DB
//获取一个Bean
GetBean(bean IBean) IBean
//获取全局的Session缓存
GetSessionCache() *cache.Table
//获取全局的ControllerMap
GetControllerMap() map[string]IController
//响应http的能力
ServeHTTP(writer http.ResponseWriter, request *http.Request)
//系统安装成功
InstallOk()
//清空系统
Cleanup()
}

View File

@ -5,3 +5,6 @@ package core
//日志系统必须高保
//全局唯一的日志对象(在main函数中初始化)
var LOGGER Logger
//全局唯一的上下文(在main函数中初始化)
var CONTEXT Context