Вопрос

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!

Это было полезно?

Решение

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.

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top