``` go func SliceColumn(structSlice []interface{}, key string) []interface{} { rt := reflect.TypeOf(structSlice) rv := reflect.ValueOf(structSlice) if rt.Kind() == reflect.Slice { //切片类型 var sliceColumn []interface{} elemt := rt.Elem() //获取切片元素类型 for i := 0; i < rv.Len(); i++ { inxv := rv.Index(i) if elemt.Kind() == reflect.Struct { for i := 0; i < elemt.NumField(); i++ { if elemt.Field(i).Name == key { strf := inxv.Field(i) switch strf.Kind() { case reflect.String: sliceColumn = append(sliceColumn, strf.String()) case reflect.Float64: sliceColumn = append(sliceColumn, strf.Float()) case reflect.Int, reflect.Int64: sliceColumn = append(sliceColumn, strf.Int()) default: //do nothing } } } } } return sliceColumn } return nil } ```