Codegen now supports the database column type in the field template.
This allows for inserting it as a comment which is very useful while tweaking your typemappings as you can see what the input was.
This commit is contained in:
parent
be0064f730
commit
104ab5de1e
8 changed files with 49 additions and 19 deletions
|
|
@ -80,7 +80,7 @@ QString CodeBuilder::columnNameToVariableName(QString column_name) const
|
|||
return m_configuration->columnNameToFieldName(column_name);
|
||||
}
|
||||
|
||||
QString CodeBuilder::getTypeName(Oid dbtype) const
|
||||
TypeMappingResult CodeBuilder::getTypeName(Oid dbtype) const
|
||||
{
|
||||
return m_configuration->getTypeName(dbtype);
|
||||
}
|
||||
|
|
@ -97,10 +97,11 @@ void CodeBuilder::genFieldRetrieval(QTextStream &q, const ColumnDataList &column
|
|||
|
||||
void CodeBuilder::genFieldDeclaration(QTextStream &q, const QString &format, const QString &field_name, Oid column_type) const
|
||||
{
|
||||
QString type_name = getTypeName(column_type);
|
||||
TypeMappingResult type_name = getTypeName(column_type);
|
||||
FormatToStream(q, format, [&] (QTextStream &out, QString var) {
|
||||
if (var == "typename") out << type_name;
|
||||
if (var == "typename") out << type_name.codeType();
|
||||
else if (var == "varname") out << field_name;
|
||||
else if (var == "dbtype") out << type_name.dbType();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue