mysql.js

1.0.2 • Public • Published

The most useful mysql library that everyone even a child can learn to use.


npm install mysql.js
------------------------------------
var mysql=require("mysql.js");
let q=new mysql("localhost","root","XXXXXX","zhy");
q.setTable("table");//You are not enforced to input this line,but you should input it into the parameters of functions,and if you input the two sides,the parameter will be consider as this request the true table;

q.getOne({name:"Wyatt"},['id'])
.then((line)=>{console.log(line);console.log(line.id);});

q.add("value1","value2","value3")
.then((affectedlines)=>{console.log(affectedlines);}); //You can delete this line which is just used to callback the result if is success

q.del({name:"Wyatt"})
.then((affectedlines)=>{console.log(affectedlines);});
-----------------------------------------------------------------------

Here's all the functions:

Promise query(sql);

Promise select(filter,which,limits,table);
Promise gets(filter,which,limits,table);//They are same

Promise getOne(filter,which,table);

Promise delete(filter,limits,table);
Promise del(filter,limits,table);//They are same

Promise deleteAll(filter,table);

Promise insert(arr,table);
Promise addIn(table,val1,val2,val3,...);
Promise add(val1,val2,val3,...);

Useful and easy! Want a star!

Package Sidebar

Install

npm i mysql.js

Weekly Downloads

4

Version

1.0.2

License

ISC

Last publish

Collaborators

  • zhyjs