You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It uses [JaQue](https://github.com/TrigerSoft/jaque) to build an expression tree for a lambda. The expression tree is then traversed and converted to a SQL statement.
35
-
36
-
Under the hood, JaQue depends on the system property `jdk.internal.lambda.dumpProxyClasses`, if the lambda expression is not serialized:
37
-
See [https://bugs.openjdk.java.net/browse/JDK-8023524](https://bugs.openjdk.java.net/browse/JDK-8023524).
38
-
39
-
When the property is enabled, JVM generated classes for lambdas are saved to disk. JaQue then uses [ASM](http://asm.ow2.org/) to read the .class files and creates expression trees.
40
-
41
-
Since the functional interfaces included in this project are automatically serialized, there is no need to set this property.
42
-
The interfaces ``SqlPredicate<T>`` and ``SqlFunction<T>`` can be used exactly like the original functional interfaces.
34
+
It uses [Expressions](https://github.com/CollinAlpert/Expressions) (based
35
+
upon [JaQue](https://github.com/TrigerSoft/jaque)) to build an expression tree for a lambda. The expression tree is then
36
+
traversed and converted to an SQL WHERE clause.
37
+
38
+
**The following is only for explanatory purposes. You do not need to set this property anywhere, as long as you use the
39
+
interfaces ``SqlPredicate<T>`` and ``SqlFunction<T>``**:\
40
+
Under the hood, JaQue depends on the system property `jdk.internal.lambda.dumpProxyClasses`, if the lambda expression is
41
+
not serialized:
42
+
See [https://bugs.openjdk.java.net/browse/JDK-8023524](https://bugs.openjdk.java.net/browse/JDK-8023524). \
43
+
When the property is enabled, JVM generated classes for lambdas are saved to disk. JaQue then
44
+
uses [ASM](http://asm.ow2.org/) to read the .class files and creates expression trees.
45
+
46
+
Since the functional interfaces included in this project are automatically serialized, there is no need to set this
47
+
property. The interfaces ``SqlPredicate<T>`` and ``SqlFunction<T>`` can be used exactly like the original functional
48
+
interfaces.
43
49
44
50
Features
45
51
---------
46
52
47
-
Current version works with predicates, functions and supports the following operators: >, >=, <, <=, =, !=, &&, ||, !. The DateTime API introduced in Java 8 is also supported.
53
+
Current version works with predicates, functions and supports the following operators: >, >=, <, <=, =, !=, &&, ||, !.
54
+
The DateTime API introduced in Java 8 is also supported (`.isBefore()`/`.isAfter()`).
48
55
49
-
It is also possible to achieve ``LIKE`` operations using the String ``startsWith``, ``endsWith`` and ``contains`` methods.
50
-
For example, the lambda expression\
56
+
It is also possible to achieve ``LIKE`` operations using the String ``startsWith``, ``endsWith`` and ``contains``
Lambda2Sql also automatically escapes table names and columns with backticks (\`). If you do not wish this, you can specify it as an argument in the `Lambda2Sql.toSql()` method.
56
-
62
+
Most common SQL functions are supported as well. For example, ``person -> person.getBirthDate().getYear()`` will
63
+
yield `YEAR(person.birthDate)`.\
64
+
``person -> SqlFunctions.sum(person.getAge())`` will yield `SUM(person.age)`
65
+
66
+
Lambda2Sql also automatically escapes table names and columns with backticks (\`). If you do not wish this, you can
67
+
specify it as an argument in the `Lambda2Sql.toSql()` method.
68
+
57
69
Feel free to open an issue with any requests you might have.
0 commit comments