https://kotlinlang.org logo
o

orangy

02/15/2017, 8:14 AM
https://github.com/vicpinm/Kotlin-Realm-Extensions frankly speaking, I don’t really like an API where query operations are properties. Also not sure if it is required to create RealmObject to make a query, could be a reified function… Also not sure how performant is opening and closing instance for each operation. I would consider making it like this:
Copy code
val events = realm { // <— lambda’s receiver is `Realm` instance, returns lambda’s result, closes instance
   query<Event> { it.equalTo("id",1) } // inline reified getting T::class.java and passing it to `where`
}
// cc @antonioleiva, couldn’t find Víctor Manuel Pineda on this Slack