loopbackio / loopbackio/loopback-datasource-juggler

Allow connectors to use async/await

Abierto
#1,659 1 comentario 0 reacciones 1 asignado Ver en GitHub

@markirish ya está trabajando en esto.

Desde el 24/9/2019.

community-contribution feature help wanted major
Lenguaje dominante
JavaScript
Estrellas
282
Forks
366
Merge medio
17 h 4 min
PR fusionados (30 d)
10

Descripción

I would like to allow connector authors to use async functions instead of the current callback style.

Acceptance criteria

  • Define a new contract for connector: a connector provides a flag indicating whether it's callback based or async/promise based. We assume callbacks when the flag is not set (backward compatibility).
  • All DAO/KVAO methods need to be updated to check what flavor of flow control the connector support and invoke connector methods accordingly. Ideally, there should be a shared helper taking care of implementation details of consuming callback or promise style connectors.
  • Rework Connector and SqlConnector classes provided by loopback-connector to use async functions instead of callbacks everywhere. This is a semver-major change.
  • Rework the documentation for connector authors to use async functions instead of callbacks.
  • Add a new DataSource method execute that supports dual callback/promise API and under the hood calls connector's execute method using the correct style (callback/promise) as provided by the connector. EDIT: The method was already added by https://github.com/strongloop/loopback-datasource-juggler/pull/1671, now we need to update it to support async execute provided by the connector.

Out of scope

Eventually we should update all of our connectors to use the new major version of loopback-connector and switch to async functions. There should be follow-up issues opened (one per the connector repository). Note that connectors using async functions become incompatible with LB 3.x projects (because they don't support connectors exporting async functions), the upgrade must be released as semver-major.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.