mercredi 25 mars 2020

How to handle relational data without SQL

Context

I need to convert a WebSQL app to Indexeddb for an offline centered web app.

The intent is to have a user pull down all necessary data while on a connection, then have them travel into areas with little-to-no connectivity. The app will need to still function and periodically sync when ever a connection is available.

Caveats

Right now it seems like changing any queries is out of the question and so I will need to work with the current response, which is essentially a collection of tables converted to JSON. With the WebSQL API, they used sql operations to query data on the client using combinations of join, where, order by, etc.

I've never had a constraint like this before and am left scratching my head on what approach to take. As far as I know, Indexeddb doesn't offer any sort of relational querying, so I will need to implement that in code.

Question

What approaches could I take to mimic the functionality of sql, such as join sets of data, in JavaScript?

*Note: once I have the data on the front-end, I'm free to restructure it anyway I like that benefits managing it.

Aucun commentaire:

Enregistrer un commentaire