@azhou/mysql-wrapper

MySQL simplified wrapper

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@azhou/mysql-wrapper
Minified + gzip package size for @azhou/mysql-wrapper in KB

Readme

Usage

  1. Initialize database

    var db = require("@azhou/mysql-wrapper");
    db.init("server", "database", "username", "password");
    
  2. Run queries

    Promise is returned as query gets executed

    • General query
      db.query(sql).then(function (result) {
          // process results
      }.catch(function (error) {
          // process error
      });
      
    • Return single row
      db.queryFirstRow("SELECT * FROM record WHERE id=?", id).then(...);
      
    • Return single value:
      db.queryFirstField("SELECT COUNT(*) FROM record").then(...);
      

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.