Package path refactor.

This commit is contained in:
go-jet 2019-06-21 13:56:57 +02:00
parent 829736279b
commit 83d4c5ad03
72 changed files with 162 additions and 188 deletions

34
order_by_clause.go Normal file
View file

@ -0,0 +1,34 @@
package jet
import "errors"
type OrderByClause interface {
serializeForOrderBy(statement statementType, out *queryData) error
}
type orderByClauseImpl struct {
expression Expression
ascent bool
}
func (o *orderByClauseImpl) serializeForOrderBy(statement statementType, out *queryData) error {
if o.expression == nil {
return errors.New("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}
}