Order by sql serialization simplified.

This commit is contained in:
zer0sub 2019-05-08 12:49:36 +02:00
parent f016a93d78
commit d9bbec3795
7 changed files with 32 additions and 39 deletions

View file

@ -3,28 +3,20 @@ package sqlbuilder
import "github.com/dropbox/godropbox/errors"
type orderByClause interface {
clause
isOrderByClauseType()
}
type isOrderByClause struct {
}
func (o *isOrderByClause) isOrderByClauseType() {
serializeAsOrderBy(out *queryData) error
}
type orderByClauseImpl struct {
isOrderByClause
expression expression
ascent bool
}
func (o *orderByClauseImpl) serialize(out *queryData) error {
func (o *orderByClauseImpl) serializeAsOrderBy(out *queryData) error {
if o.expression == nil {
return errors.Newf("nil orderBy by clause.")
}
if err := o.expression.serialize(out); err != nil {
if err := o.expression.serializeAsOrderBy(out); err != nil {
return err
}