Comparison operators refactoring.
This commit is contained in:
parent
64ba909381
commit
7b89caa7e0
28 changed files with 694 additions and 384 deletions
|
|
@ -3,50 +3,40 @@ package sqlbuilder
|
|||
type timeExpression interface {
|
||||
expression
|
||||
|
||||
Eq(expression timeExpression) boolExpression
|
||||
EqL(literal string) boolExpression
|
||||
NotEq(expression timeExpression) boolExpression
|
||||
NotEqL(literal string) boolExpression
|
||||
GtEq(rhs timeExpression) boolExpression
|
||||
GtEqL(literal string) boolExpression
|
||||
LtEq(rhs timeExpression) boolExpression
|
||||
LtEqL(literal string) boolExpression
|
||||
EQ(rhs timeExpression) boolExpression
|
||||
NOT_EQ(rhs timeExpression) boolExpression
|
||||
LT(rhs timeExpression) boolExpression
|
||||
LT_EQ(rhs timeExpression) boolExpression
|
||||
GT(rhs timeExpression) boolExpression
|
||||
GT_EQ(rhs timeExpression) boolExpression
|
||||
}
|
||||
|
||||
type timeInterfaceImpl struct {
|
||||
parent timeExpression
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) Eq(expression timeExpression) boolExpression {
|
||||
return Eq(t.parent, expression)
|
||||
func (t *timeInterfaceImpl) EQ(rhs timeExpression) boolExpression {
|
||||
return EQ(t.parent, rhs)
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) EqL(literal string) boolExpression {
|
||||
return Eq(t.parent, Literal(literal))
|
||||
func (t *timeInterfaceImpl) NOT_EQ(rhs timeExpression) boolExpression {
|
||||
return NOT_EQ(t.parent, rhs)
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) NotEq(expression timeExpression) boolExpression {
|
||||
return NotEq(t.parent, expression)
|
||||
func (t *timeInterfaceImpl) LT(rhs timeExpression) boolExpression {
|
||||
return LT(t.parent, rhs)
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) NotEqL(literal string) boolExpression {
|
||||
return NotEq(t.parent, Literal(literal))
|
||||
func (t *timeInterfaceImpl) LT_EQ(rhs timeExpression) boolExpression {
|
||||
return LT_EQ(t.parent, rhs)
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) GtEq(expression timeExpression) boolExpression {
|
||||
return GtEq(t.parent, expression)
|
||||
func (t *timeInterfaceImpl) GT(rhs timeExpression) boolExpression {
|
||||
return GT(t.parent, rhs)
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) GtEqL(literal string) boolExpression {
|
||||
return GtEq(t.parent, Literal(literal))
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) LtEq(expression timeExpression) boolExpression {
|
||||
return LtEq(t.parent, expression)
|
||||
}
|
||||
|
||||
func (t *timeInterfaceImpl) LtEqL(literal string) boolExpression {
|
||||
return LtEq(t.parent, Literal(literal))
|
||||
func (t *timeInterfaceImpl) GT_EQ(rhs timeExpression) boolExpression {
|
||||
return GT_EQ(t.parent, rhs)
|
||||
}
|
||||
|
||||
//---------------------------------------------------//
|
||||
|
|
@ -54,12 +44,12 @@ type prefixTimeExpression struct {
|
|||
expressionInterfaceImpl
|
||||
timeInterfaceImpl
|
||||
|
||||
prefixExpression
|
||||
prefixOpExpression
|
||||
}
|
||||
|
||||
func newPrefixTimeExpression(expression expression, operator string) timeExpression {
|
||||
timeExpr := prefixTimeExpression{}
|
||||
timeExpr.prefixExpression = newPrefixExpression(expression, operator)
|
||||
timeExpr.prefixOpExpression = newPrefixExpression(expression, operator)
|
||||
|
||||
timeExpr.expressionInterfaceImpl.parent = &timeExpr
|
||||
timeExpr.timeInterfaceImpl.parent = &timeExpr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue