Allow pass blank string to Order

This commit is contained in:
Jinzhu 2015-08-01 11:31:36 +08:00
parent 85a682e820
commit f07216e90e
1 changed files with 6 additions and 2 deletions

View File

@ -60,8 +60,12 @@ func (s *search) Assign(attrs ...interface{}) *search {
func (s *search) Order(value string, reorder ...bool) *search {
if len(reorder) > 0 && reorder[0] {
s.orders = []string{value}
} else {
if value != "" {
s.orders = []string{value}
} else {
s.orders = []string{}
}
} else if value != "" {
s.orders = append(s.orders, value)
}
return s