跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[TypeScript] 前端写 nestjs 后端,用 TypeORM 时感到非常困惑,不知道是不是我的理解有问题

发表于
当我把一个表字段定义为 nullable: true 或者 nullable: false 的时候,似乎并不影响这个字段在代码里是 optional 还是 required ?如果我不通过 ORM 自动建表,而是自己在 navicat 里建表,那是不是 TypeORM 里面的 @Column 装饰器参数就没有任何意义?

另一个更大的疑问:我定义一个 Entity ,所有字段都是 Not Null 的,类型也都是 required 的,结果 TypeORM 允许我往这个表里保存空对象?等着数据库报错?
这个类型安全体现在哪里,我真的很迷惑,网上搜了一圈没看到有人问这个,不禁怀疑是我的理解有问题

UXze9bI.png
CoyUtkq.png

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.