Open vinyll opened 1 year ago
Following the first instruction to ininitalize a VWeb project
v new myproject web cd myproject v src
leads into the following error:
v src/ src/auth_services.v:28:22: error: unknown function: databases.create_db_connection 26 | 27 | fn (mut app App) service_auth(username string, password string) !string { 28 | mut db := databases.create_db_connection() or { | ~~~~~~~~~~~~~~~~~~~~~~ 29 | eprintln(err) 30 | panic(err) src/auth_services.v:34:6: error: cannot call a method using an invalid expression 32 | 33 | defer { 34 | db.close() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | } 36 | src/main.v:20:22: error: unknown function: databases.create_db_connection 18 | 19 | fn main() { 20 | mut db := databases.create_db_connection() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~ 21 | 22 | sql db { src/main.v:26:5: error: cannot call a method using an invalid expression 24 | } or { panic('error on create table: ${err}') } 25 | 26 | db.close() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~~~~ 27 | 28 | mut app := &App{} src/product_service.v:6:22: error: unknown function: databases.create_db_connection 4 | 5 | fn (mut app App) service_add_product(product_name string, user_id int) ! { 6 | mut db := databases.create_db_connection()! | ~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | defer { src/product_service.v:9:6: error: cannot call a method using an invalid expression 7 | 8 | defer { 9 | db.close() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~~~~ 10 | } 11 | src/product_service.v:29:22: error: unknown function: databases.create_db_connection 27 | 28 | fn (mut app App) service_get_all_products_from(user_id int) ?[]Product { 29 | mut db := databases.create_db_connection() or { | ~~~~~~~~~~~~~~~~~~~~~~ 30 | println(err) 31 | return err src/product_service.v:35:6: error: cannot call a method using an invalid expression 33 | 34 | defer { 35 | db.close() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~~~~ 36 | } 37 | src/user_services.v:7:22: error: unknown function: databases.create_db_connection 5 | 6 | fn (mut app App) service_add_user(username string, password string) ! { 7 | mut db := databases.create_db_connection()! | ~~~~~~~~~~~~~~~~~~~~~~ 8 | 9 | defer { src/user_services.v:10:6: error: cannot call a method using an invalid expression 8 | 9 | defer { 10 | db.close() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~~~~ 11 | } 12 | src/user_services.v:40:6: error: cannot call a method using an invalid expression 38 | 39 | defer { 40 | db.close() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~~~~ 41 | } 42 | src/user_services.v:51:22: error: unknown function: databases.create_db_connection 49 | 50 | fn (mut app App) service_get_user(id int) ?User { 51 | mut db := databases.create_db_connection() or { | ~~~~~~~~~~~~~~~~~~~~~~ 52 | println(err) 53 | return err src/user_services.v:57:6: error: cannot call a method using an invalid expression 55 | 56 | defer { 57 | db.close() or { panic(err) } | ~~~~~~~~~~~~~~~~~~~~~~~~~ 58 | } 59 |
However running
v new myproject cd myproject
and copy pasting the example from the home page works as expected.
Following the first instruction to ininitalize a VWeb project
leads into the following error:
However running
and copy pasting the example from the home page works as expected.