orm: fix miss pk when pk is negative

This commit is contained in:
miraclesu
2016-03-17 21:34:49 +08:00
parent c8bbfb75f0
commit a3d4218d9d
5 changed files with 12 additions and 12 deletions

View File

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