Bool expression refactoring.
This commit is contained in:
parent
5a7563d4af
commit
38007810c1
15 changed files with 818 additions and 583 deletions
|
|
@ -4,36 +4,17 @@ import (
|
|||
"bytes"
|
||||
)
|
||||
|
||||
type Clause interface {
|
||||
SerializeSql(out *bytes.Buffer) error
|
||||
}
|
||||
|
||||
// A clause that can be used in order by
|
||||
type OrderByClause interface {
|
||||
Clause
|
||||
isOrderByClauseInterface
|
||||
}
|
||||
|
||||
// An expression
|
||||
type Expression interface {
|
||||
Clause
|
||||
isExpressionInterface
|
||||
}
|
||||
|
||||
type BoolExpression interface {
|
||||
Clause
|
||||
isBoolExpressionInterface
|
||||
|
||||
And(expression BoolExpression) BoolExpression
|
||||
Or(expression BoolExpression) BoolExpression
|
||||
}
|
||||
|
||||
// A clause that is selectable.
|
||||
type Projection interface {
|
||||
Clause
|
||||
isProjectionInterface
|
||||
|
||||
As(alias string) Projection
|
||||
SerializeSqlForColumnList(out *bytes.Buffer) error
|
||||
}
|
||||
|
||||
|
|
@ -82,28 +63,6 @@ type isOrderByClause struct {
|
|||
func (o *isOrderByClause) isOrderByClauseType() {
|
||||
}
|
||||
|
||||
type isExpressionInterface interface {
|
||||
isExpressionType()
|
||||
}
|
||||
|
||||
type isExpression struct {
|
||||
isOrderByClause // can always use expression in order by.
|
||||
}
|
||||
|
||||
func (e *isExpression) isExpressionType() {
|
||||
}
|
||||
|
||||
type isBoolExpressionInterface interface {
|
||||
isExpressionInterface
|
||||
isBoolExpressionType()
|
||||
}
|
||||
|
||||
type isBoolExpression struct {
|
||||
}
|
||||
|
||||
func (e *isBoolExpression) isBoolExpressionType() {
|
||||
}
|
||||
|
||||
type isProjectionInterface interface {
|
||||
isProjectionType()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue