question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature request] Allow to pass side-data param to typeorm

See original GitHub issue

Motivation: #68

TypeORM has an ability to pass data as an additional free-shape param to repository operations, that is available on the query runner instance.

// user sends request during entity save
postRepository.save(post, { data: { request: request } });

// in logger you can access it this way:
logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner) {
    const requestUrl = queryRunner && queryRunner.data["request"] ? "(" + queryRunner.data["request"].url + ") " : "";
    console.log(requestUrl + "executing query: " + sql);
}

The example is from the end of: https://github.com/typeorm/typeorm/blob/master/docs/logging.md#using-custom-logger

If the passed data will be configurable somehow (maybe an async callback that gets request context of something more high-level/) it will be possible to implement #68 with

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

4reactions
kevinmelocommented, May 10, 2021

Nothing yet? need to get current user from request on Subscriber…

0reactions
power-f-GODcommented, Sep 2, 2022

How did you do that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass data to typeorm transaction - typescript
You are using Transaction type as an argument to your registerTransactionInfo function, checkout some docs about how to use it, ...
Read more >
Mutations | NestJS - A progressive Node.js framework
To create an equivalent mutation in Nest, we'll make use of the @Mutation() decorator. Code first#. Let's add another method to the AuthorResolver...
Read more >
Theme development
Admin panel Theme Editor allows users to modify layout of blocks, change text or images, styles, etc. This feature works only with standard...
Read more >
michael
As soon as the features brag about spying on which URLs your employees are viewing ... a background process and used a global...
Read more >
Shortcomings in Backbone, React without Redux
As we built more new features, we noticed some shortcomings in ... to manage our client-side data, but replace Backbone's UI rendering.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found