SQLQueryHelperjs - v1.2.6
    Preparing search index...

    Getting Started

    SQLQueryHelperjs has two main usage modes:

    • define schema in code and evolve it at runtime
    • inspect an existing database and generate classes from it

    The library is organized around four layers:

    1. Schema helpers such as column, entity, primaryKey, foreignKey, and index.
    2. Runtime engines such as SqliteReflector, PostgresReflector, and MySqlReflector.
    3. Fluent query builders for select, insert, update, and delete flows.
    4. Inspector functions that reverse-engineer an existing database into code or structured metadata.

    Current runtime engines:

    • SQLite
    • PostgreSQL
    • MySQL

    Planned documentation tracks:

    • SQL Server
    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:

    • inspectSqliteSchema
    • generateSqliteSchemaOutput
    • inspectPostgresSchema
    • generatePostgresSchemaOutput
    • inspectMySqlSchema
    • generateMySqlSchemaOutput

    That gives you a stable model of the current schema before you move into runtime synchronization.