Skip to content

Commit 0f75b0a

Browse files
committed
fix: fix total type in paginate
1 parent 494bc10 commit 0f75b0a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

core/dal-runtime/src/DataSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class DataSource<T> implements IDataSource<T> {
7777
]);
7878

7979
return {
80-
total: ret[1],
80+
total: Number(ret[1]),
8181
pageNum: currentPage,
8282
rows: ret[0].map(t => TableModelInstanceBuilder.buildInstance(this.tableModel, t)),
8383
};

core/dal-runtime/test/DataSource.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,8 @@ describe('test/Datasource.test.ts', () => {
146146
$id: insertResult.insertId,
147147
});
148148
assert.equal(findRow2, null);
149+
150+
const res = await dataSource.paginate('findByPrimary', {}, 1, 10);
151+
assert(res.total === 0);
149152
});
150153
});

0 commit comments

Comments
 (0)