読者です 読者をやめる 読者になる 読者になる

DRYな備忘録

Don't Repeat Yourself.

IndexedDB Driver "ingoose" (like Mongoose)

What is IndexedDB

@see IndexedDB - Web API Interfaces | MDN

Why "ingoose"

  • it's very annoying to use indexedDB raw API
  • simplify application code
  • by Mongoose like API

Demo anyway

You can try how it works here DEMO - ingoose : mongoose like indexedDB driver

f:id:otiai10:20150131204908p:plain

Sample usage

ingoose.connect('database_name').schema({
    user: {
        keyPath: "age"
    }
});

var User = ingoose.model('user', {keyPath: 'id'});

var otiai = new User({name: 'otiai10', age: 28, id: 1234});
otiai.save().error(function(err) {
    // error
}).success(function() {
    // succeeded
});

User.find({only: 1234}).success(function(user) {
    console.log(user);
});

User.find({min:0, max:2000}).success(function(users) {
    console.log(users);
});

Development

Sentiments

  • 今日10時間ぶっ通しで集中してたっぽい。凄い
  • カフェには迷惑だったかも...
  • しかも朝からなんも食ってないことに気づいた
  • これは痩せる

DRYな備忘録