[Bug] `hgetall` returns an empty object rather than `undefined` if the key does not exist
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- redis, typescript
- Ambito
- databases
Direzione di ricerca
Start with packages/public-api/src/types/redis.ts at the hgetall declaration and trace the corresponding implementation and tests. Reproduce the missing-key case described in the issue, then verify that hgetall returns undefined consistently with the stated typehint and the existing get and hget behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Info
If a given key does not exist, hgetall returns an empty object rather than undefined as the typehint suggests.
This object unfortunately evaluates as truthy and therefore requires the user to check if keys are present in the object to determine whether the hash actually existed.
This appears to differ from the current behavior of both get and hget.
Example
const foo = await context.redis.hgetall('foo'); // no hash actually exists at key 'foo'
if (foo) {
console.log('foo is true'); // this will be output
}
console.log(foo); // [Object object]
- Lingua principale
- TypeScript
- Stelle
- 210
- Fork
- 88
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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 reddit/devvit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
Tutte le issue di reddit/devvit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
0xMiden/bridge-portal#132 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
area:tools bug good first issue help wanted priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
newrelic-experimental/preflight#793 · 1 commento ·