Question

I'm an SQL person but I've now started programming offline apps in Dart and using IndexedDB seems to be the recommended method of storing local data. I'm using LawnDart to work with these IndexedDB databases and generating my own unique key (just a unix timestamp) and storing the data in the value column as a JSON string.

My question is how do I then order this data by a column contained in the JSON string? Or am I using this database in the wrong way entirely?

Cheers!

Was it helpful?

Solution

I think what you want is WebSQL (which uses SQLite).

  • IndexedDB in Dart

    WebSQL is a SQLite database in the browser, supported by Webkit based browsers. WebSQL is powerful and fairly well understood, but will not be implemented in Firefox or Internet Explorer, and the spec is in limbo.

IndexedDB seems to be only a KeyValue store. You have to create additional indexes in IndexedDb (and probably store the object in each) to sort the same values in different orders.

OTHER TIPS

You just need to index timestamp field to order by timestamp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top