diff --git a/TODO b/TODO index 053b2292f..a3eafd465 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,7 @@ ON THE WAY: 1. 增加对于数据表Model的封装; 2. ghttp.Server平滑重启方案; +3. 更多数据库的ORM支持; DONE: diff --git a/g/frame/gins/gins.go b/g/frame/gins/gins.go index e07f79a1e..688c8a1ab 100644 --- a/g/frame/gins/gins.go +++ b/g/frame/gins/gins.go @@ -61,6 +61,16 @@ func SetDatabase(v *gdb.Db, name...string) { instances.Set(dbCacheKey, v) } +// 自定义框架核心组件:Redis +func SetRedis(v *gredis.Redis, name...string) { + dbCacheKey := gFRAME_CORE_COMPONENT_NAME_REDIS + if len(name) > 0 { + dbCacheKey += name[0] + } + instances.Set(dbCacheKey, v) +} + + // 核心对象:View func View() *gview.View { result := Get(gFRAME_CORE_COMPONENT_NAME_VIEW)