Skip to content

Commit

Permalink
fix: filter non-existent schemas for go types (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge authored Jul 1, 2024
1 parent d280bc1 commit ddc389d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/server/templates/go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ package database
import "database/sql"
${tables
.filter((table) => schemas.some((schema) => schema.name === table.schema))
.flatMap((table) =>
generateTableStructsForOperations(
schemas.find((schema) => schema.name === table.schema)!,
Expand All @@ -49,6 +50,7 @@ ${tables
.join('\n\n')}
${views
.filter((view) => schemas.some((schema) => schema.name === view.schema))
.flatMap((view) =>
generateTableStructsForOperations(
schemas.find((schema) => schema.name === view.schema)!,
Expand All @@ -61,6 +63,7 @@ ${views
.join('\n\n')}
${materializedViews
.filter((materializedView) => schemas.some((schema) => schema.name === materializedView.schema))
.flatMap((materializedView) =>
generateTableStructsForOperations(
schemas.find((schema) => schema.name === materializedView.schema)!,
Expand All @@ -73,6 +76,7 @@ ${materializedViews
.join('\n\n')}
${compositeTypes
.filter((compositeType) => schemas.some((schema) => schema.name === compositeType.schema))
.map((compositeType) =>
generateCompositeTypeStruct(
schemas.find((schema) => schema.name === compositeType.schema)!,
Expand Down

0 comments on commit ddc389d

Please sign in to comment.