Skip to content

Commit

Permalink
Preserve Operator.String(), add Operator.Symbol() (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
phliar committed Apr 16, 2020
1 parent 2dd444c commit 2496e12
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,23 @@ func (f ScopeFlagType) String() string {
}

func (op Operator) String() string {
switch op {
case Eq:
return "Eq"
case Lt:
return "Lt"
case LtOrEq:
return "LtOrEq"
case Gt:
return "Gt"
case GtOrEq:
return "GtOrEq"
default:
return "?"
}
}

func (op Operator) Symbol() string {
switch op {
case Eq:
return "=="
Expand Down
2 changes: 1 addition & 1 deletion range_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type ColumnCondition struct {
}

func (cc *ColumnCondition) String() string {
return fmt.Sprintf("(%s %v %v)", cc.Name, cc.Condition.Op, cc.Condition.Value)
return fmt.Sprintf("(%s %s %v)", cc.Name, cc.Condition.Op.Symbol(), cc.Condition.Value)
}

// SortedColumnCondition implements sorting of an array of columnConditions
Expand Down

0 comments on commit 2496e12

Please sign in to comment.