isar / isar/isar

Allow IsarLinks to work directly with IDs instead of objects.

Open
#598 1 comment 6 reactions 0 assignees View on GitHub
area:dart enhancement
Dominant language
Dart
Stars
4k
Forks
602
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
I am trying to parse a large list of linked objects. In order to set up links, I currently have to load the target object from Isar, and then put it into the link to establish the relationship. I would like to be able to just set the id instead of having to load the full object.

It is also a possibility that the target object has not been put into Isar yet. If isar were to validate the existence of the target object, it would be ideal if this validation could be deferred until all objects are supposed to be created (transaction complete?)

**Describe the solution you'd like**
ObjectBox allows you to set `ToOne.targetId`, which works well for this use-case.

**Describe alternatives you've considered**
I looked at `IsarCollection.attach`, but that looks like it's for internal use only. Maybe that could be exposed in the API in usable way?

**Version**
- Platform: Android, Web
- Flutter version: 3.0.5
- Isar version: 3.0.0-dev.8

Contributor guide

Open the contributing guide

Research direction

Start by reading the IsarLinks API and the IsarCollection.attach path mentioned in the issue, then compare the requested behavior with ObjectBox's targetId. Define how IDs are assigned and how missing targets are validated, including the proposed transaction boundary. Done means links can be established from IDs without loading objects and deferred validation has a documented, tested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.