Skip to content

Overhaul fetch APIs#14

Merged
mattt merged 2 commits intomainfrom
mattt/fetch-request
Mar 24, 2026
Merged

Overhaul fetch APIs#14
mattt merged 2 commits intomainfrom
mattt/fetch-request

Conversation

@mattt
Copy link
Copy Markdown
Owner

@mattt mattt commented Mar 24, 2026

Follow up to #11

Copy link
Copy Markdown

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 introduces a typed, predicate-based fetch request API for querying Message and Chat records, as a follow-up to the model changes in #11.

Changes:

  • Adds a generic FetchRequest<Result> API plus typed predicate/sort descriptor enums for messages and chats.
  • Reworks Database fetching to support predicate compilation, sorting, and pagination via fetch(_:), while keeping deprecated legacy convenience wrappers.
  • Expands test coverage for sorting/pagination, predicate composition, match modes, and pagination validation; updates README examples to the new API.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
Sources/iMessage/FetchRequest.swift Adds the new public typed fetch request, predicates, sort descriptors, and defaults for Message/Chat.
Sources/iMessage/Database.swift Implements fetch(_:) for typed requests, predicate compilation to SQL, ORDER BY generation, and pagination validation; keeps deprecated wrappers.
Tests/iMessageTests/DatabaseTests.swift Adds tests covering pagination/sort, predicate composition, match modes, empty-compound semantics, legacy wrapper parity, and invalid pagination.
README.md Updates dependency version and replaces legacy fetch example with the predicate-style FetchRequest usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mattt mattt merged commit 9e169c8 into main Mar 24, 2026
3 checks passed
@mattt mattt deleted the mattt/fetch-request branch March 24, 2026 09:23
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.

2 participants