[Feature] Add support for database views.

[Feature] Add support to manually set primary keys for destination structure fields.
This commit is contained in:
go-jet 2019-09-20 12:53:52 +02:00
parent 5b08a1d240
commit b88519bfd4
18 changed files with 462 additions and 128 deletions

View file

@ -35,7 +35,7 @@ func Generate(destDir string, dbConn DBConnection) error {
}
fmt.Println("Retrieving schema information...")
schemaInfo, err := metadata.GetSchemaInfo(db, dbConn.SchemaName, &postgresQuerySet{})
schemaInfo, err := metadata.GetSchemaMetaData(db, dbConn.SchemaName, &postgresQuerySet{})
if err != nil {
return err
@ -43,7 +43,7 @@ func Generate(destDir string, dbConn DBConnection) error {
genPath := path.Join(destDir, dbConn.DBName, dbConn.SchemaName)
err = template.GenerateFiles(genPath, schemaInfo.TableInfos, schemaInfo.EnumInfos, postgres.Dialect)
err = template.GenerateFiles(genPath, schemaInfo, postgres.Dialect)
if err != nil {
return err

View file

@ -12,7 +12,7 @@ func (p *postgresQuerySet) ListOfTablesQuery() string {
return `
SELECT table_name
FROM information_schema.tables
where table_schema = $1 and table_type = 'BASE TABLE';
where table_schema = $1 and table_type = $2;
`
}