docs: add description of how to use a custom table name to the ORM example – (#12408)
							parent
							
								
									758c18a906
								
							
						
					
					
						commit
						15242d8082
					
				| 
						 | 
					@ -4009,8 +4009,9 @@ V's ORM provides a number of benefits:
 | 
				
			||||||
```v
 | 
					```v
 | 
				
			||||||
import sqlite
 | 
					import sqlite
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// sets a custom table name. Default is struct name (case-sensitive)
 | 
				
			||||||
 | 
					[table: 'customers']
 | 
				
			||||||
struct Customer {
 | 
					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
 | 
						id        int    [primary; sql: serial] // a field named `id` of integer type must be the first field
 | 
				
			||||||
	name      string [nonull]
 | 
						name      string [nonull]
 | 
				
			||||||
	nr_orders int
 | 
						nr_orders int
 | 
				
			||||||
| 
						 | 
					@ -4030,7 +4031,7 @@ sql db {
 | 
				
			||||||
	create table Customer
 | 
						create table Customer
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// select count(*) from Customer
 | 
					// select count(*) from customers
 | 
				
			||||||
nr_customers := sql db {
 | 
					nr_customers := sql db {
 | 
				
			||||||
	select count from Customer
 | 
						select count from Customer
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue