code refactor
This commit is contained in:
@@ -33,7 +33,7 @@ func (s *TransactionCategoryService) GetAllCategoriesByUid(uid int64, categoryTy
|
||||
}
|
||||
|
||||
condition := "uid=? AND deleted=?"
|
||||
var conditionParams []interface{}
|
||||
conditionParams := make([]interface{}, 0, 8)
|
||||
conditionParams = append(conditionParams, uid)
|
||||
conditionParams = append(conditionParams, false)
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ func (s *TransactionService) ModifyTransaction(transaction *models.Transaction,
|
||||
return errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
var updateCols []string
|
||||
updateCols := make([]string, 0, 16)
|
||||
|
||||
now := time.Now().Unix()
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ func (s *UserService) UpdateUser(user *models.User) (keyProfileUpdated bool, err
|
||||
return false, errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
var updateCols []string
|
||||
updateCols := make([]string, 0, 8)
|
||||
|
||||
now := time.Now().Unix()
|
||||
keyProfileUpdated = false
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ func Int64SliceMinus(s1, s2 []int64) []int64 {
|
||||
}
|
||||
|
||||
s2ItemsMap := make(map[int64]bool)
|
||||
var ret []int64
|
||||
ret := make([]int64, 0, len(s1))
|
||||
|
||||
for i := 0; i < len(s2); i++ {
|
||||
s2ItemsMap[s2[i]] = true
|
||||
@@ -22,7 +22,7 @@ func Int64SliceMinus(s1, s2 []int64) []int64 {
|
||||
}
|
||||
|
||||
func ToUniqueInt64Slice(items []int64) []int64 {
|
||||
var uniqueItems []int64
|
||||
uniqueItems := make([]int64, 0, len(items))
|
||||
itemExistMap := make(map[int64]bool)
|
||||
|
||||
for i := 0; i < len(items); i++ {
|
||||
|
||||
Reference in New Issue
Block a user