Exemplo n.º 1
0
func (this *JSConverter) VisitLE(expr *expression.LE) (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
}
Exemplo n.º 2
0
func (this *subsetLT) VisitLE(expr *expression.LE) (interface{}, error) {
	if this.lt.First().EquivalentTo(expr.First()) {
		return LessThanOrEquals(this.lt.Second(), expr.Second()), nil
	}

	if this.lt.Second().EquivalentTo(expr.Second()) {
		return LessThanOrEquals(expr.First(), this.lt.First()), nil
	}

	return false, nil
}
Exemplo n.º 3
0
func newSargLE(pred *expression.LE) *sargLE {
	rv := &sargLE{}
	rv.sarger = func(expr2 expression.Expression) (plan.Spans, error) {
		if SubsetOf(pred, expr2) {
			return _SELF_SPANS, nil
		}

		var exprs expression.Expressions
		span := &plan.Span{}

		if pred.First().EquivalentTo(expr2) {
			hs := pred.Second().Static()
			if hs != nil {
				if rv.MissingHigh() {
					exprs = expression.Expressions{expression.NewSuccessor(hs)}
				} else {
					exprs = expression.Expressions{hs}
					span.Range.Inclusion = datastore.HIGH
				}

				span.Range.High = exprs
			}
		} else if pred.Second().EquivalentTo(expr2) {
			exprs = expression.Expressions{pred.First().Static()}
			span.Range.Low = exprs
			span.Range.Inclusion = datastore.LOW
		} else {
			return nil, nil
		}

		if len(exprs) == 0 || exprs[0] == nil {
			return nil, nil
		}

		return plan.Spans{span}, nil
	}

	return rv
}