cmelchior / realmfieldnameshelper

Realm extension library used to create more type-safe queries.
Apache License 2.0
173 stars 21 forks source link

Add support for nested members #4

Closed ahmadalibaloch closed 8 years ago

ahmadalibaloch commented 8 years ago

I can't access fields of the member complex entities. like if I have a Project entity which has a bookingSlotmember of type BookingSlot which has Name property of String type, then I would like to have something like this ProjectFields.BOOKING_SLOT.NAME

Realm supports nested member queries for filter like query.equalTo("BookingSlot.Name", "example")

cmelchior commented 8 years ago

Not right now, no. It was partly an oversight on my part, but it also raises some interesting questions, like how far you would want those names to go (e.g. what if you had a chain of 5 references), and what about cyclic references?

I would imagine that just going 1-level deep would be enough for most use-cases though?

Another alternative would be to provide some form of configuration option for it, but I would prefer to keep this lib as no-config as possible.

cmelchior commented 8 years ago

@ahmadalibaloch I created a 1.1.0-SNAPSHOT release with support for this. Please try it and see how it feels as the syntax is still not 100% set in stone. https://github.com/cmelchior/realmfieldnameshelper/pull/5

Zhuinden commented 8 years ago

I dunno, in my setup I used to have enum that stored the field, and I always did it like

ProjectFields.BOOKING_SLOT + "." + BookingSlot.NAME