Lines Matching refs:v
63 v := reflect.ValueOf(ps)
64 if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct {
65 panic(fmt.Errorf("type %s is not a pointer to a struct", v.Type()))
69 if v.IsNil() {
74 v = v.Elem()
83 fieldsByIndex(v, i, &values)
106 v.Type().FieldByIndex(i).Name, v.Type(), sv.Type()))
116 func fieldsByIndex(v reflect.Value, index []int, values *[]reflect.Value) {
119 if isSliceOfStruct(v) {
120 for i := 0; i < v.Len(); i++ {
121 *values = append(*values, v.Index(i).Field(index[0]))
125 if v.Kind() == reflect.Ptr {
126 if v.IsNil() {
129 v = v.Elem()
131 *values = append(*values, v.Field(index[0]))
137 if v.Kind() == reflect.Ptr {
139 if v.IsNil() {
142 v = v.Elem()
143 } else if isSliceOfStruct(v) {
145 for i := 0; i < v.Len(); i++ {
146 fieldsByIndex(v.Index(i).Field(index[0]), index[1:], values)
150 fieldsByIndex(v.Field(index[0]), index[1:], values)
154 func isSliceOfStruct(v reflect.Value) bool {
155 return v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Struct