Closed omid closed 3 years ago
Hi,
It is very interesting that you bring this up as I was actually looking into migrating this project from mongodb to pgsql (I regret picking mongodb when I began implementing this) the other day :)
Fortunately I have written the business logic so that it should be independent of which database it uses. This is done by having a set of traits (e.g. IUserRepo
in this file), so that it would be possible to change the database by just reimplementing that trait for the new database. So I think the general structure should be in place to start implementing this.
Also we will need to figure out which sql orm to use. From the research I have done so far (not a lot) I would go for something like sqlx
over diesel
, but I am very interested to hear if you have any experience / opinion on this?
Hi,
I also think MongoDB is not a good choice, especially for such a project with so many links between entities.
Do you want to keep the MongoDB support? If yes, then for the first iteration we need to put it behind a Cargo.toml feature
I think.
Yep, the traits will help us a lot and make it so simpler :)
sqlx
is not really an ORM, it'll replace values inside a query and it can check them in compile time (if there is a DB up and running), so you manually need to write all queries, but it can help you to convert the results to objects (in respect to the O in ORM naming). It's fast and async.
diesel
on the other hand is an ORM, not-yet-async, seems slower (in comparison to sqlx) and like all other ORMs, sometimes complex to write queries in.
Nah, I think we will just remove the mongodb support and just maintain the inmemory and postgres implementations.
Thanks for the clarification between sqlx
and diesel
. I think sqlx
is the way to go.
Do you plan to dedicate any time to help with the implementation of this? In that case I can write up some more specific issues for you to work on if you are interested.
Cool, that was my wish too. To remove MongoDB and also use sqlx
. I think for such projects, sqlx
is a smart choice.
Sure, if you can extract some tasks out of this, it would be awesome and I can also help in this.
Thanks.
Thats great, thanks! I will let you know if there are any issues in particular that I need help with.
This task is a priority task for me so hopefully I will get started on this very soon.
PostgreSQL is now supported! 🎉 Both inmemory and mongodb is removed because it is not worth the effort to keep them updated.
What? It was so fast 👏🏼 Nice work @fmeringdal
Hey :)
How hard is it to integrate other databases, like pgsql? I can also help with this, but first would like to know if the general structure is ready? And also would like to know your opinion?