#2 - Polishing.
This commit is contained in:
@@ -315,7 +315,6 @@ public interface DatabaseClient {
|
||||
*/
|
||||
S project(String... selectedFields);
|
||||
|
||||
|
||||
/**
|
||||
* Configure {@link Sort}.
|
||||
*
|
||||
|
||||
@@ -48,28 +48,27 @@ class DefaultSqlResult<T> implements SqlResult<T> {
|
||||
this.resultFunction = resultFunction;
|
||||
this.updatedRowsFunction = updatedRowsFunction;
|
||||
|
||||
this.fetchSpec = new DefaultFetchSpec<>(connectionAccessor, sql,
|
||||
new SqlFunction<Connection, Flux<T>>() {
|
||||
@Override
|
||||
public Flux<T> apply(Connection connection) {
|
||||
return resultFunction.apply(connection).flatMap(result -> result.map(mappingFunction));
|
||||
}
|
||||
this.fetchSpec = new DefaultFetchSpec<>(connectionAccessor, sql, new SqlFunction<Connection, Flux<T>>() {
|
||||
@Override
|
||||
public Flux<T> apply(Connection connection) {
|
||||
return resultFunction.apply(connection).flatMap(result -> result.map(mappingFunction));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
}, new SqlFunction<Connection, Mono<Integer>>() {
|
||||
@Override
|
||||
public Mono<Integer> apply(Connection connection) {
|
||||
return updatedRowsFunction.apply(connection);
|
||||
}
|
||||
@Override
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
}, new SqlFunction<Connection, Mono<Integer>>() {
|
||||
@Override
|
||||
public Mono<Integer> apply(Connection connection) {
|
||||
return updatedRowsFunction.apply(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -155,8 +155,7 @@ public class EntityRowMapper<T> implements BiFunction<Row, RowMetadata, T> {
|
||||
String column = prefix + entity.getRequiredPersistentProperty(parameter.getName()).getColumnName();
|
||||
|
||||
try {
|
||||
return conversionService.convert(resultSet.get(column),
|
||||
parameter.getType().getType());
|
||||
return conversionService.convert(resultSet.get(column), parameter.getType().getType());
|
||||
} catch (Exception o_O) {
|
||||
throw new MappingException(String.format("Couldn't read column %s from Row.", column), o_O);
|
||||
}
|
||||
|
||||
@@ -109,4 +109,3 @@ public class MappingR2dbcConverter {
|
||||
return relationalConverter.getMappingContext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.r2dbc.repository.query;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.data.annotation.QueryAnnotation;
|
||||
|
||||
/**
|
||||
* Annotation to provide SQL statements that will get used for executing the method.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@QueryAnnotation
|
||||
@Documented
|
||||
public @interface Query {
|
||||
|
||||
/**
|
||||
* The SQL statement to execute when the annotated method gets invoked.
|
||||
*/
|
||||
String value();
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.data.projection.ProjectionFactory;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.r2dbc.repository.query;
|
||||
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.r2dbc.function.DatabaseClient;
|
||||
import org.springframework.data.r2dbc.function.DatabaseClient.BindSpec;
|
||||
import org.springframework.data.r2dbc.function.convert.MappingR2dbcConverter;
|
||||
|
||||
Reference in New Issue
Block a user