googleapis / googleapis/google-cloud-node

Global converters for different types

Aperta
#7,487 6 commenti 3 reazioni 1 assegnatario Vedi su GitHub

@wu-hui ci sta già lavorando.

Dal 12/2/2021.

api: firestore library: nodejs-firestore type: feature request
Lingua principale
TypeScript
Stelle
3.2k
Fork
713
Merge medio
2g 9h
PR unite (30g)
104

Descrizione

The idea is to set global converters, maybe using

admin.firestore().settings({
    converters: []
})

That can be reused along with all the requests and for individual types, for example, for Timestamp:

I have many models where I use the Javascript Date object which gets converted to a Timestamp object, and when I get from the database, I cannot use snapshot.data() as MyModel, because if MyModel contains a Date property, it will be undefined since Timestamp cannot be converted directly to Date. This can be solved using a converter and withConverter, but it makes sense to have many converters only for a Date property? Why we can make it global using FirestoreDataConverter<Date> ?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.