Skip to content

Commit

Permalink
feat: create parser to query empty
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Jun 30, 2024
1 parent 9a6aff9 commit 6935c7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.eclipse.jnosql.communication.QueryException;

import java.util.Locale;
import java.util.Objects;
import java.util.stream.Stream;

Expand Down Expand Up @@ -69,15 +70,15 @@ public CommunicationPreparedStatement prepare(String query, String entity, Datab
}

private String extractQueryCommand(String query){
if(query.length() < 6){
return "";
}
return query.substring(0, 6).toUpperCase();
}

private void validation(String query, DatabaseManager manager, CommunicationObserverParser observer) {
Objects.requireNonNull(query, "query is required");
Objects.requireNonNull(manager, "manager is required");
Objects.requireNonNull(observer, "manager is observer");
if (query.length() < 6) {
throw new QueryException(String.format("The query %s is invalid", query));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,9 @@ default Map<Boolean, List<Person>> partcionate(String name) {
@Query("FROM Person")
Optional<Person> findByQuery();

@Query(" ")
Optional<Person> all();

@Query("FROM Person WHERE id = :id")
Optional<Person> findByQuery(@Param("id") String id);

Expand Down

0 comments on commit 6935c7e

Please sign in to comment.