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

cgen, orm: fix typo, and wrap the fkey attribute into quotes in errors (#18266)

This commit is contained in:
Mark aka walkingdevel 2023-05-25 15:27:25 +00:00 committed by GitHub
parent 993546a0a2
commit c2fa45c24d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,12 +283,12 @@ fn (mut g Gen) write_orm_insert_with_last_ids(node ast.SqlStmtLine, connection_v
if attr.kind == .string {
f_key = attr.arg
} else {
verror("fkey attribute need be string. Try [fkey: '${attr.arg}'] instead of [fkey: ${attr.arg}]")
verror("`fkey` attribute need be string. Try [fkey: '${attr.arg}'] instead of [fkey: ${attr.arg}]")
}
}
}
if f_key == '' {
verror('a field which holds an array, needs a fkey defined ("${sym.name}")')
verror('a field which holds an array, needs a `fkey` defined ("${sym.name}")')
}
fkeys << f_key
info := sym.array_info()
@ -905,13 +905,13 @@ fn (mut g Gen) write_orm_select(node ast.SqlExpr, connection_var_name string, le
if attr.kind == .string {
fkey = attr.arg
} else {
verror("fkey attribute need be string. Try [fkey: '${attr.arg}'] instead of [fkey: ${attr.arg}]")
verror("`fkey` attribute need be string. Try [fkey: '${attr.arg}'] instead of [fkey: ${attr.arg}]")
}
}
}
// TODO: move to the ORM checker
if fkey == '' {
verror('fn field which holds an array, needs a `fkey` defined ("${sym.name}")')
verror('a field which holds an array, needs a `fkey` defined ("${sym.name}")')
}
info := sym.array_info()
arr_typ := info.elem_type