Conversation
|
|
||
| ``` | ||
| protected abstract class PrimitiveRealmQuery<Object> | ||
| public class PrimitiveIntegerRealmQuery extends PrimitiveRealmQuery<Integer> |
There was a problem hiding this comment.
Shouldn't we have public class PrimitiveLongRealmQuery extends PrimitiveRealmQuery<Long>?
|
I prefer option 1. From a user's perspective is it easier: We are pushing the fluent interface of the query engine. |
|
I think laxing the But if I have to write Realm queries by hand in Strings, I may as well go back to SQLite EDIT from the future: although I wouldn't mind an optional raw query api. |
|
Depending on how Type Adapters are implemented that might not be necessary, but it would probably make a lot of things easier. Good point. Regarding the query system. We won't remove the typed API, but it is starting to squeak a bit under the weight of operators. So a string based API would live next to the typed one. At least that is the current idea. |
|
For .NET, option 1 will probably work better - we use the standard From an end-user POV, I too like 1 more, due to @kneth's argument. |
|
I'm in favour of relaxing the type requirement on Example: we can detect at compile time this |
|
Good point. We should be able to catch all wrong types used in the annotation processor. Didn't think of that 👍 If we relax the type parameters, I'm also secretly playing around with the idea of splitting out DynamicRealmObject from RealmObject since having to deal with both of them everywhere is a big hassle and put some rather annoying restrictions on what we can do in both classes. |
|
Ah, then ability to get Realm / DynamicRealm from their corresponding classes will be a possibility :3 |
|
OK, I will start adding APIs with |
|
In regards to |
I can accept it. Feels kind of nature to me. |
|
I think the 4a) option was not thought through. Querying would have to work like you would do with a |
|
Ah crap, now I remember: So I guess you are advocating for 4B with One thing missing from the design doc description is that the extra methods are only needed when querying the list directly. Something which I assume is done less frequently than the model in general. This at least means that adding a lot of extra methods have a bigger drawback |
|
|
||
| **Disadvantages** | ||
| * API gets a lot less type safe (IntelliJ plugin might help here). | ||
| * `RealmQuery` will suddenly have a ton of new methods that will only work for primitive arrays (lint check?) |
There was a problem hiding this comment.
Right. I can see that I am in a minority, here, but this is what types are for. I think this argument, all by itself, should be a stopper.
There was a problem hiding this comment.
Note, that even with types, the current system <? extends RealmModel> isn't perfect as a Schema can restrict valid types even further.
| optional methods for primitive lists in the interface if we go to great lengths in the actual class to make it type | ||
| safe. | ||
| * Type safety is not guaranteed anyway if we allow `<Object>`` as generic. | ||
|
|
There was a problem hiding this comment.
Note that, to the contrary, type safety is still guaranteed for all of RealmList. It just isn't guaranteed here.
|
I strongly prefer Design 1 as well. There are a few caveats like |
| people to use the "wrong" method. Today people still have to remember not to call e.g. `sum` on a String field though. | ||
|
|
||
|
|
||
| 4b) Add support for a special keyword for column names. NSPredicate apparently uses `SELF`, `$` could also work. |
There was a problem hiding this comment.
$ isn't that good because you need to put it in backticks in kotlin.
EDIT: wait, this is in a String. What was I even thinking?
|
|
||
| We need more feedback on the two proposals. | ||
|
|
||
| * Unclear how we are going to support lists-of-lists, e.g. what kind of queries do you want to run on a `int[][]` |
There was a problem hiding this comment.
oh, so that's what "nested subtables" means.
With work in Core slowly picking up speed regarding Primitive List support, we need to start thinking about how the public API is going to look like. Also, so it can guide the underlying implementation.
This document tries to flesh out the various proposals that have been discusse so we can get feedback on the direction as well as guide Cores design decisions.
Thoughts @realm/java ?
References #575