Skip to content

Conversation

@grdsdev
Copy link
Contributor

@grdsdev grdsdev commented Nov 20, 2025

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 ~ operator
  • imatch() - Regex pattern matching (case-insensitive) using ~* operator
  • isDistinct() - IS DISTINCT FROM operator for NULL-aware comparison

Bug Fixes:

  • Fixed semantic helper methods plainToFullTextSearch(), phraseToFullTextSearch(), and webFullTextSearch() to call textSearch() directly with the appropriate type parameter

Tests:

  • Added testRegexMatchFilter() for regex match operator
  • Added testRegexImatchFilter() for case-insensitive regex match operator
  • Added testIsDistinctFilter() for IS DISTINCT FROM operator

Implementation Details

All operators were reviewed against the PostgREST v12 operators documentation to ensure completeness.

The implementation follows existing patterns in the codebase:

  • Uses PostgrestFilterValue protocol for type safety
  • Properly URL-encodes values
  • Returns self for method chaining
  • Includes comprehensive DocC documentation

Test Results

All 27 PostgrestFilterBuilder tests pass successfully:

Test Suite 'PostgrestFilterBuilderTests' passed
Executed 27 tests, with 0 failures (0 unexpected)

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
Copilot finished reviewing on behalf of grdsdev November 20, 2025 14:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and imatch() (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

@grdsdev grdsdev force-pushed the guilherme/sdk-525-duplicate-sdk-522-for-swift branch from b11671a to 5797b01 Compare November 20, 2025 14:33
@grdsdev grdsdev enabled auto-merge (squash) November 20, 2025 19:18
@grdsdev grdsdev merged commit af786cb into main Nov 21, 2025
22 checks passed
@grdsdev grdsdev deleted the guilherme/sdk-525-duplicate-sdk-522-for-swift branch November 21, 2025 08:04
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.

3 participants