Allow a struct to be used as a field with jsonb

This commit is contained in:
Arvin Foroutan 2016-07-25 21:07:13 -07:00
parent dddc985b86
commit d5a8d74114
1 changed files with 3 additions and 1 deletions

View File

@ -3042,7 +3042,9 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val
pkField := reflect.Indirect(fieldValue).FieldByName(fieldTable.PKColumns()[0].FieldName) pkField := reflect.Indirect(fieldValue).FieldByName(fieldTable.PKColumns()[0].FieldName)
return pkField.Interface(), nil return pkField.Interface(), nil
} }
return 0, fmt.Errorf("no primary key for col %v", col.Name) if fieldTable.Type == nil {
return 0, fmt.Errorf("no primary key for col %v", col.Name)
}
} }
if col.SQLType.IsText() { if col.SQLType.IsText() {