Expose .iter(), .opt(), etc. methods directly on the params struct.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- postgresql, rust
Línea de trabajo
Start by reading the query parameter struct generation and execution APIs in the repository; the issue does not name specific files or tests. Work out how generated parameter structs could expose .iter() and .opt() while supporting the database client APIs, then add or update coverage for the generated methods. Done means callers can invoke these methods on parameter structs and the existing query execution behavior remains covered.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Migrated from halcyonnouveau/clorinde#85, originally reported by @jvdwrf on 2025-04-06.
Currently, I use the following pattern to execute clorinde methods:
queries::folder::my_query()
.params(
client,
&queries::scoring::MyQueryParams {
field_a: "value_a",
field_b: "value_b",
},
)
.iter()
I feel like my code could be cleaned up a lot if the following were instead possible:
queries::folder::MyQueryParams {
field_a: "value_a",
field_b: "value_b",
}
.iter(client)
// or even:
client.iter(queries::folder::MyQueryParams {
field_a: "value_a",
field_b: "value_b",
})
This removes a lot of code-duplication, and improves readability a lot. I don't like using the method directly without params struct, since it becomes very easy to accidentally map params to the wrong field.
I also think it would be nice if, instead of them being regular methods, it would instead be traits that are implemented. This would allow me to much more easily build abstractions over the various database methods, by implementing them for all param structs at once. (e.g. automatically logging the error in a specific way, using a default impl. super trait)
Original discussion
@beanpuppy (2025-04-06):
client.iter(queries::folder::MyQueryParams { field_a: "value_a", field_b: "value_b", })This isn't possible since
clientis whatever postgres client you're using, and not something we control.queries::folder::MyQueryParams { field_a: "value_a", field_b: "value_b", } .iter(client)But never thought of doing something like this. It seems like a nice idea especially as a trait, and I could see myself using it a lot as well. I'll look into it, thanks for the suggestion.
@jvdwrf (2025-04-07):
For the first version, it would be possible to create an extension trait that would implement these methods for all clients; given that the params structs would implement traits rather than methods. (Though I could also write this myself, it doesnt have to be included in clorinde itself)
(Also, maybe params structs could be generated for single param methods as well? :))
- Lenguaje dominante
- Rust
- Estrellas
- 1.2k
- Forks
- 77
- Merge medio
- 5 d 12 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cornucopia-rs/cornucopia
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
cornucopia-rs/cornucopia#334 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
cornucopia-rs/cornucopia#333 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
cornucopia-rs/cornucopia#330 · 2 comentarios ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
cornucopia-rs/cornucopia#309 · 2 comentarios ·
-
configuration feature
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
cornucopia-rs/cornucopia#292 ·
Todos los issues de cornucopia-rs/cornucopia
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
docs good first issue php
Dificultad 1/5 1-3 horas Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
bug(core): partial tool arguments drop existing string content during a split surrogate pairAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
0xPlaygrounds/rig#3176 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Publish memtop on crates.ioAbiertopackaging
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
SalomonAvila/memtop#23 ·
Los mantenedores suelen responder en 1 día