小编And*_*nko的帖子

Typeorm 选择所有行但限制为 25

CandidateEntity

@Entity({ name: 'users' })
export class CandidateEntity {
    @PrimaryGeneratedColumn()
    public id: number;

    @OneToOne(() => CandidateEmployeeInfoEntity, employeeInfo => employeeInfo.candidate)
    public employeeInfo: CandidateEmployeeInfoEntity;
}

Run Code Online (Sandbox Code Playgroud)

EmployeeInfoEntity

@Entity({ name: 'candidates_employee_infos' })
export class CandidateEmployeeInfoEntity {
    @PrimaryGeneratedColumn()
    public id: number;

    @Column({ type: 'bool', nullable: false })
    public relocation: boolean;

    @Column({ type: 'text', nullable: true })
    public softSkills: string;

    @OneToOne(() => CandidateEntity, candidate => candidate.employeeInfo)
    public candidate: CandidateEntity;

    @Column({ type: 'integer' })
    public candidateId: number;
}
Run Code Online (Sandbox Code Playgroud)

我创建查询以从数据库中的 104 行中选择前 25 行

const {
            perPage = …
Run Code Online (Sandbox Code Playgroud)

node.js typeorm typeorm-datamapper

10
推荐指数
1
解决办法
2万
查看次数

标签 统计

node.js ×1

typeorm ×1

typeorm-datamapper ×1