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:
@@ -44,7 +44,7 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
|
||||
sql db {
|
||||
create table Task
|
||||
}
|
||||
}!
|
||||
|
||||
task_model := Task{
|
||||
title: 'a'
|
||||
@@ -55,14 +55,14 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
sw.start()
|
||||
sql db {
|
||||
insert task_model into Task
|
||||
}
|
||||
} or { []Task{} }
|
||||
sw.stop()
|
||||
insert_stopwatchs << int(sw.end - sw.start)
|
||||
}
|
||||
|
||||
sql db {
|
||||
drop table Task
|
||||
}
|
||||
}!
|
||||
|
||||
response := Response{
|
||||
insert: insert_stopwatchs
|
||||
|
||||
@@ -31,7 +31,7 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
|
||||
sql db {
|
||||
create table Task
|
||||
}
|
||||
} or { panic(err) }
|
||||
|
||||
task_model := Task{
|
||||
title: 'a'
|
||||
@@ -42,14 +42,14 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
sw.start()
|
||||
sql db {
|
||||
insert task_model into Task
|
||||
}
|
||||
} or { []Task{} }
|
||||
sw.stop()
|
||||
insert_stopwatchs << int(sw.end - sw.start)
|
||||
}
|
||||
|
||||
sql db {
|
||||
drop table Task
|
||||
}
|
||||
} or { panic(err) }
|
||||
|
||||
response := Response{
|
||||
insert: insert_stopwatchs
|
||||
|
||||
@@ -50,7 +50,7 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
|
||||
sql db {
|
||||
create table Task
|
||||
}
|
||||
} or { panic(err) }
|
||||
|
||||
task_model := Task{
|
||||
title: 'a'
|
||||
@@ -62,7 +62,7 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
sw.start()
|
||||
sql db {
|
||||
insert task_model into Task
|
||||
}
|
||||
} or { panic(err) }
|
||||
sw.stop()
|
||||
insert_stopwatchs << int(sw.end - sw.start)
|
||||
}
|
||||
@@ -72,7 +72,7 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
sw.start()
|
||||
result := sql db {
|
||||
select from Task
|
||||
}
|
||||
} or { []Task{} }
|
||||
sw.stop()
|
||||
eprintln(result)
|
||||
select_stopwatchs << int(sw.end - sw.start)
|
||||
@@ -83,14 +83,14 @@ pub fn (mut app App) sqlite_memory(count int) vweb.Result {
|
||||
sw.start()
|
||||
sql db {
|
||||
update Task set title = 'b', status = 'finish' where id == i
|
||||
}
|
||||
} or { panic(err) }
|
||||
sw.stop()
|
||||
update_stopwatchs << int(sw.end - sw.start)
|
||||
}
|
||||
|
||||
sql db {
|
||||
drop table Task
|
||||
}
|
||||
} or { panic(err) }
|
||||
|
||||
response := Response{
|
||||
insert: insert_stopwatchs
|
||||
|
||||
Reference in New Issue
Block a user