sort tables by name

fix typo
This commit is contained in:
Nemo
2020-04-06 17:05:34 +08:00
parent 79eba1ca61
commit 034506e602
10 changed files with 75 additions and 69 deletions

View File

@@ -9,9 +9,9 @@ import (
"github.com/jinzhu/gorm"
)
var gloabIsRelated bool // 全局预加载
var globalIsRelated bool // 全局预加载
// prepare for outher
// prepare for other
type _BaseMgr struct {
*gorm.DB
ctx *context.Context
@@ -61,12 +61,12 @@ func (f optionFunc) apply(o *options) {
// OpenRelated 打开全局预加载
func OpenRelated() {
gloabIsRelated = true
globalIsRelated = true
}
// CloseRelated 关闭全局预加载
func CloseRelated() {
gloabIsRelated = true
globalIsRelated = true
}
`
@@ -81,7 +81,7 @@ func {{$obj.StructName}}Mgr(db *gorm.DB) *_{{$obj.StructName}}Mgr {
if db == nil {
panic(fmt.Errorf("{{$obj.StructName}}Mgr need init by db"))
}
return &_{{$obj.StructName}}Mgr{_BaseMgr: &_BaseMgr{DB: db, isRelated: gloabIsRelated}}
return &_{{$obj.StructName}}Mgr{_BaseMgr: &_BaseMgr{DB: db, isRelated: globalIsRelated}}
}
// GetTableName get sql table name.获取数据库名字

View File

@@ -6,9 +6,9 @@ import (
"github.com/jinzhu/gorm"
)
var gloabIsRelated bool // 全局预加载
var globalIsRelated bool // 全局预加载
// prepare for outher
// prepare for other
type _BaseMgr struct {
*gorm.DB
ctx *context.Context
@@ -57,10 +57,10 @@ func (f optionFunc) apply(o *options) {
// OpenRelated 打开全局预加载
func OpenRelated() {
gloabIsRelated = true
globalIsRelated = true
}
// CloseRelated 关闭全局预加载
func CloseRelated() {
gloabIsRelated = true
globalIsRelated = true
}

View File

@@ -15,7 +15,7 @@ func AccountMgr(db *gorm.DB) *_AccountMgr {
if db == nil {
panic(fmt.Errorf("AccountMgr need init by db"))
}
return &_AccountMgr{_BaseMgr: &_BaseMgr{DB: db, isRelated: gloabIsRelated}}
return &_AccountMgr{_BaseMgr: &_BaseMgr{DB: db, isRelated: globalIsRelated}}
}
// GetTableName get sql table name.获取数据库名字

View File

@@ -15,7 +15,7 @@ func UserMgr(db *gorm.DB) *_UserMgr {
if db == nil {
panic(fmt.Errorf("UserMgr need init by db"))
}
return &_UserMgr{_BaseMgr: &_BaseMgr{DB: db, isRelated: gloabIsRelated}}
return &_UserMgr{_BaseMgr: &_BaseMgr{DB: db, isRelated: globalIsRelated}}
}
// GetTableName get sql table name.获取数据库名字