@@ -122,9 +122,9 @@ func (s *ScanContext) getTypeInfo(structType reflect.Type, parentField *reflect.
122122}
123123
124124type groupKeyInfo struct {
125- typeName string
126- indexes []int
127- subTypes []groupKeyInfo
125+ typeName string
126+ pkIndexes []int
127+ subTypes []groupKeyInfo
128128}
129129
130130func (s * ScanContext ) getGroupKey (structType reflect.Type , structField * reflect.StructField ) string {
@@ -148,13 +148,13 @@ func (s *ScanContext) getGroupKey(structType reflect.Type, structField *reflect.
148148}
149149
150150func (s * ScanContext ) constructGroupKey (groupKeyInfo groupKeyInfo ) string {
151- if len (groupKeyInfo .indexes ) == 0 && len (groupKeyInfo .subTypes ) == 0 {
151+ if len (groupKeyInfo .pkIndexes ) == 0 && len (groupKeyInfo .subTypes ) == 0 {
152152 return fmt .Sprintf ("|ROW:%d|" , s .rowNum )
153153 }
154154
155155 var groupKeys []string
156156
157- for _ , index := range groupKeyInfo .indexes {
157+ for _ , index := range groupKeyInfo .pkIndexes {
158158 groupKeys = append (groupKeys , s .rowElemToString (index ))
159159 }
160160
@@ -190,19 +190,19 @@ func (s *ScanContext) getGroupKeyInfo(
190190 if isPrimaryKey (field , primaryKeyOverwrites ) {
191191 newTypeName , fieldName := getTypeAndFieldName (typeName , field )
192192
193- index := s .typeToColumnIndex (newTypeName , fieldName )
193+ pkIndex := s .typeToColumnIndex (newTypeName , fieldName )
194194
195- if index < 0 {
195+ if pkIndex < 0 {
196196 continue
197197 }
198198
199- ret .indexes = append (ret .indexes , index )
199+ ret .pkIndexes = append (ret .pkIndexes , pkIndex )
200200
201- } else if fieldType .Kind () == reflect .Struct {
201+ } else if fieldType .Kind () == reflect .Struct && fieldType != timeType {
202202
203203 subType := s .getGroupKeyInfo (fieldType , & field , typeVisited )
204204
205- if len (subType .indexes ) != 0 || len (subType .subTypes ) != 0 {
205+ if len (subType .pkIndexes ) != 0 || len (subType .subTypes ) != 0 {
206206 ret .subTypes = append (ret .subTypes , subType )
207207 }
208208 }
0 commit comments