drift icon indicating copy to clipboard operation
drift copied to clipboard

do you have plans something similar to '@Relation in Android Room'?

Open wph144 opened this issue 6 years ago • 3 comments

guide is in this link https://developer.android.com/reference/android/arch/persistence/room/Relation

It is great feature on Android Room. I guess it's somewhat complex but really convenient because it reduce many join syntax when tables have many 1:1 or 1:N relationship.

wph144 avatar Apr 25 '20 17:04 wph144

Any comments on this? It is an essential feature in my opinion. I would really appreciate it.

No comments for way over a year makes me sad.

mt-akar avatar Aug 07 '21 00:08 mt-akar

So far I don't have plans for this. It would require turning a single select stream into multiple select streams that update atomically. The generator has some initial support to transform select statements at build time (which could be used to implicitly add joins for 1:N relations), but I'm not sure if this is something that moor should do.

simolus3 avatar Aug 08 '21 20:08 simolus3

@simolus3 thank you for responding.

but I'm not sure if this is something that moor should do.

I strongly disagree. Every single ORM I have ever used (EF Core, Room, etc.) had this feature. In my opinion, this is why ORMs even exist: to eliminate boilerplate code. If writing this just to get data from a single relation makes sense to you, just wait until I need to write this query.

mt-akar avatar Aug 08 '21 22:08 mt-akar