Skip to content

Commit

Permalink
chore: define defaul mapper to Dynamicquery
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <[email protected]>
  • Loading branch information
otaviojava committed Jul 10, 2024
1 parent 491e704 commit 2247ef9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,12 @@ public SelectQuery get() {
* Creates a {@link DynamicQuery} instance
* @param args the method parameters
* @param query the column query
* @param sortParser the sort parser
* @return the {@link DynamicQuery} instance
* @throws NullPointerException when either args or query are null
*/
public static DynamicQuery of(Object[] args, SelectQuery query, Function<String, String> sortParser) {
public static DynamicQuery of(Object[] args, SelectQuery query) {
Objects.requireNonNull(args, "args is required");
Objects.requireNonNull(query, "query is required");
return new DynamicQuery(DynamicReturn.findSpecialParameters(args, sortParser), query);
return new DynamicQuery(DynamicReturn.findSpecialParameters(args, Function.identity()), query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ void shouldReturnWhenThereIsLimitAndSort(){
when(query.skip()).thenReturn(0L);
when(query.limit()).thenReturn(10L);

Function<String, String> sortParser = Function.identity();

DynamicQuery dynamicQuery = DynamicQuery.of(new Object[]{Sort.asc("name"), Limit.of(20)}
, query, sortParser);
, query);

SelectQuery columnQuery = dynamicQuery.get();
assertEquals("sampleQuery", columnQuery.name());
Expand Down

0 comments on commit 2247ef9

Please sign in to comment.