This is a created article in which the information may have evolved or changed. "' Gofunc slicecolumn (Structslice []interface{}, key String) []interface{} {RT: = reflect. TypeOf (structslice) rv: = reflect. ValueOf (Structslice) if Rt. Kind () = = reflect. Slice {//slice type var slicecolumn []INTERFACE{}ELEMT: = Rt. Elem ()//Gets the slice element type 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} "439 reads
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service