OXY-165: Add LIKE / ILIKE predicate support to the oxygen-sql query DSL - #305
Open
Kalin-Rudnicki wants to merge 1 commit into
Open
OXY-165: Add LIKE / ILIKE predicate support to the oxygen-sql query DSL#305Kalin-Rudnicki wants to merge 1 commit into
Kalin-Rudnicki wants to merge 1 commit into
Conversation
Add `like` / `ilike` / `notLike` / `notILike` string-pattern predicates, usable in `where if ...` on String columns. The pattern binds as a single scalar String param, so the generated SQL stays static (`col LIKE ?`). These slot in as new `BinOp.Comp` cases; the rest of the pipeline (RawQueryExpr / QueryExpr / FragmentBuilder) is generic over `Comp`, so no other production code changes were needed. - BinOp: LIKE / ILIKE / NOT LIKE / NOT ILIKE cases - Q.scala: string extension methods - it-test: @compile queries + real-Postgres CustomQuerySpec test (wildcards, case-sensitivity, negation, composition) - docs/sql/queries.md ILIKE / NOT ILIKE are Postgres-specific (fine while PG-only). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OXY-165 — Add LIKE / ILIKE predicate support to the oxygen-sql query DSL
Adds
LIKE/ILIKE(case-insensitive) string-pattern predicates — plus their negations — to the@compilequery DSL, usable inwhere if ...onStringcolumns. The pattern binds as a single scalarStringparam, so the generated SQL stays static (col LIKE ?/col ILIKE ?).How it fits
Per the OXY-163 roadmap, the DSL's binary-operator extension points are generic. These slot in purely as new
BinOp.Compcases — the rest of the pipeline (RawQueryExpr,QueryExpr,FragmentBuilder) is generic overComp, so no other production code changed. Thequery-var op input-varpath already emitscol <op> ?and binds the input using the LHS column'sRowRepr.DSL surface
On
Stringcolumns:col.like(pattern)→col LIKE ?col.ilike(pattern)→col ILIKE ?(Postgres-specific)col.notLike(pattern)→col NOT LIKE ?col.notILike(pattern)→col NOT ILIKE ?(Postgres-specific)Changes
BinOp.scala: 4 newCompcases.Q.scala:extension (self: String)methods.it-test/queries.scala: 5@compilequeries.it-test/CustomQuerySpec.scala:like / ilikeintegration test.docs/docs/sql/queries.md: vocabulary row + dedicated section.Testing
oxygen-sql/compile+sql-it/Test/compilesucceed (the macro-expanded@compilequeries compile, exercising the DSL + parser).sql-it/testOnly oxygen.sql.CustomQuerySpecagainst real Postgres (testcontainers): 13/13 pass, including the new test covering%/_wildcards, LIKE vs ILIKE case-sensitivity,NOT LIKE/NOT ILIKE, and&&composition.sbt fmtapplied.Notes
ILIKE/NOT ILIKEare Postgres-specific — acceptable while oxygen-sql is PG-only; flagged for the future Dialect seam.🤖 Generated with Claude Code
https://claude.ai/code/session_011YxWKdsz97QT9BD7AdpSq6