Registry / database / superdb

superdb

JSON →
library1.1.11jsnpmunverified

superdb is a Node.js database library for MySQL and PostgreSQL that provides a chainable query builder to avoid raw SQL splicing. Version 1.1.11 supports MySQL, PostgreSQL, Redis caching, and connection pooling. It offers methods like find, findOne, create, update, delete, and count, along with hooks for before/after operations. Differentiators include dynamic schema (no ORM models needed), fluent chain methods, and built-in cache support via Redis. The library is ESM-compatible and requires Node >= 6.0, but installation via GitHub URL is common for the latest changes.

npm install superdb
INSTALL
IMPORT
SIG · SUPERDB
S
superdb
databasejavascriptv1.1.11
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Superdb
import Superdb from 'superdb'
const Superdb = require('superdb')
ESM import is preferred; the library uses CommonJS but works with both.
Op
import { Op } from 'superdb'
const Op = require('superdb').Op
Op is available as a named export; accessing via default import is not supported.
conn.Op
const conn = await db.createConn(); conn.Op.is(null)
Op.is(null) without connection context
Op is also accessible as a property on a connection instance.

Creates a database connection, runs a SELECT query with a WHERE clause and operator, and logs the result.

import Superdb from 'superdb'; const db = new Superdb('mysql://root:password@localhost/example', { logging: true }); const main = async () => { const conn = await db.createConn(); const result = await conn.find('tb_example', { select: ['id', 'name'], where: { id: 1, name: conn.Op.is(null), }, limit: 5, }); console.log(result); }; main();
Debug
Known issues
gotchaThe createOne method expects an object, not an array. Passing an array will cause unexpected behavior.
fix
Use bulkCreate for inserting multiple records as an array.
affects: >=1.0.0
gotchaThe exists method internally uses count but returns a boolean. Do not rely on the count result.
fix
Use conn.exists() directly and check the boolean return value.
affects: >=1.0.0
gotchaInstallation via GitHub URL may be required for the latest updates not yet published to npm.
fix
Use 'yarn add https://github.com/yujintang/superdb.git' or 'npm install superdb' for stable releases.
affects: >=1.0.0
gotchaWhen using Redis cache, options.redis must be set correctly; otherwise caching silently fails.
fix
Provide a valid Redis config object or URL in the Superdb constructor.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'superdb'
Package not installed or incorrect import path.
fix
Run 'npm install superdb' or install from GitHub URL: 'npm install https://github.com/yujintang/superdb.git'
conn.Op is undefined
The connection is not yet created or Op is used incorrectly.
fix
Ensure you call await db.createConn() before using conn.Op.
Upgrade
Version history
1.1.11latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
12
Amazon
2
Meta
1
OpenAI (training)
1
Resources
superdb — npm install superdb · libregistry