Exemplo n.º 1
0
func (this *LE) Apply(context Context, first, second value.Value) (value.Value, error) {
	cmp := first.Compare(second)
	switch actual := cmp.Actual().(type) {
	case float64:
		return value.NewValue(actual <= 0), nil
	}

	return cmp, nil
}
Exemplo n.º 2
0
func (this *Between) Apply(context Context, item, low, high value.Value) (value.Value, error) {
	lowCmp := item.Compare(low)
	if lowCmp.Type() == value.MISSING {
		return lowCmp, nil
	}

	highCmp := item.Compare(high)
	if highCmp.Type() == value.MISSING {
		return highCmp, nil
	}

	switch lowActual := lowCmp.Actual().(type) {
	case float64:
		switch highActual := highCmp.Actual().(type) {
		case float64:
			return value.NewValue(lowActual >= 0 && highActual <= 0), nil
		}
	}

	return value.NULL_VALUE, nil
}