Repository navigation
Conversation
This branch has not been deployed
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.
Reworks the Get/GetAll/GetOptional APIs to be more flexible and performant, at the cost of needing more manual implementation at times.
API Changes
Getter methods now accept a generic parameter T and a
SqlMapper<T> mapperdelegate, which is now used to construct the method's result types. This allows us to remove Dapper completely and its reflection-heavy approach, which future-proofs the PowerSync SDK for iOS/iPadOS, lets us define our own completely separate API, and should (pending benchmarks) make the query API faster.Overloads also exist for the new
IFromRow<T>interface, which lets users skip passing the mapper to the query function every time.This also renames and exposes the previously unused QueryResult class/interface to allow for dynamic/mapper-less row access.
This PR also adds a
PowerSync.Common.SourceGeneratorspackage, which currently defines theGenerateSqlMapperattribute class. This provides a default, Dapper-styleIFromRow<T>implementation for simple classes, which should help users that liked the flexibility and ease-of-use provided by Dapper.Examples
Using Dapper (old):
Using
mapper:Using
IFromRow<T>:Using source generators:
AI usage
I manually defined and rewrote the new API in
IDBAdapter.cs. Claude Opus 5.5 implemented the required code changes and source generator package, plus added some tests. I will review and verify all changes before marking this as ready for review.