feat(comparison): Add contains / containedBy methods to Comparison expression#25
Conversation
There was a problem hiding this comment.
Pull request overview
Adds JSONB containment support to the expression layer by introducing a JsonbComparison::contains() helper that renders the PostgreSQL @> operator, with an accompanying integration test to validate expected query results.
Changes:
- Add
JsonbComparison::contains(Expression $jsonField, Expression $contained)producingjsonField @> contained. - Add integration coverage validating JSONB containment against a
VALUES-backed dataset.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Expression/JsonbComparison.php |
Introduces contains() for JSONB containment using the @> operator. |
tests/Integration/Expression/JsonbComparisonTest.php |
Adds an integration test asserting correct behavior of contains(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f17c536 to
9457fe0
Compare
|
Thanks for the PR! The The I think // jsonb
Comparison::contains(new Column('roles'), new SqlExpression("'[\"ROLE_USER\"]'::jsonb"));
// arrays
Comparison::contains(new Column('tags'), new SqlExpression("ARRAY['php']"));Could you move |
…ontainment checks
9457fe0 to
7f26204
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The changes have been made, please let me know if anything else must change 😄 |
Summary
containsmethod toComparisonthat generates an expression using the@>operator for containment checks.containedBymethod toComparisonthat generates an expression using the<@operator for containment checks.