Documentation
¶
Index ¶
- func IsExpr(in any) bool
- func Validate(in any) (err error)
- type Column
- type Expression
- func AND(a, b any) *Expression
- func BOOST(e any, power ...float64) *Expression
- func Eq(a any, b any) *Expression
- func Expr(left any, op Operator, right ...any) *Expression
- func FUZZY(e any, distance ...int) *Expression
- func GREATER(a any, b any) *Expression
- func GREATEREQ(a any, b any) *Expression
- func IN(a any, b any) *Expression
- func LESS(a any, b any) *Expression
- func LESSEQ(a any, b any) *Expression
- func LIKE(a any, b any) *Expression
- func LIST(a ...any) *Expression
- func Lit(in any) *Expression
- func MUST(e any) *Expression
- func MUSTNOT(e any) *Expression
- func NOT(e any) *Expression
- func OR(a, b any) *Expression
- func REGEXP(in any) *Expression
- func Rang(term any, min, max any, inclusive bool) *Expression
- func WILD(in any) *Expression
- type Operator
- type RangeBoundary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶
type Column string
Column represents a column in sql. It will not be escaped by quotes in the sql rendering
type Expression ¶
type Expression struct {
Left any `json:"left"`
Op Operator `json:"-"`
Right any `json:"right,omitempty"`
// contains filtered or unexported fields
}
Expression is an interface over all the different types of expressions that we can parse out of lucene
func Expr ¶
func Expr(left any, op Operator, right ...any) *Expression
Expr creates a general new expression. The other public functions are just helpers that call this function underneath.
func GREATER ¶
func GREATER(a any, b any) *Expression
func GREATEREQ ¶
func GREATEREQ(a any, b any) *Expression
func IN ¶
func IN(a any, b any) *Expression
func LESS ¶
func LESS(a any, b any) *Expression
func LESSEQ ¶
func LESSEQ(a any, b any) *Expression
func LIST ¶
func LIST(a ...any) *Expression
func Rang ¶
func Rang(term any, min, max any, inclusive bool) *Expression
Rang creates a new range expression
func (Expression) GoString ¶
func (e Expression) GoString() string
GoString prints a verbose string representation. Useful for debugging exactly what types were parsed. You can print this format using %#v
func (Expression) MarshalJSON ¶
func (e Expression) MarshalJSON() (out []byte, err error)
MarshalJSON is a custom JSON serialization for the Expression
func (Expression) String ¶
func (e Expression) String() string
func (*Expression) UnmarshalJSON ¶
func (e *Expression) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON is a custom JSON deserialization for the Expression
type Operator ¶
type Operator int
Operator is an enum over the different valid lucene operations
const ( Undefined Operator = iota And Or Equals Like Not Range Must MustNot Boost Fuzzy Literal Wild Regexp Greater Less GreaterEq LessEq In List )
operations that can be used To add a new operator, do the following: 1. Add it to the iota here 2. Add it to the string maps below 3. Add a render function for it at least in base, perhaps in all the drivers as well 4. Update the json parsing and tests to support the new operator 5. Add tests in parse_test and expression_test
type RangeBoundary ¶
type RangeBoundary struct {
Min any `json:"min"`
Max any `json:"max"`
Inclusive bool `json:"inclusive"`
}
RangeBoundary represents the boundary conditions for a range operator