-
Notifications
You must be signed in to change notification settings - Fork 56
filter required parameters for query execution #26
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
Conversation
df9f9b5
to
72bb53b
Compare
72bb53b
to
d7a1dd7
Compare
throw new IllegalStateException("Old parameter should have symbolic name or unsigned decimal integer value"); | ||
} | ||
|
||
throw new IllegalStateException("Parameter should have either new parameter or old parameter representation"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "graphbdb-plugin-invalid-parameter-name-should-never-happen";
Map<String, Object> result = parametersService | ||
.getParameters(getPsiFile("match (p:Person) where p.name = $name return *")); | ||
|
||
assertThat(result.keySet()).contains("name"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertThat(result).containsChtoTo("name", "Anna")
|
||
Map<String, Object> jsonVal = (Map<String, Object>) result.get("p3"); | ||
assertThat(jsonVal).containsKey("name"); | ||
assertThat(jsonVal).containsValue("Alex"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertThat(jsonVal).hasSize()
throw new IllegalStateException("Parameters provider already registered"); | ||
} | ||
this.parametersProvider = parametersProvider; | ||
} | ||
|
||
public Map<String, Object> getParameters() throws Exception { | ||
public Map<String, Object> getParameters(PsiElement query) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
element
private Set<String> extractParameterNames(PsiElement query) { | ||
List<PsiElement> parameterElements = TraverseUtil.collectPsiElementsByType(query, CypherTypes.PARAMETER); | ||
return parameterElements.stream() | ||
.map(elem -> CypherPsiImplUtil.getParameterName(((CypherParameter) elem))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
((CypherParameter) elem).getParameterName()
No description provided.