From 824d25fb3a199b8d76b2b5e40e0e9a087a6d5f4b Mon Sep 17 00:00:00 2001 From: changle Date: Tue, 8 Jun 2021 11:30:56 +0800 Subject: [PATCH] fix: fix misspell word primary --- README.md | 2 +- README_zh_cn.md | 2 +- data/view/genfunc/def.go | 4 ++-- data/view/genfunc/genfunc_test.go | 2 +- data/view/genfunc/model/matrix.gen.account.go | 4 ++-- data/view/genfunc/model/matrix.gen.user.go | 2 +- data/view/model/def.go | 2 +- data/view/model/model.go | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8f09664..36196c8 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ type UserAccountTbl struct { ## 6. support func export ### The exported function is only the auxiliary class function of Gorm, and calls Gorm completely ``` -// FetchByPrimaryKey primay or index 获取唯一内容 +// FetchByPrimaryKey primary or index 获取唯一内容 func (obj *_UserAccountTblMgr) FetchByPrimaryKey(ID int) (result UserAccountTbl, err error) { err = obj.DB.Table(obj.GetTableName()).Where("id = ?", ID).Find(&result).Error if err == nil && obj.isRelated { diff --git a/README_zh_cn.md b/README_zh_cn.md index 02635e6..0012ece 100644 --- a/README_zh_cn.md +++ b/README_zh_cn.md @@ -171,7 +171,7 @@ type UserAccountTbl struct { ## 6. 支持函数导出(导出函数只是 gorm 的辅助类函数,完全兼调用 gorm) ``` -// FetchByPrimaryKey primay or index 获取唯一内容 +// FetchByPrimaryKey primary or index 获取唯一内容 func (obj *_UserAccountTblMgr) FetchByPrimaryKey(ID int) (result UserAccountTbl, err error) { err = obj.DB.Table(obj.GetTableName()).Where("id = ?", ID).Find(&result).Error if err == nil && obj.isRelated { diff --git a/data/view/genfunc/def.go b/data/view/genfunc/def.go index 81f20a8..895a681 100755 --- a/data/view/genfunc/def.go +++ b/data/view/genfunc/def.go @@ -203,8 +203,8 @@ func (obj *_{{$obj.StructName}}Mgr) GetBatchFrom{{$oem.ColStructName}}({{CapLowe } {{end}} //////////////////////////primary index case //////////////////////////////////////////// - {{range $ofm := $obj.Primay}} - // {{GenFListIndex $ofm 1}} primay or index 获取唯一内容 + {{range $ofm := $obj.Primary}} + // {{GenFListIndex $ofm 1}} primary or index 获取唯一内容 func (obj *_{{$obj.StructName}}Mgr) {{GenFListIndex $ofm 1}}({{GenFListIndex $ofm 2}}) (result {{$obj.StructName}}, err error) { err = obj.DB.WithContext(obj.ctx).Table(obj.GetTableName()).Where("{{GenFListIndex $ofm 3}}", {{GenFListIndex $ofm 4}}).Find(&result).Error {{GenPreloadList $obj.PreloadList false}} diff --git a/data/view/genfunc/genfunc_test.go b/data/view/genfunc/genfunc_test.go index 93c9ddb..ee54b88 100644 --- a/data/view/genfunc/genfunc_test.go +++ b/data/view/genfunc/genfunc_test.go @@ -125,7 +125,7 @@ func TestFuncFetchBy(t *testing.T) { accountMgr := model.AccountMgr(db) accountMgr.SetIsRelated(true) // 打开预加载 (外键) - account, err := accountMgr.FetchByPrimaryKey(2) // primay key + account, err := accountMgr.FetchByPrimaryKey(2) // primary key fmt.Println(err) fmt.Println(account) diff --git a/data/view/genfunc/model/matrix.gen.account.go b/data/view/genfunc/model/matrix.gen.account.go index 00a02c2..4a847a2 100644 --- a/data/view/genfunc/model/matrix.gen.account.go +++ b/data/view/genfunc/model/matrix.gen.account.go @@ -277,7 +277,7 @@ func (obj *_AccountMgr) GetBatchFromName(names []string) (results []*Account, er //////////////////////////primary index case //////////////////////////////////////////// -// FetchByPrimaryKey primay or index 获取唯一内容 +// FetchByPrimaryKey primary or index 获取唯一内容 func (obj *_AccountMgr) FetchByPrimaryKey(id int) (result Account, err error) { err = obj.WithContext(obj.ctx).Table(obj.GetTableName()).Where("id = ?", id).Find(&result).Error if err == nil && obj.isRelated { @@ -291,7 +291,7 @@ func (obj *_AccountMgr) FetchByPrimaryKey(id int) (result Account, err error) { return } -// FetchUniqueIndexByAccount primay or index 获取唯一内容 +// FetchUniqueIndexByAccount primary or index 获取唯一内容 func (obj *_AccountMgr) FetchUniqueIndexByAccount(accountID int, userID int) (result Account, err error) { err = obj.WithContext(obj.ctx).Table(obj.GetTableName()).Where("account_id = ? AND user_id = ?", accountID, userID).Find(&result).Error if err == nil && obj.isRelated { diff --git a/data/view/genfunc/model/matrix.gen.user.go b/data/view/genfunc/model/matrix.gen.user.go index 9b04150..4c8488f 100644 --- a/data/view/genfunc/model/matrix.gen.user.go +++ b/data/view/genfunc/model/matrix.gen.user.go @@ -149,7 +149,7 @@ func (obj *_UserMgr) GetBatchFromJob(jobs []int) (results []*User, err error) { //////////////////////////primary index case //////////////////////////////////////////// -// FetchByPrimaryKey primay or index 获取唯一内容 +// FetchByPrimaryKey primary or index 获取唯一内容 func (obj *_UserMgr) FetchByPrimaryKey(userID int) (result User, err error) { err = obj.WithContext(obj.ctx).Table(obj.GetTableName()).Where("user_id = ?", userID).Find(&result).Error diff --git a/data/view/model/def.go b/data/view/model/def.go index d5f1ca2..8bf606b 100644 --- a/data/view/model/def.go +++ b/data/view/model/def.go @@ -115,7 +115,7 @@ type funDef struct { TableName string PreloadList []PreloadInfo // 外键列表,(生成关联数据) Em []EmInfo // index 列表 - Primay []FList // primay unique + Primary []FList // primary unique Index []FList // index } diff --git a/data/view/model/model.go b/data/view/model/model.go index c6a65e7..c294181 100755 --- a/data/view/model/model.go +++ b/data/view/model/model.go @@ -376,9 +376,9 @@ func (m *_Model) generateFunc() (genOut []GenOutInfo) { // ---------end-- } - data.Primay = append(data.Primay, primary...) - data.Primay = append(data.Primay, unique...) - data.Primay = append(data.Primay, uniqueIndex...) + data.Primary = append(data.Primary, primary...) + data.Primary = append(data.Primary, unique...) + data.Primary = append(data.Primary, uniqueIndex...) data.Index = append(data.Index, index...) tmpl, err := template.New("gen_logic"). Funcs(template.FuncMap{"GenPreloadList": GenPreloadList, "GenFListIndex": GenFListIndex, "CapLowercase": CapLowercase, "GetTablePrefixName": GetTablePrefixName}).