-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RDART-771 EJSON support #1295
RDART-771 EJSON support #1295
Conversation
I think it is in a state where I'm starting to feel I have a good sense of direction. I can de-/serialize fairly complex stuff including generics (Fx Tons of stuff is missing (BSON has some very special types), but all the ordinary stuff is there, and branch coverage is around 70%, so I feel confident the bases are covered. What remains (in my head) is the actual I don't think we need to support all BSON types from the get go, as long as we support realm types it should be okay, and I don't think we need to support serializing to the binary format (hence I call the package ejson, not bson). Anyway, I guess it is a good time to spend a bit time with it to see if you feel confident in the direction I have taken. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we are on the right way.
Perhaps, we will have to add a property annotation that will allow different property names in the schema on the server. Something like MapTo
.
The idea I'm working on is that this will be handled without annotations like: class PrivateMembers {
final int _id;
int get id => _id; // must match constructor parameter name
@ejson
PrivateMembers(int id) : _id = id; // instead of @MapTo
} Anything more fancy will require the user to register a codec pair (encoder + decoder function) with a class annotation. |
Pull Request Test Coverage Report for Build 8174716768Details
💛 - Coveralls |
04f579e
to
09b44b0
Compare
…therwise infer format from size of value
Support de-/serialization to EJSON
The interface is basically:
with some convenience extensions, so you can do
1.toEJson()
, and{'\$numberLong': 1}.to<int>()
, etc.It support generics types:
and custom types:
Fixes: #1254