Merge pull request #217 from apphost/Issues-non-int-pk-fix
fix non-int pk issues
This commit is contained in:
commit
4677bf58a3
|
@ -599,7 +599,9 @@ func buildConditions(engine *Engine, table *core.Table, bean interface{},
|
||||||
if table, ok := engine.Tables[fieldValue.Type()]; ok {
|
if table, ok := engine.Tables[fieldValue.Type()]; ok {
|
||||||
if len(table.PrimaryKeys) == 1 {
|
if len(table.PrimaryKeys) == 1 {
|
||||||
pkField := reflect.Indirect(fieldValue).FieldByName(table.PKColumns()[0].FieldName)
|
pkField := reflect.Indirect(fieldValue).FieldByName(table.PKColumns()[0].FieldName)
|
||||||
if pkField.Int() != 0 {
|
// fix non-int pk issues
|
||||||
|
//if pkField.Int() != 0 {
|
||||||
|
if pkField.IsValid() {
|
||||||
val = pkField.Interface()
|
val = pkField.Interface()
|
||||||
} else {
|
} else {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue