feat: #348 Add/remove operations for InnerTableLink references#2757
Open
obabichevjb wants to merge 2 commits into
Open
feat: #348 Add/remove operations for InnerTableLink references#2757obabichevjb wants to merge 2 commits into
obabichevjb wants to merge 2 commits into
Conversation
…ink references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add MutableSizedIterable interface with add, remove, addAll, removeAll, clear methods - Implement MutableReferenceCollection for many-to-many relationships - Track pending additions and removals in memory with delayed flushing - Preserve ordering when pending changes exist - Update InnerTableLink to return MutableSizedIterable while maintaining backward compatibility - Add comprehensive tests for incremental add/remove operations This addresses task #1 of issue #348: Support add/remove operations on InnerTableLink references. Changes are tracked in memory and flushed during entity flush, providing delayed flushing behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Description
Summary of the change: This PR implements add/remove operations for many-to-many relationships created with
InnerTableLink/via, allowing incremental modifications without reassigning the entire collection.Detailed description:
Why: Issue Improve support for references created with InnerTableLink/via #348 requested support for incremental add/remove operations on
viareferences. Previously, users had to reassign the entire collection viaSizedCollection, which was inconvenient for adding/removing single items.What:
MutableSizedIterable<T>interface extendingSizedIterable<T>with methods:add(),remove(),addAll(),removeAll(),clear()MutableReferenceCollection<SID, Source, ID, Target>class that tracks pending additions and removals in memoryInnerTableLinkto returnMutableSizedIterable<Target>fromgetValue()while maintaining backward compatibilityHow:
MutableReferenceCollectionwraps the underlying database query result and maintains two sets:pendingAdditionsandpendingRemovalsExample usage:
Note: Users must cast to
MutableSizedIterableif the property is declared asSizedIterableto access the mutable methods. Alternatively, they can declare the property type asMutableSizedIterable(thoughSizedIterableis recommended for backward compatibility).Type of Change
Please mark the relevant options with an "X":
Updates/remove existing public API methods:
Affected databases:
Checklist
Related Issues
Closes #348
🤖 Generated with Claude Code