1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

orm: add support for custom table names & custom field names (#9697)

This commit is contained in:
Louis Schmieder
2021-04-15 09:53:43 +02:00
committed by GitHub
parent f1bda88964
commit dcf4a6b008
5 changed files with 80 additions and 35 deletions

View File

@ -1,6 +1,7 @@
import sqlite
import mysql
[table: 'modules']
struct Module {
id int [primary; sql: serial]
name string
@ -11,8 +12,8 @@ struct Module {
struct User {
id int [primary; sql: serial]
age int [unique: 'user']
name string [unique]
is_customer bool [unique: 'user']
name string [sql: 'username'; unique]
is_customer bool [sql: 'abc'; unique: 'user']
skipped_string string [skip]
}