parser: breaking change, let V ORM queries return arrays for *all* non-count queries, including limit = 1 (#17719)

This commit is contained in:
walking devel 2023-03-22 07:48:01 +00:00 committed by GitHub
parent 93b7cc4888
commit d0e78b1da6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 117 additions and 128 deletions

View file

@ -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')
}

View file

@ -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()
}