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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sql-easy-lib

v1.0.8

Published

This library was written from simple work with databases. In current version supported next famous databases: sqlite3 and MySQL. In future, list with supported databases will be replenishing.

Downloads

1

Readme

SQLEasy library

This library was written from simple work with databases. In current version supported next famous databases: sqlite3 and MySQL. In future, list with supported databases will be replenishing.

Prepare to work

Before you use this module you must install it.

npm install sql-easy-lib --save

and you can include it!

const SQLEasy = require('sql-easy-lib');

Tools and main objects

Before work, you must know about twice main tools: get_from_key and Request.

const SQLEasy = require('sql-easy-lib');

var req = new SQLEasy.Request([{id: 1, value: 12}, {name: 'CirillaGif'}]);
/* This is boolean operation: "(id=1 AND value=12) OR (name=`CirillaGif`)" */
var get_from_key = SQLEasy.tools.get_from_key;
/* get_from_key function, about him in down. */

Request use from create logic expression example:

// ...
new SQLEasy.Request([{id: 1, value: 12}, {name: 'CirillaGif'}]);
(id=1 AND value=12) OR (name=`CirillaGif`)

get_from_key use for more efficient queries from buffer variables. example:

// Without use get_from_key
const SQLEasy = require('sql-easy-lib');
var database = new SQLEasy.SQLite3_database('/path/to/database.db');
var rolesData = database.get('users').map(i => {
	return {
		user: i,
		role_data: database.get('role', new SQLEasy.Request([{id: i.role}]))
	}
});
// With use get_from_key
const SQLEasy = require('sql-easy-lib');
var database = new SQLEasy.SQLite3_database('/path/to/database.db');
var roleData = database.get('role', new SQLEasy.Request([{id: i.role}]));
var rolesData = database.get('users').map(i => {
	return {
		user: i,
		role_data: SQLEasy.tools.get_from_key(roleData, new SQLEasy.Request([{id: i.role}]))
	}
});

Methods of databases

In all databases methods is equally (except for the connection).

const SQLEasy = require('sql-easy-lib');
/* Method for connection sqlite3 database */
var sqlite3 = new SQLEasy.SQLite3_database('/path/to/database.db');
/* Method for connection MySQL database */
var mysql = new SQLEasy.MySQL_database({
	host: "mysql.example.org",
	user: "username",
	password: "password"
});
mysql.set_db("Example_db");  // setting database in server

(for example, we use abstract database object): database

const SQLEasy = require('sql-easy-lib');

var database = new SQLEasy.AnyDatabase(args);

get

This is getting items from table:

SELECT

syntax:

database.get(
	'table_name',
	new SQLEasy.Request([{param: 'value'}]),  // Not required: ...WHERE (CONDITION) in request
	'*'  // Not required: Items in table
);
SELECT * FROM table_name WHERE (param=`value`)

set

This is set values in items in table:

UPDATE .. SET

syntax:

database.set(
	'table_name',
	new SQLEasy.Request([{param: 'value_require_edit'}]),  // Required: ...WHERE (CONDITION) in request
	{param: 'value'}  // Required: Items in table
);
UPDATE table_name SET param=`value` WHERE (param=`value_require_edit`)

remove

This method for remove items into database.

DELETE

syntax:

database.remove(
	'table_name',
	new SQLEasy.Request([{param: 'value'}])  // Required: ...WHERE (CONDITION) in request
);
DELETE FROM table_name WHERE (param=`value_require_edit`)

add

Method for add items into database.

INSERT

syntax:

database.add(
	'table_name',
	[{param: 'value'}]  // Required: ... Rows what you add in table.
);
INSERT INTO table_name (param) VALUES (`value`)