You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/vendor/github.com/lqs/sqlingo/order.go

23 lines
388 B

package sqlingo
// OrderBy indicates the ORDER BY column and the status of descending order.
type OrderBy interface {
GetSQL(scope scope) (string, error)
}
type orderBy struct {
by Expression
desc bool
}
func (o orderBy) GetSQL(scope scope) (string, error) {
sql, err := o.by.GetSQL(scope)
if err != nil {
return "", err
}
if o.desc {
sql += " DESC"
}
return sql, nil
}