Registry / database / qustar

qustar

JSON →
library0.0.52jsnpmunverified

Qustar is a TypeScript SQL query builder that composes queries through an array-like API with map, filter, and orderBy methods. Version 0.0.52 is in early active development with support for PostgreSQL, SQLite, MySQL, and MariaDB via separate connector packages. It generates 100% SQL via codegen-free expression evaluation, avoiding ORM-like magic. Key differentiators: no code generation, no migrations or transactions yet, and native operator overloading is not supported, requiring explicit method calls like .add(), .eq() for expressions.

npm install qustar
INSTALL
IMPORT
SIG · QUSTAR
Q
qustar
databasejavascriptv0.0.52
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.

Q
✓ import { Q } from 'qustar'
✗ const qustar = require('qustar');
Q is a default export-like named export. CommonJS require is not supported; use ES import.
PgConnector
✓ import { PgConnector } from 'qustar-pg'
✗ import { PgConnector } from 'qustar'
Connector classes are in separate packages (qustar-pg, qustar-better-sqlite3, etc.), not in qustar core.
Q.table
✓ const users = Q.table({ name: 'users', schema: { id: Q.i32() } })
✗ const users = Q.table('users')
table() requires an object with name and schema; passing a string is invalid.

Create a table schema, build a query with orderBy, map, and limit, then fetch from PostgreSQL.

import { PgConnector } from 'qustar-pg'; import { Q } from 'qustar'; const users = Q.table({ name: 'users', schema: { id: Q.i32(), firstName: Q.string(), lastName: Q.string(), age: Q.i32().null(), }, }); const query = users .orderByDesc(user => user.createdAt) .map(user => ({ name: user.firstName.concat(' ', user.lastName), age: user.age, })) .limit(3); const connector = new PgConnector(process.env.DATABASE_URL ?? ''); const result = await query.fetch(connector); console.log('users:', result);
Debug
Known issues
gotchaNative JavaScript operators (+, -, ===) cannot be used; use methods like .add(), .sub(), .eq() instead.
fix
Replace e.g. user.age + 1 with user.age.add(1).
affects: >=0.0.1
deprecatedVersion 0.0.52 is pre-release; API may change without notice.
fix
Pin to exact version or expect breaking changes.
affects: <1.0.0
gotchaConnector packages are required; qustar core alone cannot execute queries.
fix
Install a connector like qustar-pg and import from it.
affects: >=0.0.1
gotchatable() must receive an object with 'name' and 'schema'; passing a string or omitting schema throws runtime error.
fix
Always provide full table definition object.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'qustar-pg' or its corresponding type declarations.
Missing installation of connector package.
fix
Run: npm install qustar-pg
Property 'add' does not exist on type 'number'.
Using native operators instead of qustar expression methods.
fix
Replace 'user.age + 1' with 'user.age.add(1)'.
Q.table is not a function
Importing incorrectly (e.g., using CommonJS or wrong symbol).
fix
Use: import { Q } from 'qustar';
Upgrade
Version history
0.0.52latest on npm
Audit
Dependencies
qustar-pgoptionalRequired for PostgreSQL connectivity; similar connectors exist for other databases
qustar-better-sqlite3optionalRecommended connector for SQLite
Agent activity
7 hits · last 30 days
node
6
Meta
1
Resources
packagequstar ↗
qustar — npm install qustar · libregistry