feat(postgrest): add missing operators match, imatch, and isDistinct#857
Merged
feat(postgrest): add missing operators match, imatch, and isDistinct#857
Conversation
Implements missing PostgREST v12 operators to bring the Swift SDK up to date with the official PostgREST API specification. New operators: - match(): Regex pattern matching (case-sensitive) using ~ operator - imatch(): Regex pattern matching (case-insensitive) using ~* operator - isDistinct(): IS DISTINCT FROM operator for NULL-aware comparison Also fixes semantic helper methods plainToFullTextSearch(), phraseToFullTextSearch(), and webFullTextSearch() to call textSearch() directly with the appropriate type parameter. Includes comprehensive tests for all new operators. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds three missing PostgREST v12 operators (match, imatch, and isDistinct) to bring the Swift SDK up to date with the PostgREST API specification. It also fixes a bug in the semantic helper methods for text search.
Key Changes:
- Adds regex pattern matching operators:
match()(case-sensitive) andimatch()(case-insensitive) - Adds
isDistinct()operator for NULL-aware comparison - Fixes semantic text search helpers to call
textSearch()directly instead of deprecated methods
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Sources/PostgREST/PostgrestFilterBuilder.swift | Adds three new operators to the enum, implements match(), imatch(), and isDistinct() methods following existing patterns, and fixes semantic helper methods to call textSearch() directly |
| Tests/PostgRESTTests/PostgrestFilterBuilderTests.swift | Adds comprehensive tests for the three new operators with snapshot testing to verify correct URL encoding and query construction |
b11671a to
5797b01
Compare
mandarini
approved these changes
Nov 21, 2025
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.
Summary
Implements missing PostgREST v12 operators to bring the Swift SDK up to date with the official PostgREST API specification.
Changes
New Operators Added:
match()- Regex pattern matching (case-sensitive) using~operatorimatch()- Regex pattern matching (case-insensitive) using~*operatorisDistinct()- IS DISTINCT FROM operator for NULL-aware comparisonBug Fixes:
plainToFullTextSearch(),phraseToFullTextSearch(), andwebFullTextSearch()to calltextSearch()directly with the appropriate type parameterTests:
testRegexMatchFilter()for regex match operatortestRegexImatchFilter()for case-insensitive regex match operatortestIsDistinctFilter()for IS DISTINCT FROM operatorImplementation Details
All operators were reviewed against the PostgREST v12 operators documentation to ensure completeness.
The implementation follows existing patterns in the codebase:
PostgrestFilterValueprotocol for type safetyselffor method chainingTest Results
All 27 PostgrestFilterBuilder tests pass successfully:
🤖 Generated with Claude Code