boenrobot / nuxt-mikro-orm-module

A module to use MikroORM inside Nuxt applications
https://boenrobot.github.io/nuxt-mikro-orm-module/
GNU Lesser General Public License v2.1
4 stars 0 forks source link

How use the query builder? #3

Open Nisgrak opened 3 months ago

Nisgrak commented 3 months ago

Hi!

First, thanks for the module, it's very helpful.

I'm trying to use the createQueryBuilder method from the em, but looks like the type of EntityManager have the "core" Connection and not the DB specific one (the first info panel in this https://mikro-orm.io/docs/query-builder).

It's mandatory to override the type with as?

Thanks for your help!

boenrobot commented 3 months ago

Yes. The type in the getEntityManager() should be overriden with the type from your driver.

Hm... I suppose I could introduce an interface that this function would reference... which should mean you can override once in your nuxt config and be done across your project. I'll have to play around to see how that would work out in practice.