@@ -54,8 +54,28 @@ public interface CouchbaseOperations extends FluentCouchbaseOperations {
|
||||
*/
|
||||
QueryScanConsistency getConsistency();
|
||||
|
||||
/**
|
||||
* Save the entity to couchbase.<br>
|
||||
* If there is no version property on the entity class, and this is in a transaction, use insert. <br>
|
||||
* If there is no version property on the entity class, and this is not in a transaction, use upsert. <br>
|
||||
* If there is a version property on the entity class, and it is non-zero, then this is an existing document, use
|
||||
* replace.<br>
|
||||
* Otherwise, there is a version property for the entity, but it is zero or null, use insert. <br>
|
||||
*
|
||||
* @param entity the entity to save in couchbase
|
||||
* @param scopeAndCollection for use by repositories only. these are varargs for the scope and collection.
|
||||
* @param <T> the entity class
|
||||
* @return
|
||||
*/
|
||||
<T> T save(T entity, String... scopeAndCollection);
|
||||
|
||||
/**
|
||||
* Returns the count of documents found by the query.
|
||||
* @param query
|
||||
* @param domainType
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> Long count(Query query, Class<T> domainType);
|
||||
|
||||
}
|
||||
|
||||
@@ -52,9 +52,29 @@ public interface ReactiveCouchbaseOperations extends ReactiveFluentCouchbaseOper
|
||||
*/
|
||||
CouchbaseClientFactory getCouchbaseClientFactory();
|
||||
|
||||
/**
|
||||
* Save the entity to couchbase.<br>
|
||||
* If there is no version property on the entity class, and this is in a transaction, use insert. <br>
|
||||
* If there is no version property on the entity class, and this is not in a transaction, use upsert. <br>
|
||||
* If there is a version property on the entity class, and it is non-zero, then this is an existing document, use
|
||||
* replace.<br>
|
||||
* Otherwise, there is a version property for the entity, but it is zero or null, use insert. <br>
|
||||
*
|
||||
* @param entity the entity to save in couchbase
|
||||
* @param scopeAndCollection for use by repositories only. these are varargs for the scope and collection.
|
||||
* @param <T> the entity class
|
||||
* @return
|
||||
*/
|
||||
<T> Mono<T> save(T entity, String... scopeAndCollection);
|
||||
|
||||
<T> Mono<Long> count(Query query, Class<T> personClass);
|
||||
/**
|
||||
* Returns the count of documents found by the query.
|
||||
* @param query
|
||||
* @param domainType
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> Mono<Long> count(Query query, Class<T> domainType);
|
||||
|
||||
/**
|
||||
* @return the default consistency to use for queries
|
||||
|
||||
@@ -72,10 +72,7 @@ public class ReactiveCouchbaseTemplate implements ReactiveCouchbaseOperations, A
|
||||
this.scanConsistency = scanConsistency;
|
||||
}
|
||||
|
||||
public <T> Mono<T> save(T entity) {
|
||||
return save(entity, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Mono<T> save(T entity, String... scopeAndCollection) {
|
||||
Assert.notNull(entity, "Entity must not be null!");
|
||||
String scope = scopeAndCollection.length > 0 ? scopeAndCollection[0] : null;
|
||||
|
||||
Reference in New Issue
Block a user