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

@dependahub/query-builder

v1.0.1

Published

Simplified query builder

Readme

XO code style

Query Builder

This is not an ORM. It's a simple query builder that generates and returns SQL.
This package contains builders to assist with writing complex INSERT / UPDATE statements, designed for scenarios where ORMs cannot be used, such as with AWS RDS Data API.

SELECT statements are not included.

Install

npm i @dependahub/query-builder

Examples

Single Insert

import {insert} from '@dependahub/query-builder';

const insertSql = insert('users', {name: 'John Doe', age: 30, isActive: true});
console.log(insertSql);
// OUTPUT: INSERT INTO users (`name`, `age`, `isActive`) VALUES ('John Doe', 30, 1)

Batch Insert

import {batchInsert} from '@dependahub/query-builder';

const users = [
  {name: 'Alice', age: 25, email: '[email protected]'},
  {name: 'Bob', age: 30, email: '[email protected]'},
  {name: 'Charlie', age: 35, isActive: false}
];

const batchInsertSql = batchInsert('users', users);
console.log(batchInsertSql);
// OUTPUT: INSERT INTO users (`name`, `age`, `email`, `isActive`) VALUES ('Alice', 25, '[email protected]', NULL), ('Bob', 30, '[email protected]', NULL), ('Charlie', 35, NULL, 0);

Update

import {update} from '@dependahub/query-builder';

const updateSql = update('users', {name: 'Jane Doe', age: 28, isActive: true});
const fullUpdateQuery = `${updateSql} WHERE id = 1;`;
console.log(fullUpdateQuery);
// OUTPUT: UPDATE users SET `name` = 'Jane Doe', `age` = 28, `isActive` = 1 WHERE id = 1;

Drop Table

import {dropTableIfExists} from '@dependahub/query-builder';

const dropSql = dropTableIfExists('users');
console.log(dropSql);
// OUTPUT: DROP TABLE IF EXISTS users

Import All Functions

import * as queryBuilder from '@dependahub/query-builder';

// Use any of the functions
const insertSql = queryBuilder.insert('products', {name: 'Laptop', price: 999.99});
const dropSql = queryBuilder.dropTableIfExists('temp_table');

Data Type Handling

The query builder automatically handles different data types:

import {insert} from '@dependahub/query-builder';

const complexData = {
  id: 1,                    // number -> 1
  name: 'John O\'Connor',   // string with quotes -> 'John O''Connor'
  isActive: true,           // boolean -> 1
  metadata: {key: 'value'}, // object -> '{"key":"value"}'
  deletedAt: null,          // null -> NULL
  tags: ['tag1', 'tag2']    // array -> '["tag1","tag2"]'
};

const sql = insert('users', complexData);
console.log(sql);
// OUTPUT: INSERT INTO users (`id`, `name`, `isActive`, `metadata`, `deletedAt`, `tags`) VALUES (1, 'John O''Connor', 1, '{"key":"value"}', NULL, '["tag1","tag2"]')