mirror of https://github.com/go-gorm/gorm.git
Allow pass blank string to Order
This commit is contained in:
parent
85a682e820
commit
f07216e90e
|
@ -60,8 +60,12 @@ func (s *search) Assign(attrs ...interface{}) *search {
|
||||||
|
|
||||||
func (s *search) Order(value string, reorder ...bool) *search {
|
func (s *search) Order(value string, reorder ...bool) *search {
|
||||||
if len(reorder) > 0 && reorder[0] {
|
if len(reorder) > 0 && reorder[0] {
|
||||||
|
if value != "" {
|
||||||
s.orders = []string{value}
|
s.orders = []string{value}
|
||||||
} else {
|
} else {
|
||||||
|
s.orders = []string{}
|
||||||
|
}
|
||||||
|
} else if value != "" {
|
||||||
s.orders = append(s.orders, value)
|
s.orders = append(s.orders, value)
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
|
|
Loading…
Reference in New Issue