示例#1
0
文件: lt.go 项目: amarantha-k/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
/*
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 {
	rv := &Execute{
		prepared: prepared.Value(),
	}

	rv.stmt = rv
	return rv
}
示例#3
0
func SargableFor(expr1, expr2 expression.Expression) bool {
	if expr2.Value() != nil {
		return false
	}

	s := newSargable(expr1)
	result, _ := expr2.Accept(s)
	return result.(bool)
}
示例#4
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)
}
示例#5
0
文件: sarg.go 项目: amarantha-k/query
func SargFor(expr1, expr2 expression.Expression) Spans {
	if expr2.Value() != nil {
		return nil
	}

	s := newSarg(expr1)
	result, _ := expr2.Accept(s)
	if result != nil {
		return result.(Spans)
	}

	return nil
}