niki/pkg/query_builder/mysql/sort.go

15 lines
269 B
Go

package mysqlquerybuilder
import (
"fmt"
"git.gocasts.ir/ebhomengo/niki/param"
)
func BuildSortQuery(sort param.SortRequest) string {
if sort.Field == "" && sort.Direction == "" {
return ""
}
return fmt.Sprintf("ORDER BY %s %s", sort.Field, sort.Direction)
}