func newSargEq(expr *expression.Eq) *sargEq { rv := &sargEq{} rv.sarg = func(expr2 expression.Expression) (Spans, error) { if expr.EquivalentTo(expr2) { return _SELF_SPANS, nil } span := &Span{} if expr.First().EquivalentTo(expr2) { span.Range.Low = expression.Expressions{expr.Second().Static()} } else if expr.Second().EquivalentTo(expr2) { span.Range.Low = expression.Expressions{expr.First().Static()} } if len(span.Range.Low) == 0 { return nil, nil } span.Range.High = span.Range.Low span.Range.Inclusion = datastore.BOTH return Spans{span}, nil } return rv }
func (this *JSConverter) VisitEq(expr *expression.Eq) (interface{}, error) { var buf bytes.Buffer buf.WriteString("(") buf.WriteString(this.Visit(expr.First())) buf.WriteString(" == ") buf.WriteString(this.Visit(expr.Second())) buf.WriteString(")") return buf.String(), nil }