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,8 +3042,10 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val
pkField := reflect.Indirect(fieldValue).FieldByName(fieldTable.PKColumns()[0].FieldName)
return pkField.Interface(), nil
}
if fieldTable.Type == nil {
return 0, fmt.Errorf("no primary key for col %v", col.Name)
}
}
if col.SQLType.IsText() {
bytes, err := json.Marshal(fieldValue.Interface())