Skip to content

Add support for batch operations (R2DBC) #27229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;

import io.r2dbc.spi.ConnectionFactory;
import io.r2dbc.spi.Parameter;
import io.r2dbc.spi.Readable;
import io.r2dbc.spi.Result;
import io.r2dbc.spi.Row;
Expand Down Expand Up @@ -210,6 +212,13 @@ interface GenericExecuteSpec {
*/
GenericExecuteSpec bindProperties(Object source);

/**
* Bind values from the given mapping function.
* @param paramsFunction a function that maps from {@link Params} to {@link Params} with new bindings
* @since 6.1
*/
GenericExecuteSpec bind(UnaryOperator<Params> paramsFunction);

/**
* Add the given filter to the end of the filter chain.
* <p>Filter functions are typically used to invoke methods on the Statement
Expand Down Expand Up @@ -300,4 +309,51 @@ default GenericExecuteSpec filter(Function<? super Statement, ? extends Statemen
Mono<Void> then();
}

/**
* Interface that defines common functionality for parameter binding.
*/
interface Params {
/**
* See {@link GenericExecuteSpec#bind(String, Object)}.
*/
Params bind(String name, Object value);

/**
* See {@link GenericExecuteSpec#bind(int, Object)}.
*/
Params bind(int index, Object value);

/**
* See {@link GenericExecuteSpec#bindNull(String, Class)}.
*/
Params bindNull(String name, Class<?> type);

/**
* See {@link GenericExecuteSpec#bind(int, Object)}.
*/
Params bindNull(int index, Class<?> type);

/**
* See {@link GenericExecuteSpec#bindValues(Map)}.
*/
Params bindValues(Map<String, ?> source);

/**
* See {@link GenericExecuteSpec#bindProperties(Object)}.
*/
Params bindProperties(Object source);

/**
* Get bindings by index.
* @return index based params
*/
Map<Integer, Parameter> byIndex();

/**
* Get bindings by name.
* @return name based params
*/
Map<String, Parameter> byName();
}

}
Loading