mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 12:17:53 +08:00
improve Order feature for package gdb
This commit is contained in:
parent
816791b9c1
commit
7667aca4c2
@ -277,6 +277,9 @@ func (m *Model) Order(orderBy ...string) *Model {
|
||||
return m
|
||||
}
|
||||
model := m.getModel()
|
||||
if model.orderBy != "" {
|
||||
model.orderBy += ","
|
||||
}
|
||||
model.orderBy = m.db.GetCore().QuoteString(strings.Join(orderBy, " "))
|
||||
return model
|
||||
}
|
||||
@ -287,6 +290,9 @@ func (m *Model) OrderAsc(column string) *Model {
|
||||
return m
|
||||
}
|
||||
model := m.getModel()
|
||||
if model.orderBy != "" {
|
||||
model.orderBy += ","
|
||||
}
|
||||
model.orderBy = m.db.GetCore().QuoteWord(column) + " ASC"
|
||||
return model
|
||||
}
|
||||
@ -297,6 +303,9 @@ func (m *Model) OrderDesc(column string) *Model {
|
||||
return m
|
||||
}
|
||||
model := m.getModel()
|
||||
if model.orderBy != "" {
|
||||
model.orderBy += ","
|
||||
}
|
||||
model.orderBy = m.db.GetCore().QuoteWord(column) + " DESC"
|
||||
return model
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user