TypeORM-readme-3.ts
· 277 B · TypeScript
原始文件
import { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from "typeorm"
@Entity()
export class User extends BaseEntity {
@PrimaryGeneratedColumn()
id: number
@Column()
firstName: string
@Column()
lastName: string
@Column()
age: number
}
1 | import { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from "typeorm" |
2 | |
3 | @Entity() |
4 | export class User extends BaseEntity { |
5 | @PrimaryGeneratedColumn() |
6 | id: number |
7 | |
8 | @Column() |
9 | firstName: string |
10 | |
11 | @Column() |
12 | lastName: string |
13 | |
14 | @Column() |
15 | age: number |
16 | } |