(iface interface{}, primaryKey []reflect.StructField)
| 150 | } |
| 151 | |
| 152 | func getKeyValue(iface interface{}, primaryKey []reflect.StructField) string { |
| 153 | var ss []string |
| 154 | ifv := reflect.ValueOf(iface) |
| 155 | if ifv.Kind() == reflect.Ptr { |
| 156 | ifv = ifv.Elem() |
| 157 | } |
| 158 | for _, key := range primaryKey { |
| 159 | v := ifv.FieldByName(key.Name) |
| 160 | s := fmt.Sprintf("%v", v.Interface()) |
| 161 | if s != "" { |
| 162 | ss = append(ss, s) |
| 163 | } |
| 164 | } |
| 165 | return strings.Join(ss, ":") |
| 166 | } |
| 167 | |
| 168 | func stripZeroByte(ifc interface{}) { |
| 169 | v := reflect.ValueOf(ifc).Elem() |