File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ const (
1919
2020// parseOperator parses a leading logical operator out of the provided string
2121func parseOperator (s string ) string {
22+ if len (s ) == 0 {
23+ return ""
24+ }
2225 switch s [0 ] {
2326 case operatorLesser [0 ]: // "<"
2427 if 1 == len (s ) {
@@ -98,13 +101,9 @@ func (c ComparativeTime) String() string {
98101
99102// Parse is used to parse a query string into a ComparativeString instance
100103func (c * ComparativeString ) Parse (query string ) error {
101- if len (query ) <= 2 {
102- return errors .New ("qstring: Invalid Query" )
103- }
104-
105104 c .Operator = parseOperator (query )
106105
107- if c .Operator != operatorDifferent && c .Operator != operatorLike && c .Operator != operatorEquals {
106+ if len ( c . Operator ) > 0 && c .Operator != operatorDifferent && c .Operator != operatorLike && c .Operator != operatorEquals {
108107 return errors .New (fmt .Sprintf ("qstring: Invalid operator for %T" , c ))
109108 }
110109 if c .Operator == operatorEquals {
@@ -128,5 +127,8 @@ func (c *ComparativeString) Parse(query string) error {
128127// String returns this ComparativeString instance in the form of the query
129128// parameter that it came in on
130129func (c ComparativeString ) String () string {
130+ if c .Operator == operatorEquals {
131+ c .Operator = ""
132+ }
131133 return fmt .Sprintf ("%s%s" , c .Operator , c .Str )
132134}
You can’t perform that action at this time.
0 commit comments