-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: is null/is not null * fix: search null for collections * refactor: null not case sensitive * doc: update README.md * refactor: throw if operand != IS | IS NOT * refactor: throw if calling buildPredicate parent method with empty clause * refactor: don't allow search for null collections * refactor: don't allow search for null collections * fix: lint * test: add test for searching for empty non-collection fields * refactor: avoid passing null value, check literal value instead (SearchOperation.NULL) * fix: add missing check for "NULL" value in strategies * fix: update threshold * fix: remove unreachable code * test: add test for UUID null * test: canGetUsersWithUpdatedDateAtNull * test: LocalDateTime is not null * test: Int Boolean and Date is null * trigger-ci * trigger-ci * fix: ktlint * fix: ktlint * fix: ktlint --------- Co-authored-by: vincentescoffier <[email protected]>
- Loading branch information
Showing
21 changed files
with
289 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project version="4"> | ||
<component name="JpaPluginProjectSettings"> | ||
<option name="lastSelectedLanguage" value="Kotlin" /> | ||
</component> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/kotlin/com/sipios/springsearch/strategies/BooleanStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package com.sipios.springsearch.strategies | ||
|
||
import com.sipios.springsearch.SearchOperation | ||
import kotlin.reflect.KClass | ||
|
||
class BooleanStrategy : ParsingStrategy { | ||
override fun parse(value: String?, fieldClass: KClass<out Any>): Any? { | ||
if (value == SearchOperation.NULL) return value | ||
return value?.toBoolean() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/kotlin/com/sipios/springsearch/strategies/EnumStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package com.sipios.springsearch.strategies | ||
|
||
import com.sipios.springsearch.SearchOperation | ||
import kotlin.reflect.KClass | ||
|
||
class EnumStrategy : ParsingStrategy { | ||
override fun parse(value: String?, fieldClass: KClass<out Any>): Any? { | ||
if (value == SearchOperation.NULL) return value | ||
return Class.forName(fieldClass.qualifiedName).getMethod("valueOf", String::class.java).invoke(null, value) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/kotlin/com/sipios/springsearch/strategies/UUIDStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package com.sipios.springsearch.strategies | ||
|
||
import com.sipios.springsearch.SearchOperation | ||
import java.util.UUID | ||
import kotlin.reflect.KClass | ||
|
||
class UUIDStrategy : ParsingStrategy { | ||
override fun parse(value: String?, fieldClass: KClass<out Any>): Any? { | ||
if (value == SearchOperation.NULL) return value | ||
return UUID.fromString(value) | ||
} | ||
} |
Oops, something went wrong.