Skip to content

feat: Add support for D1 JSON functions in WHERE clause #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

G4brym
Copy link
Owner

@G4brym G4brym commented Jun 23, 2025

This commit introduces the ability to use Cloudflare D1's JSON functions (e.g., json_extract, json_array_length, json_type) within the .where() method of the modular query builder.

A new json(expression, ...bindings) helper function has been added to allow users to specify JSON operations. The where method has been updated to process these expressions and integrate them correctly into the generated SQL query along with their parameters.

Relevant interfaces have been updated (WhereClause, WhereInput) to support these changes, and comprehensive unit tests have been added to verify the new functionality across various scenarios.

This commit introduces the ability to use Cloudflare D1's JSON
functions (e.g., json_extract, json_array_length, json_type)
within the `.where()` method of the modular query builder.

A new `json(expression, ...bindings)` helper function has been added
to allow users to specify JSON operations. The `where` method
has been updated to process these expressions and integrate them
correctly into the generated SQL query along with their parameters.

Relevant interfaces have been updated (`WhereClause`, `WhereInput`)
to support these changes, and comprehensive unit tests have been
added to verify the new functionality across various scenarios.
This commit introduces the ability to use Cloudflare D1's JSON
functions (e.g., json_extract, json_array_length, json_type)
within the `.where()` method of the modular query builder.

A new `json(expression, ...bindings)` helper function has been added
to allow users to specify JSON operations. The `where` method
has been updated to process these expressions and integrate them
correctly into the generated SQL query along with their parameters.

Relevant interfaces (`WhereClause`, `WhereInput`, `SelectOne`, etc.)
have been updated to support these changes. Test files have also
been updated to align with new interface requirements and to include
comprehensive unit tests for the new JSON functionality.

All tests pass after these changes.
This commit includes changes automatically applied by the Biome linter
after running `npm run lint` (which executes `biome check --apply-unsafe`).
@G4brym G4brym closed this Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant