mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
orm: skip via the "-" attribute
This commit is contained in:
@ -446,6 +446,12 @@ pub fn orm_table_gen(table string, q string, defaults bool, def_unique_len int,
|
||||
}
|
||||
for attr in field.attrs {
|
||||
match attr.name {
|
||||
'sql' {
|
||||
// [sql:'-']
|
||||
if attr.arg == '-' {
|
||||
is_skip = true
|
||||
}
|
||||
}
|
||||
'primary' {
|
||||
primary = field.name
|
||||
}
|
||||
@ -470,13 +476,13 @@ pub fn orm_table_gen(table string, q string, defaults bool, def_unique_len int,
|
||||
}
|
||||
'sql_type' {
|
||||
if attr.kind != .string {
|
||||
return error("sql_type attribute need be string. Try [sql_type: '${attr.arg}'] instead of [sql_type: ${attr.arg}]")
|
||||
return error("sql_type attribute needs to be string. Try [sql_type: '${attr.arg}'] instead of [sql_type: ${attr.arg}]")
|
||||
}
|
||||
ctyp = attr.arg
|
||||
}
|
||||
'default' {
|
||||
if attr.kind != .string {
|
||||
return error("default attribute need be string. Try [default: '${attr.arg}'] instead of [default: ${attr.arg}]")
|
||||
return error("default attribute needs to be string. Try [default: '${attr.arg}'] instead of [default: ${attr.arg}]")
|
||||
}
|
||||
if default_val == '' {
|
||||
default_val = attr.arg
|
||||
|
Reference in New Issue
Block a user