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 }
func newSargEq(pred *expression.Eq) *sargEq { rv := &sargEq{} rv.sarger = func(expr2 expression.Expression) (plan.Spans, error) { if SubsetOf(pred, expr2) { return _SELF_SPANS, nil } span := &plan.Span{} if pred.First().EquivalentTo(expr2) { span.Range.Low = expression.Expressions{pred.Second().Static()} } else if pred.Second().EquivalentTo(expr2) { span.Range.Low = expression.Expressions{pred.First().Static()} } else { return nil, nil } if span.Range.Low[0] == nil { return nil, nil } if rv.MissingHigh() { span.Range.High = expression.Expressions{expression.NewSuccessor(span.Range.Low[0])} span.Range.Inclusion = datastore.LOW } else { span.Range.High = span.Range.Low span.Range.Inclusion = datastore.BOTH } return plan.Spans{span}, nil } return rv }