fix index function output
修复mysql索引导出函数不准确问题。
This commit is contained in:
@@ -91,11 +91,11 @@ func TestFuncFetchBy(t *testing.T) {
|
||||
fmt.Println(err)
|
||||
fmt.Println(account)
|
||||
|
||||
account1, err := accountMgr.FetchByAccountUniqueIndex(2, 2) // unique index
|
||||
account1, err := accountMgr.FetchUniqueIndexByAccount(2, 2) // unique index
|
||||
fmt.Println(err)
|
||||
fmt.Println(account1)
|
||||
|
||||
accounts, err := accountMgr.FetchByTpIndex(2, 2)
|
||||
accounts, err := accountMgr.FetchIndexByTp(2, 2)
|
||||
fmt.Println(err)
|
||||
fmt.Println(accounts)
|
||||
}
|
||||
|
||||
@@ -333,8 +333,8 @@ func (obj *_AccountMgr) FetchByPrimaryKey(ID int) (result Account, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// FetchByAccountUniqueIndex primay or index 获取唯一内容
|
||||
func (obj *_AccountMgr) FetchByAccountUniqueIndex(AccountID int, UserID int) (result Account, err error) {
|
||||
// FetchUniqueIndexByAccount primay or index 获取唯一内容
|
||||
func (obj *_AccountMgr) FetchUniqueIndexByAccount(AccountID int, UserID int) (result Account, err error) {
|
||||
err = obj.DB.Table(obj.GetTableName()).Where("account_id = ? AND user_id = ?", AccountID, UserID).Find(&result).Error
|
||||
if err == nil && obj.isRelated {
|
||||
{
|
||||
@@ -350,8 +350,8 @@ func (obj *_AccountMgr) FetchByAccountUniqueIndex(AccountID int, UserID int) (re
|
||||
return
|
||||
}
|
||||
|
||||
// FetchByTpIndex 获取多个内容
|
||||
func (obj *_AccountMgr) FetchByTpIndex(UserID int, Type int) (results []*Account, err error) {
|
||||
// FetchIndexByTp 获取多个内容
|
||||
func (obj *_AccountMgr) FetchIndexByTp(UserID int, Type int) (results []*Account, err error) {
|
||||
err = obj.DB.Table(obj.GetTableName()).Where("user_id = ? AND type = ?", UserID, Type).Find(&results).Error
|
||||
if err == nil && obj.isRelated {
|
||||
for i := 0; i < len(results); i++ {
|
||||
|
||||
Reference in New Issue
Block a user