TypeORM-readme-4.ts
· 303 B · TypeScript
Bruto
const user = new User()
user.firstName = "Timber"
user.lastName = "Saw"
user.age = 25
await user.save()
const allUsers = await User.find()
const firstUser = await User.findOneBy({
id: 1,
})
const timber = await User.findOneBy({
firstName: "Timber",
lastName: "Saw"
})
await timber.remove()
1 | const user = new User() |
2 | user.firstName = "Timber" |
3 | user.lastName = "Saw" |
4 | user.age = 25 |
5 | await user.save() |
6 | |
7 | const allUsers = await User.find() |
8 | const firstUser = await User.findOneBy({ |
9 | id: 1, |
10 | }) |
11 | const timber = await User.findOneBy({ |
12 | firstName: "Timber", |
13 | lastName: "Saw" |
14 | }) |
15 | |
16 | await timber.remove() |