Re: IndexedDB, what were the issues? How do we stop it from happening again?

On 12/02/2013, at 5:02 AM, Kyaw Tun <kyawtun@yathit.com> wrote:

> The criticisms on IndexedDB API by pointing out IndexedDB suck links is unfair. If they have enough time to play around it, they will love it. There are a lot of beauty in IndexedDB API like composite index, element-wise indexing, auto commit transaction, powerful serialisation and full reflection.

Sorry, I didn't make myself very clear. The features of IndexedDB are not in question - they are all awesome, no doubt! It is the *interface* that humans use to interact with those features that appears to suck. 

> Arms with these it is very possible to write butter smooth database library.
> 
> I would like to point out my own open source library as an example: https://bitbucket.org/ytkyaw/ydn-db    

Everything below looks awesome! Why did you feel it was necessary to write a layer on top of IndexedDB? 

> .
> The library features:
> 
> Support all features of asynchronous IndexedDB API.
> Well tested closure library module.
> Fixed schema, auto versioning, on-the-fly schema generation while maintaining multiple connections (on tabs, or worker).
> Low-level cursor iteration, high level query and key joining algorithms.
> Each method call is an atomic transaction, while supporting transaction and advance transaction workflow.
> 
> CRUD operations :
> var db = new ydn.db.Storage('test-store');
> db.put('store1', {test: 'Hello World!'}, 123);
> var req = db.get('store1', 123).done(function(record) {
> 
>   console.log(record);
> 
> });
> 
> 
> 
> Basic query 
> 
> var lower = + new Date(1942, 1, 1); // 1942 February 1
> 
> var upper = + new Date(1942, 2, 1); // 1942 March 1
> 
> var iter = ydn.db.IndexValueCursors.where('author', 'born', '>=', lower, '<', upper);
> 
> db.values(iter).done(function(records) {
> 
>   console.log(records);
> 
>   records.map(function(x) {
> 
>     console.log(x.first + ' ' + x.last + ' ' + new Date(x.born));
> 
>   });
> 
> });
> 
> Advanced query for: SELECT * FROM article WHERE license = 'SA' AND publisher = 'Nature' ORDER BY 'title' 
> 
> 
> var license_sa_iter = ydn.db.Cursors.where('article', 'license, title', '^', ['SA']);
> 
> var publisher_nature_iter = ydn.db.Cursors.where('article', 'publisher, title', '^', ['Nature']);
> 
> var match_keys = [];
> 
> var solver = new ydn.db.algo.ZigzagMerge(match_keys);
> 
> var req = db.scan([license_sa_iter, publisher_nature_iter], solver);
> 
> req.then(function() {
> 
>   db.list('article', match_keys).done(function(results) {
> 
>     console.log(results);
> 
>   });
> }, function(e) {
> 
>   throw e;
> 
> });

Received on Tuesday, 12 February 2013 17:01:17 UTC