优化代码

This commit is contained in:
刘祥超
2021-08-07 16:11:35 +08:00
parent 7dc5c5f349
commit ccf435ee8e
8 changed files with 14 additions and 23 deletions

View File

@@ -16,7 +16,6 @@ import (
"github.com/iwind/TeaGo/types"
stringutil "github.com/iwind/TeaGo/utils/string"
"io/ioutil"
"strings"
"time"
)
@@ -279,7 +278,6 @@ func (this *SQLExecutor) checkMetricItems(db *dbs.DB) error {
return err
}
var itemId int64 = 0
if len(itemMap) == 0 {
keysJSON, err := json.Marshal(keys)
if err != nil {
@@ -297,7 +295,7 @@ func (this *SQLExecutor) checkMetricItems(db *dbs.DB) error {
}
}
itemId = itemMap.GetInt64("id")
var itemId = itemMap.GetInt64("id")
// chart
for _, chartMap := range chartMaps {
@@ -461,17 +459,3 @@ func (this *SQLExecutor) updateVersion(db *dbs.DB, version string) error {
return nil
}
// 判断某个错误是否可以忽略
func (this *SQLExecutor) canIgnoreError(err error) bool {
if err == nil {
return true
}
// Error 1050: Table 'xxx' already exists
if strings.Contains(err.Error(), "Error 1050") {
return true
}
return false
}