mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 20:00:55 +00:00
utils: fix the SliceIntersect
This commit is contained in:
parent
01e4084587
commit
77294a5881
@ -106,10 +106,10 @@ func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// SliceIntersect returns diff slice of slice1 - slice2.
|
// SliceIntersect returns slice that are present in all the slice1 and slice2.
|
||||||
func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{}) {
|
func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{}) {
|
||||||
for _, v := range slice1 {
|
for _, v := range slice1 {
|
||||||
if !InSliceIface(v, slice2) {
|
if InSliceIface(v, slice2) {
|
||||||
diffslice = append(diffslice, v)
|
diffslice = append(diffslice, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user