From 2496e12b53f28910d24412c6979879c732ffe210 Mon Sep 17 00:00:00 2001 From: Shamim Mohamed Date: Thu, 16 Apr 2020 12:04:31 -0700 Subject: [PATCH] Preserve Operator.String(), add Operator.Symbol() (#436) --- connector.go | 17 +++++++++++++++++ range_conditions.go | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/connector.go b/connector.go index 4e02d26d..641bf123 100644 --- a/connector.go +++ b/connector.go @@ -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 "==" diff --git a/range_conditions.go b/range_conditions.go index 9ac5781f..5d85985e 100644 --- a/range_conditions.go +++ b/range_conditions.go @@ -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