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
|
|
@ -8,6 +8,20 @@
|
|||
|
||||
class PgTypeContainer;
|
||||
|
||||
class TypeMappingResult {
|
||||
public:
|
||||
TypeMappingResult(QString codetype, QString dbtype)
|
||||
: m_codeType(codetype)
|
||||
, m_dbType(dbtype)
|
||||
{}
|
||||
|
||||
const QString& codeType() const { return m_codeType; }
|
||||
const QString& dbType() const { return m_dbType; }
|
||||
private:
|
||||
QString m_codeType;
|
||||
QString m_dbType;
|
||||
};
|
||||
|
||||
class TypeMappings {
|
||||
public:
|
||||
using TypeMap = std::unordered_map<Oid, QString>;
|
||||
|
|
@ -17,7 +31,7 @@ public:
|
|||
|
||||
TypeMappings(std::shared_ptr<const PgTypeContainer> types, std::initializer_list<Mapping> mappings);
|
||||
|
||||
QString getTypeForOid(Oid oid) const;
|
||||
TypeMappingResult getTypeForOid(Oid oid) const;
|
||||
|
||||
const TypeMap& typeMap() const { return m_typeMap; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue