- task schedule added.
This commit is contained in:
@@ -7,3 +7,24 @@ func MergeStoreStatus(status int, vendorStatus int) int {
|
||||
}
|
||||
return vendorStatus
|
||||
}
|
||||
|
||||
func SplitSlice(list []interface{}, batchCount int) (listInList [][]interface{}) {
|
||||
len := len(list)
|
||||
if len > 0 {
|
||||
listInListLen := (len-1)/batchCount + 1
|
||||
listInList = make([][]interface{}, listInListLen)
|
||||
index := 0
|
||||
for i := 0; i < len; i++ {
|
||||
if i%batchCount == 0 {
|
||||
index = i / batchCount
|
||||
arrLen := len - i
|
||||
if arrLen > batchCount {
|
||||
arrLen = batchCount
|
||||
}
|
||||
listInList[index] = make([]interface{}, arrLen)
|
||||
}
|
||||
listInList[index][i%batchCount] = list[i]
|
||||
}
|
||||
}
|
||||
return listInList
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user