Order by sql serialization simplified.
This commit is contained in:
parent
f016a93d78
commit
d9bbec3795
7 changed files with 32 additions and 39 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue