feat:完善项目

This commit is contained in:
henry
2022-01-14 17:09:06 +08:00
parent cf68cfbd96
commit 9a41d7ff12
16 changed files with 646 additions and 38 deletions

View File

@ -49,3 +49,24 @@ func ArrayStrings(src interface{}) []string {
}
return out
}
func ArrayUnique(src interface{}) []interface{} {
val := reflect.ValueOf(src)
kind := val.Kind()
out := make([]interface{}, 0)
if kind == reflect.Slice || kind == reflect.Array {
for i := 0; i < val.Len(); i++ {
for _, v := range out {
if v == val.Index(i).Interface() {
goto BREAK
}
}
out = append(out, val.Index(i).Interface())
BREAK:
}
}
return out
}