mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
parser: breaking change, let V ORM queries return arrays for *all* non-count queries, including limit = 1
(#17719)
This commit is contained in:
parent
93b7cc4888
commit
d0e78b1da6
14 changed files with 117 additions and 128 deletions
|
@ -34,9 +34,10 @@ fn (mut app App) service_auth(username string, password string) !string {
|
|||
db.close() or { panic(err) }
|
||||
}
|
||||
|
||||
user := sql db {
|
||||
select from User where username == username limit 1
|
||||
users := sql db {
|
||||
select from User where username == username
|
||||
}
|
||||
user := users.first()
|
||||
if user.username != username {
|
||||
return error('user not found')
|
||||
}
|
||||
|
|
|
@ -61,5 +61,5 @@ fn (mut app App) service_get_user(id int) !User {
|
|||
select from User where id == id
|
||||
}
|
||||
|
||||
return results
|
||||
return results.first()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue