File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ const (
137137 'vlib/crypto/rand/crypto_rand_read_test.v' ,
138138 'vlib/net/smtp/smtp_test.v' ,
139139 'vlib/v/tests/websocket_logger_interface_should_compile_test.v' ,
140+ 'vlib/v/tests/fn_literal_type_test.v' ,
140141 ]
141142 skip_with_fsanitize_address = [
142143 'vlib/net/websocket/websocket_test.v' ,
@@ -189,6 +190,7 @@ const (
189190 'vlib/builtin/js/array_test.js.v' ,
190191 'vlib/net/smtp/smtp_test.v' ,
191192 'vlib/v/tests/websocket_logger_interface_should_compile_test.v' ,
193+ 'vlib/v/tests/fn_literal_type_test.v' ,
192194 ]
193195 skip_on_linux = [
194196 'do_not_remove' ,
@@ -224,6 +226,7 @@ const (
224226 'vlib/sync/many_times_test.v' ,
225227 'vlib/sync/once_test.v' ,
226228 'vlib/v/tests/websocket_logger_interface_should_compile_test.v' ,
229+ 'vlib/v/tests/fn_literal_type_test.v' ,
227230 ]
228231 skip_on_non_windows = [
229232 'do_not_remove' ,
Original file line number Diff line number Diff line change @@ -562,6 +562,16 @@ pub fn int_to_primitive(b int) Primitive {
562562 return Primitive (b)
563563}
564564
565+ // int_literal_to_primitive handles int literal value
566+ pub fn int_literal_to_primitive (b int ) Primitive {
567+ return Primitive (b)
568+ }
569+
570+ // float_literal_to_primitive handles float literal value
571+ pub fn float_literal_to_primitive (b f64 ) Primitive {
572+ return Primitive (b)
573+ }
574+
565575pub fn i64_to_primitive (b i64 ) Primitive {
566576 return Primitive (b)
567577}
Original file line number Diff line number Diff line change 1+ import sqlite
2+
3+ [table: 'Users' ]
4+ struct User {
5+ id int [primary; sql: serial]
6+ name string
7+ }
8+
9+ const (
10+ const_users_offset = 1
11+ const_users_offset2 = 1
12+ )
13+
14+ fn test_orm () {
15+ db := sqlite.connect (':memory:' ) or { panic (err) }
16+
17+ upper_1 := User{
18+ name: 'Test'
19+ }
20+
21+ upper_2 := User{
22+ name: 'Test2'
23+ }
24+
25+ sql db {
26+ create table User
27+ insert upper_1 into User
28+ insert upper_2 into User
29+ } or { panic (err) }
30+
31+ result := sql db {
32+ select from User limit const_users_offset2
33+ } or { panic (err) }
34+
35+ assert result[0 ].name == 'Test'
36+ }
You can’t perform that action at this time.
0 commit comments