Skip to content

Commit

Permalink
feat: add InjectMikroORMs inject decorator for easy access to multi…
Browse files Browse the repository at this point in the history
…ple databases
  • Loading branch information
tsangste committed Nov 9, 2024
1 parent dd3f9e3 commit 345961b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mikro-orm.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export const getMikroORMToken = (name: string) => `${name}_MikroORM`;
*/
export const InjectMikroORM = (name: string) => Inject(getMikroORMToken(name));

/**
* Gets the injection token for the relevant MikroORMs provider.
* @returns The MikroORMs provider injection token for the supplied context name.
*/
export const InjectMikroORMs = () => Inject('MikroORMs');

/**
* Gets the injection token based on context name for the relevant EntityManager provider.
* @param name The context name of the database connection.
Expand Down

0 comments on commit 345961b

Please sign in to comment.