允许多次调用Order

This commit is contained in:
Yu Zhan
2021-12-14 18:13:32 +08:00
committed by 于湛
parent 99455e328b
commit 47cefbf6d7
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ func (m *Model) Order(orderBy ...string) *Model {
if model.orderBy != "" {
model.orderBy += ","
}
model.orderBy = model.db.GetCore().QuoteString(strings.Join(orderBy, " "))
model.orderBy += model.db.GetCore().QuoteString(strings.Join(orderBy, " "))
return model
}

View File

@ -438,7 +438,7 @@ func Test_Model_Clone(t *testing.T) {
defer dropTable(table)
gtest.C(t, func(t *gtest.T) {
md := db.Model(table).Where("id IN(?)", g.Slice{1, 3})
md := db.Model(table).Safe(true).Where("id IN(?)", g.Slice{1, 3})
count, err := md.Count()
t.AssertNil(err)