npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

rsl_database

v0.1.2

Published

This Module manages connections to a MySQL database and provides utility functions for queuing querys

Downloads

8

Readme

rsl_database

This Node JS Module handles connections to a MySQL database and provides some utility functions for queuing requests

Installation

npm install rsl_database --save

Usage

var database = require('rsl_database');

database.setConnection({ host:"localhost", //database host, default "localhost" user:"username", //database username, default "root" password:"password", //database password, default "" database:"database name", //database name, default "test" supportBigNumbers:true, //does the database support Big Numbers, default true max_attempts:3 //max number of connection attempts before Error propogation, default 3 });

database.connect(function(err){ if(err){ console.log(err.message); } else{ console.log("established connection to database"); } });

//database.query(query[,fillins]) //using fillins automatically checks the variables for possibly dangerous values such as HTML or JavaScript that has not been encoded for safe display

database.query("SELECT 1 + 1 As Sum") //returns [{Sum:2}];

database.query("SELECT * From users WHERE username = ?",["andrew"]) //returns array of user rows with username equal to andrew

database.query("SELECT * From users WHERE username = ? AND age = ?",["andrew","21"]) //returns array of user rows with username equal to andrew and age is 21

var queue = [];

//database.enqueueQuery(query[,fillins]) //this function returns a queueable object to mitigate callbacks

//queue.push(database.enqueueQuery(query[,fillins])); //pass the same values you would to directly query the database

queue.push(database.enqueueQuery("SELECT 1 + 1 As Sum"));

queue.push(database.enqueueQuery("SELECT 2 + 2 As Sum"));

queue.push(database.enqueueQuery("SELECT 4 + 4 As Sum"));

//once the queue is filled with the desired queries, we need to query the whole queue //database.queryQueue(queue,callback(err,results));

database.queryQueue(queue,function(err,results){ /* results = [ [ {Sum:2} ],[ {Sum:4} ],[ {Sum:8} ] ] */ }); //results is an array of arrays, each query in the queue pushed its rows array onto the end of the results array in order //the queryQueue function will callback with an Error if there was an error ANYWEHRE in the queue

Tests

npm test

Release History

  • 0.1.0 Initial release