我正在编写一个 prisma 查询,但我需要知道一个字符串是否存在于另一个字符串中。
在 prisma 中我们可以做到这一点
where: {
id: { in: [22, 91, 14, 2, 5] },
},
Run Code Online (Sandbox Code Playgroud)
对于数组。但我希望能够检查字符串中是否存在属性值。像这样的事情
where: {
comment: { in: "some random string containing the value in comment" },
},
Run Code Online (Sandbox Code Playgroud)
那么comment: 'the value'它是否应该与上面的查询匹配。我在 prisma 文档中找不到此类操作的示例。
我正在寻找 string_contains 函数的反函数。基本上相当于这个SELECT * FROM table WHERE POSITION(comment IN "some random string containing the value in comment") > -1
我对 Nestjs 中的这个包有疑问@ntegral/nestjs-sentry。我有一个在我的应用程序中使用的自定义记录器
@Injectable()\nexport class CustomLogger implements LoggerService {\n constructor(@InjectSentry() private readonly client: SentryService) {}\n\n log(message: any, ...optionalParams: any[]) {\n this.client.instance().captureMessage(message, ...optionalParams);\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n然后我将其注入到用户控制器和 user.controller.spec.ts 中
\ndescribe(\'UsersController\', () => {\n let controller: UsersController;\n\n beforeEach(async () => {\n const module: TestingModule = await Test.createTestingModule({\n controllers: [UsersController],\n providers: [\n CustomLogger,\n UsersService,\n SentryService,\n ],\n }).compile();\n\n controller = module.get<UsersController>(UsersController);\n });\n\n it(\'should be defined\', () => {\n expect(controller).toBeDefined();\n });\n});\n\nRun Code Online (Sandbox Code Playgroud)\n我收到这个错误
\n FAIL src/users/users.controller.spec.ts (9.449 s)\n \xe2\x97\x8f UsersController \xe2\x80\xba should …Run Code Online (Sandbox Code Playgroud) make()我在类中有一个静态方法Response。它被重载以从 jsoncpp 获取std::string或Json::Value获取。
我重载了该方法,如下所示:
Response::make(Json::Value body)
{
...
}
Response::make(std::string body)
{
...
}
Run Code Online (Sandbox Code Playgroud)
这会导致编译时出现此错误:
Response::make(Json::Value body)
{
...
}
Response::make(std::string body)
{
...
}
Run Code Online (Sandbox Code Playgroud)
是否被Json::value视为字符串?我该如何解决这个问题?