Expose a trait to opt in for impl Type for PgRange<NewType>
I maintainer di solito rispondono entro 4 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start by reading the existing PgHasArrayType trait and the Type<Postgres> implementations for PgRange<T>; the issue does not name specific files or tests. Check how the current implementations represent range and array type information, including the concern about arrays of ranges. Done means newtype wrappers can opt in to PgRange<NewType> support without breaking existing implementations.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I have found these related issues/pull requests
It seems the same problem has been encountered before in #1258.
Description
My familiarity of SQLx is with Postgres exclusively, and hence my question uses that as frame of reference. The PgHasArrayType, which provides blanket impls like this has often been very useful to me:
impl<T> Type<Postgres> for Vec<T>
where
T: PgHasArrayType,
On the other hand, since impl Type for PgRange<T> is done only for explicit types such as T = i64, there is no way for me to achieve impl Type for PgRange<NewType>, where NewType is a wrapper around i64 providing some invariant, but still being encoded as a BIGINT in Postgres.
I am using SQLx version 0.9.0.
Prefered solution
If this was also handled through a blanket impl
impl<T> Type<Postgres> for PgRange<T>
where
T: PgHasRangeType,
where the proposed trait PgHasRangeType would provide everything the blanket impl needs, I could easily add my newtype to the mix.
I guess a nontrivial question would then also be how arrays of ranges are handled. The idea of a third trait such as PgRangeHasArrayType would be a bit out there, but on the other hand passing that information through PgHasRangeType would require some undesirable type system hacks, in my opinion. I really hope the inverse, a range of arrays, is not something anyone routinely needs.
Is this a breaking change? Why or why not?
No. The existing impl Type for PgRange<T> cases can be converted to impl PgHasRangeType for T, still indirectly providing the desired impl Type for PgRange<T>, or left as they are if desired.
- Lingua principale
- Rust
- Stelle
- 17.5k
- Fork
- 1.7k
- Merge medio
- 1g 17h
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di transact-rs/sqlx
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
transact-rs/sqlx#4466 ·
I maintainer di solito rispondono entro 4 giorni
-
MySQL: ENUM and SET columns with a binary collation are named BINARY or CHARForse già presa @CodeMasterXZT l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transact-rs/sqlx#4453 ·
I maintainer di solito rispondono entro 4 giorni
-
Postgres text arrays: a quoted "NULL" element is decoded as SQL NULLForse già presa @MinJaeRun l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transact-rs/sqlx#4452 ·
I maintainer di solito rispondono entro 4 giorni
-
Fetch stream ends after first error using query macrosForse già presa @barry3406 l’ha presa 206 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transact-rs/sqlx#4126 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
transact-rs/sqlx#3963 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di transact-rs/sqlx
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 70/100
OpenZeppelin/openzeppelin-relayer#967 ·
I maintainer di solito rispondono entro 1 giorno
-
DecisionOutcome::label() / n_dosed(): engine-side mapping so downstream needs no wildcard armAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
src/runs.rs:1987: a missing --source-run-id now answers 400 "Source run ... does not exist", not 404Apertanightly-audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
antithesishq/snouty#602 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
libnativeapi/nativeapi#21 ·