-
Notifications
You must be signed in to change notification settings - Fork 55
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
limit 和 firstOrNull 的逻辑似乎有点矛盾 #260
Comments
@swiftlei 我猜你想要的是singleOrNull |
singlexxx会返回并且断言至多一条 |
limit的操作是覆盖之前的limit,firsXXX自带limit(1) |
limit的设计之初是同层级limit多次会覆盖之前的,同层级是指在遇到下一个select之前,因为每次select相当于是一次匿名表比如select * from (select id,name from table where xxx) t |
谢谢,所以如果需要我要的取第101条数据的效果,应该是 limit(100,1).singleOrNull()? |
@swiftlei 是的 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
当执行下面的语句
.where(...)
.....
.orderBy(...)
.limit(100, 1)
.firstOrNull()
时,返回的结果总是符合查询条件的第一条记录,而不是 limit 指定的 offset 100后的第一条
如果修改为
...
limit(100,1)
.toList().get(0)
则获得的是正确的offset 100条以后的第一条记录.
请问一下这样的情况是bug, 还是设计的逻辑本就如此?
The text was updated successfully, but these errors were encountered: