googleapis / googleapis/google-cloud-node
Global converters for different types
@wu-hui ci sta già lavorando.
Dal 12/2/2021.
- 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
- 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.
Valutazione
Questa issue non è ancora stata valutata.