Skip to content

Commit 15242d8

Browse files
authored
docs: add description of how to use a custom table name to the ORM example – (#12408)
1 parent 758c18a commit 15242d8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/docs.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4009,8 +4009,9 @@ V's ORM provides a number of benefits:
40094009
```v
40104010
import sqlite
40114011
4012+
// sets a custom table name. Default is struct name (case-sensitive)
4013+
[table: 'customers']
40124014
struct Customer {
4013-
// struct name has to be the same as the table name (for now)
40144015
id int [primary; sql: serial] // a field named `id` of integer type must be the first field
40154016
name string [nonull]
40164017
nr_orders int
@@ -4030,7 +4031,7 @@ sql db {
40304031
create table Customer
40314032
}
40324033
4033-
// select count(*) from Customer
4034+
// select count(*) from customers
40344035
nr_customers := sql db {
40354036
select count from Customer
40364037
}

0 commit comments

Comments
 (0)