awslabs / awslabs/rds-data-api-client-library-java
Collection of DTOs as input parameters
- Lenguaje dominante
- Java
- Estrellas
- 21
- Forks
- 5
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Hi Team,
The library supports var args to pass multiple objects:
```
var account1 = new Account(1, "John");
var account2 = new Account(2, "Mary");
client.forSql("INSERT INTO accounts(accountId, name) VALUES(:accountId, :name)")
.withParamSets(account1, account2)
.execute();
```
If we need to pass Collection we have to call toArray():
```
List accounts = List.of(new Account(1, "John"), new Account(2, "Mary")....);
client.forSql("INSERT INTO accounts(accountId, name) VALUES(:accountId, :name)")
.withParamSets(accounts.toArray())
.execute();
```
Batch saving quite often is used with a list of objects and it would help to avoid extra call toArray().
Could you please add overloaded withParamSets method or a new method to pass java.util.Collection, for instance:
```
List accounts = List.of(new Account(1, "John"), new Account(2, "Mary")....);
client.forSql("INSERT INTO accounts(accountId, name) VALUES(:accountId, :name)")
.withParamCollection(accounts)
.execute();
```
Thank you.
Guía de contribución
Línea de trabajo
Comienza localizando el punto de entrada withParamSets y su gestión actual de varargs. Revisa sus llamadores y pruebas, y luego admite entradas de tipo java.util.Collection manteniendo el comportamiento actual de varargs; se considera completado cuando se puede pasar una colección directamente para la ejecución por lotes.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- database
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100