-
-
Notifications
You must be signed in to change notification settings - Fork 69
allow to customize json search function #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fekynko
wants to merge
9
commits into
perplexhub:master
Choose a base branch
from
fekynko:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e2e5af8
allow to customize json search function
7960164
undo imports changes
c6cfad3
Merge branch 'perplexhub:master' into master
fekynko ca63c3f
move json query functions configuration to QuerySupport
c1b8c39
updated QuerySupport.toString
40c4ce9
JsonbExtractor
fd6b1d0
JsonbExtractor -> JsonbConfiguration
2f45d43
JsonbConfigurationSupport record
d06e765
JsonbConfigurationSupport -> JsonbConfiguration
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
48 changes: 48 additions & 0 deletions
48
rsql-jpa/src/main/java/io/github/perplexhub/rsql/jsonb/JsonbExtractor.java
This file contains hidden or 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,48 @@ | ||
package io.github.perplexhub.rsql.jsonb; | ||
|
||
/** | ||
* jsonb expression configuration | ||
*/ | ||
public interface JsonbExtractor { | ||
fekynko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
JsonbExtractor DEFAULT = new JsonbExtractor() { | ||
|
||
@Override | ||
public String pathExists() { | ||
return "jsonb_path_exists"; | ||
} | ||
|
||
@Override | ||
public String pathExistsTz() { | ||
return "jsonb_path_exists_tz"; | ||
} | ||
|
||
@Override | ||
public boolean useDateTime() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("pathExists:%s,pathExistsTz:%s,useDateTime:%b", pathExists(), pathExistsTz(), useDateTime()); | ||
} | ||
}; | ||
|
||
/** | ||
* | ||
* @return Postgresql {@code jsonb_path_exists} function to use | ||
*/ | ||
String pathExists(); | ||
|
||
/** | ||
* | ||
* @return Postgresql {@code jsonb_path_exists_tz} function to use | ||
*/ | ||
String pathExistsTz(); | ||
|
||
/** | ||
* | ||
* @return enable temporal values support | ||
*/ | ||
boolean useDateTime(); | ||
} |
26 changes: 26 additions & 0 deletions
26
rsql-jpa/src/main/java/io/github/perplexhub/rsql/jsonb/JsonbExtractorSupport.java
This file contains hidden or 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,26 @@ | ||
package io.github.perplexhub.rsql.jsonb; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.experimental.Accessors; | ||
|
||
/** | ||
* convenient way to define configuration, based on default values | ||
*/ | ||
@Builder | ||
@Accessors(fluent = true) | ||
@Getter | ||
public class JsonbExtractorSupport implements JsonbExtractor { | ||
fekynko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
@Builder.Default | ||
private final String pathExists = JsonbExtractor.DEFAULT.pathExists(); | ||
@Builder.Default | ||
private final String pathExistsTz = JsonbExtractor.DEFAULT.pathExistsTz(); | ||
@Builder.Default | ||
private final boolean useDateTime = JsonbExtractor.DEFAULT.useDateTime(); | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("pathExists:%s,pathExistsTz:%s,useDateTime:%b", pathExists, pathExistsTz, useDateTime); | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.