DATACOUCH-650 - Implements CrudRepository and ReactiveCrudRepository.deleteById(Iterable<ID> ids).
Original pull request: #279.
This commit is contained in:
committed by
Mark Paluch
parent
605285188b
commit
3aeff66a3b
@@ -42,6 +42,7 @@ import com.couchbase.client.java.query.QueryScanConsistency;
|
||||
*
|
||||
* @author Michael Nitschinger
|
||||
* @author Mark Paluch
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
public class SimpleCouchbaseRepository<T, ID> implements CouchbaseRepository<T, ID> {
|
||||
|
||||
@@ -130,6 +131,12 @@ public class SimpleCouchbaseRepository<T, ID> implements CouchbaseRepository<T,
|
||||
couchbaseOperations.removeById().all(Streamable.of(entities).map(entityInformation::getId).toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllById(Iterable<? extends ID> ids) {
|
||||
Assert.notNull(ids, "The given Iterable of ids must not be null!");
|
||||
couchbaseOperations.removeById().all(Streamable.of(ids).map(Objects::toString).toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return couchbaseOperations.findByQuery(entityInformation.getJavaType()).consistentWith(buildQueryScanConsistency())
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.couchbase.client.java.query.QueryScanConsistency;
|
||||
* @author Christoph Strobl
|
||||
* @author David Kelly
|
||||
* @author Douglas Six
|
||||
* @author Jens Schauder
|
||||
* @since 3.0
|
||||
*/
|
||||
public class SimpleReactiveCouchbaseRepository<T, ID> implements ReactiveCouchbaseRepository<T, ID> {
|
||||
@@ -185,6 +186,11 @@ public class SimpleReactiveCouchbaseRepository<T, ID> implements ReactiveCouchba
|
||||
return Flux.from(entityStream).flatMap(this::delete).single();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteAllById(final Iterable<? extends ID> ids) {
|
||||
return operations.removeById().all(Streamable.of(ids).map(Object::toString).toList()).then();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Mono<Long> count() {
|
||||
|
||||
Reference in New Issue
Block a user