@@ -156,17 +156,26 @@ interface GenericExecuteSpec extends BindSpec<GenericExecuteSpec> {
156
156
*/
157
157
<R > TypedExecuteSpec <R > as (Class <R > resultType );
158
158
159
+ /**
160
+ * Configure a result mapping {@link java.util.function.BiFunction function}.
161
+ *
162
+ * @param mappingFunction must not be {@literal null}.
163
+ * @param <R> result type.
164
+ * @return
165
+ */
166
+ <R > FetchSpec <R > map (BiFunction <Row , RowMetadata , R > mappingFunction );
167
+
159
168
/**
160
169
* Perform the SQL call and retrieve the result.
161
170
*/
162
171
FetchSpec <Map <String , Object >> fetch ();
163
172
164
173
/**
165
- * Perform the SQL request and return a {@link SqlResult} .
174
+ * Perform the SQL call and return a {@link Mono} that completes without result on statement completion .
166
175
*
167
- * @return a {@code Mono} for the result
176
+ * @return a {@link Mono} ignoring its payload (actively dropping).
168
177
*/
169
- Mono <SqlResult < Map < String , Object >>> exchange ();
178
+ Mono <Void > then ();
170
179
}
171
180
172
181
/**
@@ -183,17 +192,26 @@ interface TypedExecuteSpec<T> extends BindSpec<TypedExecuteSpec<T>> {
183
192
*/
184
193
<R > TypedExecuteSpec <R > as (Class <R > resultType );
185
194
195
+ /**
196
+ * Configure a result mapping {@link java.util.function.BiFunction function}.
197
+ *
198
+ * @param mappingFunction must not be {@literal null}.
199
+ * @param <R> result type.
200
+ * @return
201
+ */
202
+ <R > FetchSpec <R > map (BiFunction <Row , RowMetadata , R > mappingFunction );
203
+
186
204
/**
187
205
* Perform the SQL call and retrieve the result.
188
206
*/
189
207
FetchSpec <T > fetch ();
190
208
191
209
/**
192
- * Perform the SQL request and return a {@link SqlResult} .
210
+ * Perform the SQL call and return a {@link Mono} that completes without result on statement completion .
193
211
*
194
- * @return a {@code Mono} for the result
212
+ * @return a {@link Mono} ignoring its payload (actively dropping).
195
213
*/
196
- Mono <SqlResult < T >> exchange ();
214
+ Mono <Void > then ();
197
215
}
198
216
199
217
/**
@@ -229,7 +247,7 @@ interface InsertIntoSpec {
229
247
* @param table must not be {@literal null} or empty.
230
248
* @return
231
249
*/
232
- GenericInsertSpec into (String table );
250
+ GenericInsertSpec < Map < String , Object >> into (String table );
233
251
234
252
/**
235
253
* Specify the target table to insert to using the {@link Class entity class}.
@@ -255,16 +273,18 @@ interface GenericSelectSpec extends SelectSpec<GenericSelectSpec> {
255
273
<R > TypedSelectSpec <R > as (Class <R > resultType );
256
274
257
275
/**
258
- * Perform the SQL call and retrieve the result.
276
+ * Configure a result mapping {@link java.util.function.BiFunction function}.
277
+ *
278
+ * @param mappingFunction must not be {@literal null}.
279
+ * @param <R> result type.
280
+ * @return
259
281
*/
260
- FetchSpec <Map < String , Object >> fetch ( );
282
+ < R > FetchSpec <R > map ( BiFunction < Row , RowMetadata , R > mappingFunction );
261
283
262
284
/**
263
- * Perform the SQL request and return a {@link SqlResult}.
264
- *
265
- * @return a {@code Mono} for the result
285
+ * Perform the SQL call and retrieve the result.
266
286
*/
267
- Mono < SqlResult < Map <String , Object >>> exchange ();
287
+ FetchSpec < Map <String , Object >> fetch ();
268
288
}
269
289
270
290
/**
@@ -279,28 +299,21 @@ interface TypedSelectSpec<T> extends SelectSpec<TypedSelectSpec<T>> {
279
299
* @param resultType must not be {@literal null}.
280
300
* @param <R> result type.
281
301
*/
282
- <R > TypedSelectSpec <R > as (Class <R > resultType );
302
+ <R > FetchSpec <R > as (Class <R > resultType );
283
303
284
304
/**
285
- * Configure a result mapping {@link java.util.function.Function }.
305
+ * Configure a result mapping {@link java.util.function.BiFunction function }.
286
306
*
287
307
* @param mappingFunction must not be {@literal null}.
288
308
* @param <R> result type.
289
309
* @return
290
310
*/
291
- <R > TypedSelectSpec <R > extract (BiFunction <Row , RowMetadata , R > mappingFunction );
311
+ <R > FetchSpec <R > map (BiFunction <Row , RowMetadata , R > mappingFunction );
292
312
293
313
/**
294
314
* Perform the SQL call and retrieve the result.
295
315
*/
296
316
FetchSpec <T > fetch ();
297
-
298
- /**
299
- * Perform the SQL request and return a {@link SqlResult}.
300
- *
301
- * @return a {@code Mono} for the result
302
- */
303
- Mono <SqlResult <T >> exchange ();
304
317
}
305
318
306
319
/**
@@ -332,24 +345,26 @@ interface SelectSpec<S extends SelectSpec<S>> {
332
345
333
346
/**
334
347
* Contract for specifying {@code INSERT} options leading to the exchange.
348
+ *
349
+ * @param <T> Result type of tabular insert results.
335
350
*/
336
- interface GenericInsertSpec extends InsertSpec {
351
+ interface GenericInsertSpec < T > extends InsertSpec < T > {
337
352
338
353
/**
339
354
* Specify a field and non-{@literal null} value to insert.
340
355
*
341
356
* @param field must not be {@literal null} or empty.
342
357
* @param value must not be {@literal null}
343
358
*/
344
- GenericInsertSpec value (String field , Object value );
359
+ GenericInsertSpec < T > value (String field , Object value );
345
360
346
361
/**
347
362
* Specify a {@literal null} value to insert.
348
363
*
349
364
* @param field must not be {@literal null} or empty.
350
365
* @param type must not be {@literal null}.
351
366
*/
352
- GenericInsertSpec nullValue (String field , Class <?> type );
367
+ GenericInsertSpec < T > nullValue (String field , Class <?> type );
353
368
}
354
369
355
370
/**
@@ -363,7 +378,7 @@ interface TypedInsertSpec<T> {
363
378
* @param objectToInsert
364
379
* @return
365
380
*/
366
- InsertSpec using (T objectToInsert );
381
+ InsertSpec < Map < String , Object >> using (T objectToInsert );
367
382
368
383
/**
369
384
* Use the given {@code tableName} as insert target.
@@ -374,30 +389,43 @@ interface TypedInsertSpec<T> {
374
389
TypedInsertSpec <T > table (String tableName );
375
390
376
391
/**
377
- * Insert the given {@link Publisher} to insert one or more objects.
392
+ * Insert the given {@link Publisher} to insert one or more objects. Inserts only a single object when calling
393
+ * {@link FetchSpec#one()} or {@link FetchSpec#first()}.
378
394
*
379
395
* @param objectToInsert
380
396
* @return
397
+ * @see InsertSpec#fetch()
381
398
*/
382
- InsertSpec using (Publisher <T > objectToInsert );
399
+ InsertSpec < Map < String , Object >> using (Publisher <T > objectToInsert );
383
400
}
384
401
385
402
/**
386
403
* Contract for specifying {@code INSERT} options leading to the exchange.
404
+ *
405
+ * @param <T> Result type of tabular insert results.
387
406
*/
388
- interface InsertSpec {
407
+ interface InsertSpec <T > {
408
+
409
+ /**
410
+ * Configure a result mapping {@link java.util.function.BiFunction function}.
411
+ *
412
+ * @param mappingFunction must not be {@literal null}.
413
+ * @param <R> result type.
414
+ * @return
415
+ */
416
+ <R > FetchSpec <R > map (BiFunction <Row , RowMetadata , R > mappingFunction );
389
417
390
418
/**
391
- * Perform the SQL call.
419
+ * Perform the SQL call and retrieve the result .
392
420
*/
393
- Mono < Void > then ();
421
+ FetchSpec < T > fetch ();
394
422
395
423
/**
396
- * Perform the SQL request and return a {@link SqlResult} .
424
+ * Perform the SQL call and return a {@link Mono} that completes without result on statement completion .
397
425
*
398
- * @return a {@code Mono} for the result
426
+ * @return a {@link Mono} ignoring its payload (actively dropping).
399
427
*/
400
- Mono <SqlResult < Map < String , Object >>> exchange ();
428
+ Mono <Void > then ();
401
429
}
402
430
403
431
/**
0 commit comments