- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我使用 react-native init test
创建了一个新的虚拟应用程序,然后按照说明添加 typeorm。在我的 App.js 中,我包含了 import {getManager} from 'typeorm'
,然后运行 react-native run-ios
。
我在 metro-bundler 中看到以下错误:
Error: Unable to resolve module path from /Users/amit/Code/test/node_modules/typeorm/platform/PlatformTools.js: Module path does not exist in the Haste module map
这里有一个示例存储库来显示问题:enter link description here
不确定我是否遗漏了设置中的某些内容!非常欢迎任何帮助!
最佳答案
不幸的是,从“typeorm”模块导入不起作用,因为 react-native 项目不使用 node 平台。从“typeorm/browser”导入将起作用。这是一个示例项目。:https://github.com/typeorm/react-native-example
确保您创建的连接对象不使用任何对项目文件系统的引用。避免使用类似的东西:
import { CountSession } from '../biopro-mobile-database/entities/count_session';
const connection = await createConnection({
name: 'liteDb_3',
type: 'react-native',
database: 'biopro_mobile.sqlite',
location: 'default',
synchronize: false,
logging: true,
entities: ["../biopro-mobile-database/entities/**/*.ts"],
})
避免实体:["../biopro-mobile-database/entities//*.ts"],**而是使用类似的东西:
import { EquipmentCounted } from '../biopro-mobile-database/entities/equipment_counted';
import { CountSession } from '../biopro-mobile-database/entities/count_session';
const connection = await createConnection({
name: 'liteDb_3',
type: 'react-native',
database: 'biopro_mobile.sqlite',
location: 'default',
synchronize: false,
logging: true,
entities: [
CountSession,
EquipmentCounted,
],
})
关于react-native - TypeORM 与 React Native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50117535/
我知道 typeorm 可以创建整个 db 模式,甚至可以将数据库模式与实体定义同步(请参阅 synchronize 中的 Connection Options ) 但在生产中,我想要求 typeor
我有一个 Role Entity 和一个 Route Entity,它们是树形结构,它们是 ManyToMany 关系。 现在我想通过 RoleRepository.find({relations:
我已经设置了 logging: true当createConnection()来自 TypeORM ,在大多数情况下都可以正常工作。 但是有一种情况,我的数据字段之一来自特定的 query/mutat
在 Rails 上,每个测试用例都会创建一个 ActiveRecord 事务,它允许测试所有内容,然后将数据库恢复到原始状态,而不必删除所有表或任何可能影响播种机等的内容。 可以在 Typeorm 上
Note 与 Subject 具有多对多关系 查询它的最佳方式是什么?我喜欢编写以下内容来获取给定注释上的所有主题: const subjectRepo = connection.getRepos
我使用 UUID 作为我的实体的主键,它工作得很好。但我想删除那些破折号。 现在 ID 被保存为 8e5365f4-3d42-4274-bafc-93b97bd6e3f2 36 个字符 我想要的是 8
我一整天都在尝试将实体保存到 MySQL 数据库中,遇到了巨大的困难。我正在使用 NestJS 和 TypeORM。 teacher.entity.ts import { BeforeInsert,
我也想在前端使用我用 TypeORM 创建的实体。有没有一种干净的方法可以做到这一点?或者我应该继续这样做。 此时,我的文件结构如下所示(前端的 Angular 8): /server /enti
我想得到一个 basic setup使用 TypeORM 工作,并在设置后收到此错误。 这是一个 REPL(只需执行 yarn install && yarn db:dev 后跟 yarn db:mi
我正在尝试通过 Nest/TypeORM 构建 SAAS 产品,我需要按子域配置/更改数据库连接。 customer1.domain.com => connect to customer1 datab
如何将 TypeORM 与 Better-sqlite3 一起使用? 上官方documentation ,有一个section形式更好-sqlite3。 我已经通过 typeorm@latest 安装
操作系统:macOS Sierra v 10.12.6 我正在尝试使用 typeorm 在 Typescript 中构建一个应用程序,这是我第一次使用其中任何一个。 我使用了以下两种方法来安装 typ
有没有一种简单的方法可以使用 DataSource 在 typeORM v.0.3.6 中播种数据? typeorm-seeding 似乎使用已弃用的 Connection。 最佳答案 找到这个包裹
我正在做一门类(class),我们使用 express-node postgres 和 react(使用 typescript)和 typeORM。到目前为止一切都运行良好,但我面临 typeORM
尽管进行了大量研究和反复试验,但不幸的是,我还没有针对以下用例的完美解决方案:一个用户有多个帖子,这被正确地实现为一对多关系。我想为用户加载他的所有帖子,但不是帖子的所有属性,只有某些属性。 方法 1
我用 NestJS 和 ORM TypeORM 做一个 API 我有实体: 用户 关系类型 UserRelationshipType(带有用户和关系类型 ForeignKey) 和关系(与 userR
我有两个实体 Tag 和 Photo: // tag.entity.ts import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm
我有以下要保存的实体: @Entity('approvals') export class Approval { @PrimaryGeneratedColumn() id: string;
我有命令: .leftJoinAndSelect("permission.user", "user") .where("permissi
我是使用 typeorm 的新手,这是我第二次与 typeorm 混淆,我有以下查询: SELECT t1.a,t1.b,t2.a (SELECT TOP 1 t1.a FROM table1
我是一名优秀的程序员,十分优秀!