Package structure refactor.

This commit is contained in:
go-jet 2019-08-03 14:10:47 +02:00
parent 3d8e872336
commit 23fd973699
125 changed files with 2401 additions and 1818 deletions

View file

@ -0,0 +1,35 @@
package jet
import "errors"
// OrderByClause
type orderByClause interface {
serializeForOrderBy(statement StatementType, out *SqlBuilder) error
}
type orderByClauseImpl struct {
expression Expression
ascent bool
}
func (o *orderByClauseImpl) serializeForOrderBy(statement StatementType, out *SqlBuilder) error {
if o.expression == nil {
return errors.New("jet: nil orderBy by clause")
}
if err := o.expression.serializeForOrderBy(statement, out); err != nil {
return err
}
if o.ascent {
out.WriteString("ASC")
} else {
out.WriteString("DESC")
}
return nil
}
func newOrderByClause(expression Expression, ascent bool) orderByClause {
return &orderByClauseImpl{expression: expression, ascent: ascent}
}