Skip to content

Commit

Permalink
Merge pull request #168 from jakartaee/update-template
Browse files Browse the repository at this point in the history
Change Template repository with new two delete methods
  • Loading branch information
otaviojava committed Aug 10, 2023
2 parents ecbace5 + 68ec907 commit 400b460
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version

== [Unreleased]

=== Added

* Add Delete by entity at Template

=== Changed

* Change the KeyValueTemplate method to use deleteByKey

== [1.0.0-b7] - 2023-06-22

=== Added
Expand Down
16 changes: 16 additions & 0 deletions api/nosql-core/src/main/java/jakarta/nosql/Template.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,22 @@ public interface Template {
*/
<T, K> void delete(Class<T> type, K id);

/**
* Deletes a given entity. Deletion is performed by matching the Id.
*
* @param entity must not be {@literal null}.
* @throws NullPointerException when the entity is null
*/
<T> void delete(T entity);

/**
* Deletes the given entities. Deletion of each entity is performed by matching the Id.
*
* @param entities must not be {@literal null}. Must not contain {@literal null} elements.
* @throws NullPointerException when either the iterable is null or contains null elements
*/
<T> void delete(Iterable<? extends T> entities);

/**
* It starts a query using the fluent-API journey. It is a mutable and non-thread-safe instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ default <T> Iterable<T> put(Iterable<T> entities, Duration ttl) {
* @param <K> the key type
* @throws NullPointerException when the key is null
*/
<K> void delete(K key);
<K> void deleteByKey(K key);

/**
* Removes entities from keys
Expand All @@ -192,6 +192,6 @@ default <T> Iterable<T> put(Iterable<T> entities, Duration ttl) {
* @param <K> the key type
* @throws NullPointerException when the key is null
*/
<K> void delete(Iterable<K> keys);
<K> void deleteByKey(Iterable<K> keys);

}

0 comments on commit 400b460

Please sign in to comment.