Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

countSelect返回的data.count应该为int型 #1502

Open
DickyNet opened this issue Jul 24, 2020 · 1 comment
Open

countSelect返回的data.count应该为int型 #1502

DickyNet opened this issue Jul 24, 2020 · 1 comment

Comments

@DickyNet
Copy link

DESC

countSelect返回的data.count应该为int型,现在是string型

ENV

OS Platform:
windows 10
Node.js Version:
12.0
ThinkJS Version:
3.23

code

// your code here

const list = await model
.where(where)
.field('*')
.order('id DESC')
.page(page, pagesize)
.countSelect();

error message

// your error message here

more description

// your detail description

@lizheming
Copy link
Contributor

https://github.com/thinkjs/think-model/blob/master/src/model.js#L644 count 是使用 SQL count() 查询出来的数量结果,SQL 由于可能存在大数小数的可能,所以很多数字都返回的是字符串类型。不过这种情况比较小,可以对其进行优化,欢迎提 PR 呀~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants