diff --git a/jnosql-mapping/jnosql-mapping-semistructured/src/main/java/org/eclipse/jnosql/mapping/semistructured/SemistructuredTemplate.java b/jnosql-mapping/jnosql-mapping-semistructured/src/main/java/org/eclipse/jnosql/mapping/semistructured/SemistructuredTemplate.java index 10eb6d7cf..b57b16f29 100644 --- a/jnosql-mapping/jnosql-mapping-semistructured/src/main/java/org/eclipse/jnosql/mapping/semistructured/SemistructuredTemplate.java +++ b/jnosql-mapping/jnosql-mapping-semistructured/src/main/java/org/eclipse/jnosql/mapping/semistructured/SemistructuredTemplate.java @@ -12,6 +12,8 @@ import jakarta.nosql.PreparedStatement; import jakarta.nosql.Template; +import org.eclipse.jnosql.communication.column.ColumnDeleteQuery; +import org.eclipse.jnosql.communication.column.ColumnQuery; import java.util.Optional; import java.util.stream.Stream; @@ -91,4 +93,65 @@ public interface SemistructuredTemplate extends Template { * @throws UnsupportedOperationException if the provider does not support query by text */ PreparedStatement prepare(String query); + + /** + * Deletes an entity + * + * @param query query to delete an entity + * @throws NullPointerException when query is null + */ + void delete(ColumnDeleteQuery query); + + /** + * Finds entities from query + * + * @param query - query to figure out entities + * @param the instance type + * @return entities found by query + * @throws NullPointerException when query is null + */ + Stream select(ColumnQuery query); + + /** + * Returns the number of items in the column family that match a specified query. + * @param query the query + * @return the number of documents from query + * @throws NullPointerException when query is null + */ + long count(ColumnQuery query); + + /** + * Returns whether an entity that match a specified query. + * @param query the query + * @return true if an entity with the given query exists, false otherwise. + * @throws NullPointerException when query it null + */ + boolean exists(ColumnQuery query); + + /** + * Returns a single entity from query + * + * @param query - query to figure out entities + * @param the instance type + * @return an entity on {@link Optional} or {@link Optional#empty()} when the result is not found. + * @throws NullPointerException when query is null + */ + Optional singleResult(ColumnQuery query); + + /** + * Returns all entities on the database + * @param type the entity type filter + * @return the {@link Stream} + * @param the entity type + * @throws NullPointerException when type is null + */ + Stream findAll(Class type); + + /** + * delete all entities from the database + * @param type the entity type filter + * @param the entity type + * @throws NullPointerException when type is null + */ + void deleteAll(Class type); }