Skip to main content

durcno@1.0.0-alpha.22

Minor Changes​

  • e99f947 - Thanks to @almahdi404 !

    feat(sql): add lazy evaluation and support for prepared arguments in sql template

    Refactored the Sql class to lazily evaluate template string fragments and parameters when .toSQL(), .string, or .toQuery() is called.

    Added support for interpolating prepared query arguments (Arg) into sql tagged template expressions, allowing Arg placeholders to be used inside raw SQL fragments for prepared queries. Attempting to call .toSQL() directly on a Sql template containing an Arg outside of a query context will throw a descriptive error.

    const selectPre = prepare({ age: Arg.number() }, (args) =>
    db
    .prepare()
    .from(Users)
    .select()
    .where(sql`age = ${args.age}`));

Patch Changes​

  • 3bd7a2d - Thanks to @almahdi404 !

    fix(qb): fix SqlFn TPrepare generic type constraint in query builders

    Refine the TPrepare type argument passed to SqlFn in GroupByExpression, OrderExpression, SelectBuilder, and SelectQuery to TPrepare extends true ? boolean : false.

    This resolves TypeScript inference and constraint mismatches when using SQL functions in select, groupBy, and orderBy clauses.