orm: offset test
parent
f990a0b3d3
commit
3672cfad0b
|
@ -173,7 +173,13 @@ fn test_orm_sqlite() {
|
|||
select from User limit 2
|
||||
}
|
||||
assert two_users.len == 2
|
||||
assert two_users[0].id > 0
|
||||
assert two_users[0].id == 1
|
||||
//
|
||||
y := sql db {
|
||||
select from User limit 2 offset 1
|
||||
}
|
||||
assert y.len == 2
|
||||
assert y[0].id == 2
|
||||
}
|
||||
|
||||
struct User {
|
||||
|
|
|
@ -53,8 +53,7 @@ fn (mut p Parser) sql_expr() ast.Expr {
|
|||
limit_expr = p.expr(0)
|
||||
}
|
||||
if p.tok.kind == .name && p.tok.lit == 'offset' {
|
||||
// `limit 1` means that a single object is returned
|
||||
p.check_name() // `limit`
|
||||
p.check_name() // `offset`
|
||||
has_offset = true
|
||||
offset_expr = p.expr(0)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue