1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

orm: enforce that queries always return a Result, a query-resulting array can be used as a V array in place. (#17871)

This commit is contained in:
walking devel
2023-04-04 05:23:06 +00:00
committed by GitHub
parent 9addede0ea
commit 8452644ec3
67 changed files with 479 additions and 354 deletions

View File

@@ -15,7 +15,7 @@ fn test_fn_calls() {
sql db {
create table User
}
}!
first_user := User{
name: 'first'
@@ -30,18 +30,18 @@ fn test_fn_calls() {
sql db {
insert first_user into User
insert second_user into User
}
}!
users_with_acceptable_age := sql db {
select from User where age >= get_acceptable_age()
}
}!
assert users_with_acceptable_age.len == 1
assert users_with_acceptable_age.first().name == 'first'
users_with_non_acceptable_age := sql db {
select from User where age < get_acceptable_age()
}
}!
assert users_with_non_acceptable_age.len == 1
assert users_with_non_acceptable_age.first().name == 'second'