orm fix when use uint as pk

This commit is contained in:
slene
2013-08-30 12:32:05 +08:00
parent dc8f932009
commit 8f5ca303b5
6 changed files with 118 additions and 68 deletions

View File

@@ -34,7 +34,11 @@ func (o *insertSet) Insert(md interface{}) (int64, error) {
}
if id > 0 {
if o.mi.fields.pk.auto {
ind.Field(o.mi.fields.pk.fieldIndex).SetInt(id)
if o.mi.fields.pk.fieldType&IsPostiveIntegerField > 0 {
ind.Field(o.mi.fields.pk.fieldIndex).SetUint(uint64(id))
} else {
ind.Field(o.mi.fields.pk.fieldIndex).SetInt(id)
}
}
}
return id, nil