Skip to content

Commit

Permalink
docs: add description of how to use a custom table name to the ORM ex…
Browse files Browse the repository at this point in the history
…ample – (#12408)
  • Loading branch information
tarasyyyk committed Nov 8, 2021
1 parent 758c18a commit 15242d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/docs.md
Expand Up @@ -4009,8 +4009,9 @@ V's ORM provides a number of benefits:
```v
import sqlite
// sets a custom table name. Default is struct name (case-sensitive)
[table: 'customers']
struct Customer {
// struct name has to be the same as the table name (for now)
id int [primary; sql: serial] // a field named `id` of integer type must be the first field
name string [nonull]
nr_orders int
Expand All @@ -4030,7 +4031,7 @@ sql db {
create table Customer
}
// select count(*) from Customer
// select count(*) from customers
nr_customers := sql db {
select count from Customer
}
Expand Down

0 comments on commit 15242d8

Please sign in to comment.