A wrapper for IndexedDb that provides C# Entity Framework Style operations.
// Define a Schema
var personSchema = {
//Schema omited for brevity, refer to Creating a Schema.
}
// Define a database.
EntityJs.CreateDb("database1", 1, function (db) {
// Use the db.
}, function (error) {
// error occurred.
}, function (oldDb) {
// Update the old database.
});
var tableSchema = {
Key: { // Holds information regarding the table key.
keyPath: "id",
autoIncrement: true|false,
unique: true|false
},
Column1: { // Exlude the key column here.
unique: true|false,
}
}
db.Persons.getById(1, function (person) {
console.log(p.FirstName); // Selects the person with id 1.
});
db.Persons.where(x => x.Age > 100, function (oldPeople) {
console.log(oldPeople); // Get all people whose age > 100.
});
db.Persons.select(x => x.Age, function (ages) {
console.log(ages) // Gets the age of all people.
});
//TODO: Document update functions.
//TODO: Document Delete functions.