目前正在进行我的第一个 NestJS 项目。我正在使用 Prisma 2,并且想在调试模式下将查询记录到控制台,以学习和检查并避免 n+1 等!
\n我已经创建了prisma.service.ts:
import { Injectable, OnModuleInit, OnModuleDestroy } from \'@nestjs/common\'\nimport { PrismaClient } from \'@prisma/client\'\n\n@Injectable()\nexport class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {\n constructor() {\n super();\n }\n\n async onModuleInit() {\n await this.$connect()\n }\n\n async onModuleDestroy() {\n await this.$disconnect()\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n工作正常,我可以通过 API 使用它并访问数据库。但是,根据 Prisma 2 Docs on Logging,我需要通过
\nimport { PrismaClient } from \'@prisma/client\'\n\nconst prisma = new PrismaClient({\n log: [\n { level: \'warn\', emit: \'event\' },\n { level: …Run Code Online (Sandbox Code Playgroud) 我将如何继续让 Semgrep 检查我的代码库是否从错误的位置导入函数?例如在我的 django 项目中:
from gettext import gettext但我们确实应该这样做from django.utils.translation import gettext
关于如何使用 semgrep 实现这一目标有什么想法吗?
django ×1
gettext ×1
nestjs ×1
prisma ×1
prisma2 ×1
python ×1
python-3.x ×1
semgrep ×1
typescript ×1