JSPM

mysql.js

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q38919F
  • License ISC

Super easy mysql.js library,not one will say'it's hard to develop a db program' any more!

Package Exports

  • mysql.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mysql.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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!