JSFiddle - React, Tailwind, and code Playground

by darknessm0404

HTML

<script src="http://git.yathit.com/ydn-db/downloads/dev-ydn.db-0.0.15.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="js/dev-ydn.db-0.13.14.js"></script>
</head>

<body>
</body>
</html>

JavaScript

/*
DEFAULT:
type: 'TEXT',
type: 'REAL',
type: 'INTEGER',
*/

schema_ver1 = {
version: 1,
Stores: [{
    name: 'customer',
    keyPath: 'email'
}, {
    name: 'product',
    keyPath: 'sku'
}]
}

db2 = new ydn.db.Storage('db2', schema_ver1)
/*

customer1 = {
   email: '[email protected]', 
   first: 'John', 
   last: 'Moe'
}
product1 = {
   sku: 'ABC', 
   description: 'Organic fruit'
}
*/
/*db2.put('customer', customer1) 
db2.put('product', product1)
db2.get('customer', '[email protected]').done(function(value) {
    console.log(value);
});  */

function test()
{
var store_schema = [
{
    name: 'bird',
/*    keyPath: 'idbird',
    autoIncrement: true,
    embedded: 'specie',*/
    indexes:
    [
        {
         name: 'identifier',
         unique: true
        },
        {
         name: 'bandNumber',
         unique: false
        }
    ]
},{
    name: 'species',
/*    keyPath: 'idspecies',
    autoIncrement: true,*/
    indexes:
    [
        {
         name: 'name',
         unique: false
        },
        {
         name: 'latinSpecies',
         unique: false
        }
    ]
}
];

var database_schema = {
    version: 2,
    size: 10 * 1024 * 1024,
    stores: store_schema
}
var db = new ydn.db.Storage('db-birdsevolutionpro', database_schema);

var species1 = {
   name: 'Perruche calopsitte', 
   latinSpecies: 'Nymphicus Hollandicus'
}

var bird1 = {
   identifier: 'Zoé', 
   bandNumber: 'CDE 001'
}

db2.put('customer', customer1) 
db2.put('product', product1)
db2.get('customer', '[email protected]').done(function(value) {
    console.log(value);
});  

}

/*

k = db.key('customer', cid)
customer <- k.get()
customer.membership.type .. // use membership instance
k.clear()   // membership is also clear from the store.

*/