Extract EncodableRecord from MutablePersistableRecord #499
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.
This PR introduces a new record protocol, EncodableRecord, and redefines PersistableRecord on top of it:
An EncodableRecord type defines its database encoding, but remains deprived from the persistence methods granted by PersistableRecord. This makes it possible to use all Association APIs on read-only records.
Before this PR, one had to conform to PersistableRecord in order to use an association
request(for:)
method. #426 has identified this as an annoyance.Despite the change in the record protocol hierarchy, this is a purely additive PR, which should not break any existing code. No test for public APIs had to be changed.