-
Notifications
You must be signed in to change notification settings - Fork 22
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
Implement interpreter for mikro-orm #5
Comments
I can take a stab at this. |
Awesome! Let me know if you have any questions! |
Do you have any news on the progress? |
@stalniy, unfortunately, I got busy with work, but I will definitely get to this this week..
…--ujwal
On Jul 12, 2020, 11:45 PM -0700, Sergii Stotskyi ***@***.***>, wrote:
Hi @ujwal-setlur
Do you have any news on the progress?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@ujwal-setlur , do you have free time for this task now? |
Interpreter for Objectionjs was finished and it may be a very good reference implementation for mikro orm |
Hi, I wonder if there is any progress on this? |
Hi @Asoftyn No any progress on this. Your help would be very useful! |
The best way to start is to read this https://github.com/stalniy/ucast/tree/master/packages/core UCAST is a universal conditions translator. It allows to translate conditions from one language to another. More formally, there are 3 things:
What does this allow?
|
Sorry folks, I got extremely busy on my day job. Any help would be appreciated. I hope to get a break at work in a couple of weeks |
This may sound confusing and complicated but in fact, interpreter is a simple set of functions. Take a look at Let me know if you have further questions |
I had a look around and from what I understand is that mikro-orm has support for mysql, postgresql, sqlite and mongo and is using knex. Sorry if I sound stupid I'm not used to these kinda things. |
I thought about similar possibilities, this requires implementation of Adapter pattern that will unify interfaces of different query builders. As a result this adds additional level of abstraction, basically another query builder interface. The issue is that for some edge cases this abstraction won't work well:
Being able to implement operators for particular ORM may allow to simplify and optimize implementation for particular situation. I'd like to start with this approach at least for now, and find out/refactor as we go |
I have been trying and looking around at the code for a few hours but i cant get my head around it. So I sadly wont be of any use since i do not quite understand it. |
Guys, actually yesterday I tried to implement interpreter for pure SQL. and have pretty good results. Tested it with objectionjs and it works really good. today, I plan to try it with mikro orm and sequelize and if it works good I’ll publish it and close this issue as won’t fix |
Im not sure i understand the "as won't fix" part but good luck. |
I guess it means it’s generic enough to cover all the SQL ORMs? |
right, I believe that all ORMs in one or another way allow to combine raw sql with their query builder interface, this allows to implement conversion to SQL and use this SQL to set conditions. |
close in favor of #8 |
@ucast/mikro-orm
(put it inpackages/mikro-orm
)@ucast/js
(the most complex is$elemMatch
)createInterpreter
function from@ucast/core
to createinterpret
functioninterpret
function is a query buildercondition.field
with dots inside it's a hint that this property may be a relation to another table. Using mikro-orm API we should be able to understand and if a field construct query for JSON field and if it's a relation addINNER JOIN
+ where conditionsThe text was updated successfully, but these errors were encountered: