Пример #1
0
func LessThan(expr1, expr2 expression.Expression) bool {
	value1 := expr1.Value()
	value2 := expr2.Value()

	return value1 != nil && value2 != nil &&
		value1.Collate(value2) < 0
}
Пример #2
0
func SubsetOf(expr1, expr2 expression.Expression) bool {
	v2 := expr2.Value()
	if v2 != nil {
		return v2.Truth()
	}

	s := newSubset(expr1)
	result, _ := expr2.Accept(s)
	return result.(bool)
}
Пример #3
0
/*
The function NewExecute returns a pointer to the Execute
struct with the input argument expressions value as a field.
*/
func NewExecute(prepared expression.Expression) *Execute {
	var preparedValue value.Value

	switch prepared := prepared.(type) {
	case *expression.Identifier:
		preparedValue = value.NewValue(prepared.Alias())
	default:
		preparedValue = prepared.Value()
	}

	rv := &Execute{
		prepared: preparedValue,
	}

	rv.stmt = rv
	return rv
}