示例#1
0
文件: lt.go 项目: pkdevboxy/query
func LessThan(expr1, expr2 expression.Expression) bool {
	value1 := expr1.Value()
	value2 := expr2.Value()

	return value1 != nil && value2 != nil &&
		value1.Collate(value2) < 0
}
示例#2
0
文件: subset.go 项目: pkdevboxy/query
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
}