mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
orm: more fixes and tests
This commit is contained in:
parent
6066414afa
commit
325a7c7ec5
@ -743,6 +743,9 @@ fn test_double_quote_inter() {
|
||||
}
|
||||
|
||||
fn test_string_map() {
|
||||
$if windows {
|
||||
return // TODO
|
||||
}
|
||||
a := 'Hello'.map(fn (b byte) byte {
|
||||
return b + 1
|
||||
})
|
||||
|
@ -66,6 +66,20 @@ fn test_orm_sqlite() {
|
||||
assert users[0].name == 'Sam'
|
||||
assert users[1].name == 'Peter'
|
||||
assert users[1].age == 31
|
||||
//
|
||||
users2 := sql db {
|
||||
select from User where id < 0
|
||||
}
|
||||
println(users2)
|
||||
assert users2.len == 0
|
||||
//
|
||||
users3 := sql db {
|
||||
select from User where age == 29 || age == 31
|
||||
}
|
||||
println(users3)
|
||||
assert users3.len == 2
|
||||
assert users3[0].age == 29
|
||||
assert users3[1].age == 31
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,7 +119,11 @@ fn (mut g Gen) expr_to_sql(expr ast.Expr) {
|
||||
match it.op {
|
||||
.eq { g.write(' = ') }
|
||||
.gt { g.write(' > ') }
|
||||
.lt { g.write(' < ') }
|
||||
.ge { g.write(' >= ') }
|
||||
.le { g.write(' <= ') }
|
||||
.and { g.write(' and ') }
|
||||
.logical_or { g.write(' or ') }
|
||||
else {}
|
||||
}
|
||||
g.expr_to_sql(it.right)
|
||||
|
Loading…
Reference in New Issue
Block a user