ezito-entity
v1.4.1
Published
npm i easy-sqlite
Downloads
5
Readme
EzitoIR easy-sqlite
Installation
npm i easy-sqlite
Usage
const isFunction = requrie('ezito-utils/public/is/function');
const resolve = requrie('ezito-utils/server/fs/resolve');
const easy = require('easy-sqlite');
const sqlite3 = require('sqlite3').verbose();
const db = easy(new sqlite3.Database('./db.sqlite'));
async function init (){
await db.createTable( "test" , {
id : db.types.AUTO_KEY_NUMBER ,
name : db.types.VALIDATOR( db.types.TEXT , function(val = ""){
return val.length > 4
}),
time : db.types.AUTO_DATE,
});
var table = db.table("test");
await table.add({ name : "namedd -" + Math.floor(100000 + Math.random() * 900000) }) ;
table.add({ name : "namedd -" + Math.floor(100000 + Math.random() * 900000) },(err ,res)=>{
}) ;
table.find([],{}, async (er,res)=>{
await table.change({name : "muhammad rasoul"}, { id : 1 });
table.find([],{name:"muhammad rasoul"}, (er,res)=>{
console.log(res)
});
});
}
init()