SQLQueryHelperjs has two main usage modes:
The library is organized around four layers:
column, entity, primaryKey, foreignKey, and index.SqliteReflector, PostgresReflector, and MySqlReflector.Current runtime engines:
Planned documentation tracks:
import { SqliteReflector, column, entity, primaryKey } from "sqlqueryhelperjs";
class User {
static entity = entity({
table: "users",
columns: {
id: column.integer(),
email: column.text({ nullable: false }),
},
primaryKey: primaryKey("id", { autoIncrement: true }),
});
}
const db = new SqliteReflector({ filename: "app.db" });
db.reflect(User);
const rows = db.select(["id", "email"]).from("users").all();
import { PostgresReflector, column, entity, primaryKey } from "sqlqueryhelperjs";
class User {
static entity = entity({
table: "public.users",
columns: {
id: column.integer(),
email: column.text({ nullable: false }),
},
primaryKey: primaryKey("id"),
});
}
const db = new PostgresReflector({
connectionString: "postgres://user:pass@localhost:5432/app",
});
await db.reflect(User);
const rows = await db
.select(["id", "email"])
.from("public.users")
.all();
The documentation now separates MySQL and SQL Server into their own guides so each engine can grow independently.
MySQL is already part of the exported runtime surface and documents the implemented reflector, inspector, query builder, and advanced runtime features.
SQL Server remains a documentation boundary for planned support and is not exported yet.
If the database already exists, start with the inspectors:
inspectSqliteSchemagenerateSqliteSchemaOutputinspectPostgresSchemageneratePostgresSchemaOutputinspectMySqlSchemagenerateMySqlSchemaOutputThat gives you a stable model of the current schema before you move into runtime synchronization.
planReflect(...) output in CI or release workflows.planReflect(...) and reflect(...) decisions.