1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 04:21:00 +00:00
This commit is contained in:
jianzhiyao 2020-08-14 10:31:08 +08:00
parent 139c393f08
commit 739b8bab0c

View File

@ -2549,12 +2549,19 @@ func TestStrPkInsert(t *testing.T) {
Id: pk, Id: pk,
Value: value2, Value: value2,
} }
_, err = dORM.InsertOrUpdate(strPkForUpsert, `id`)
throwFailNow(t, AssertIs(err, nil))
var vForTesting2 StrPk _, err = dORM.InsertOrUpdate(strPkForUpsert, `id`)
err = dORM.QueryTable(new(StrPk)).Filter(`id`, pk).One(&vForTesting2) if err != nil {
throwFailNow(t, AssertIs(err, nil)) fmt.Println(err)
throwFailNow(t, AssertIs(vForTesting2.Value, value2)) if err.Error() == "postgres version must 9.5 or higher" || err.Error() == "`sqlite3` nonsupport InsertOrUpdate in beego" {
} else {
throwFailNow(t, err)
}
} else {
var vForTesting2 StrPk
err = dORM.QueryTable(new(StrPk)).Filter(`id`, pk).One(&vForTesting2)
throwFailNow(t, AssertIs(err, nil))
throwFailNow(t, AssertIs(vForTesting2.Value, value2))
}
} }