mirror of
https://github.com/astaxie/beego.git
synced 2024-11-21 16:30:55 +00:00
fix UT
This commit is contained in:
parent
882f1273c8
commit
f8c0e6fec5
@ -387,8 +387,8 @@ type Index struct {
|
||||
Id int `orm:"column(id)"`
|
||||
|
||||
// Other Fields
|
||||
F1 int `orm:"column(f1);unique"`
|
||||
F2 int `orm:"column(f2);unique"`
|
||||
F1 int `orm:"column(f1);index"`
|
||||
F2 int `orm:"column(f2);index"`
|
||||
}
|
||||
|
||||
func NewInLine() *InLine {
|
||||
|
@ -812,13 +812,13 @@ func TestSpecifyIndex(t *testing.T) {
|
||||
_, _ = dORM.Insert(index)
|
||||
throwFailNow(t, AssertIs(index.Id, 2))
|
||||
|
||||
_ = dORM.QueryTable(&Index{}).Filter(`f1`, `1`).ForceIndex(`f1`).One(index)
|
||||
_ = dORM.QueryTable(&Index{}).Filter(`f1`, `1`).ForceIndex(`index_f1`).One(index)
|
||||
throwFailNow(t, AssertIs(index.F2, 2))
|
||||
|
||||
_ = dORM.QueryTable(&Index{}).Filter(`f1`, `3`).UseIndex(`f1`, `f2`).One(index)
|
||||
throwFailNow(t, AssertIs(index.F2, 4))
|
||||
_ = dORM.QueryTable(&Index{}).Filter(`f2`, `4`).UseIndex(`index_f2`).One(index)
|
||||
throwFailNow(t, AssertIs(index.F1, 3))
|
||||
|
||||
_ = dORM.QueryTable(&Index{}).Filter(`f1`, `1`).IgnoreIndex(`f1`, `f2`).One(index)
|
||||
_ = dORM.QueryTable(&Index{}).Filter(`f1`, `1`).IgnoreIndex(`index_f1`, `index_f2`).One(index)
|
||||
throwFailNow(t, AssertIs(index.F2, 2))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user