Skip to content

Commit eea73f6

Browse files
authored
pg-gen: implement information_schema shema (#1815)
1 parent 8fa5272 commit eea73f6

File tree

29 files changed

+34403
-211
lines changed

29 files changed

+34403
-211
lines changed

internal/codegen/golang/postgresql_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string {
274274
}
275275

276276
for _, schema := range req.Catalog.Schemas {
277-
if schema.Name == "pg_catalog" {
277+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
278278
continue
279279
}
280280

internal/codegen/golang/result.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func buildEnums(req *plugin.CodeGenRequest) []Enum {
1414
var enums []Enum
1515
for _, schema := range req.Catalog.Schemas {
16-
if schema.Name == "pg_catalog" {
16+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
1717
continue
1818
}
1919
for _, enum := range schema.Enums {
@@ -52,7 +52,7 @@ func buildEnums(req *plugin.CodeGenRequest) []Enum {
5252
func buildStructs(req *plugin.CodeGenRequest) []Struct {
5353
var structs []Struct
5454
for _, schema := range req.Catalog.Schemas {
55-
if schema.Name == "pg_catalog" {
55+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
5656
continue
5757
}
5858
for _, table := range schema.Tables {
@@ -253,8 +253,9 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error)
253253

254254
// It's possible that this method will generate duplicate JSON tag values
255255
//
256-
// Columns: count, count, count_2
257-
// Fields: Count, Count_2, Count2
256+
// Columns: count, count, count_2
257+
// Fields: Count, Count_2, Count2
258+
//
258259
// JSON tags: count, count_2, count_2
259260
//
260261
// This is unlikely to happen, so don't fix it yet

internal/codegen/kotlin/gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func ktEnumValueName(value string) string {
217217
func buildEnums(req *plugin.CodeGenRequest) []Enum {
218218
var enums []Enum
219219
for _, schema := range req.Catalog.Schemas {
220-
if schema.Name == "pg_catalog" {
220+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
221221
continue
222222
}
223223
for _, enum := range schema.Enums {
@@ -265,7 +265,7 @@ func memberName(name string, settings *plugin.Settings) string {
265265
func buildDataClasses(req *plugin.CodeGenRequest) []Struct {
266266
var structs []Struct
267267
for _, schema := range req.Catalog.Schemas {
268-
if schema.Name == "pg_catalog" {
268+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
269269
continue
270270
}
271271
for _, table := range schema.Tables {

internal/codegen/kotlin/postgresql_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) (string, bool)
8484

8585
default:
8686
for _, schema := range req.Catalog.Schemas {
87-
if schema.Name == "pg_catalog" {
87+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
8888
continue
8989
}
9090
for _, enum := range schema.Enums {

internal/codegen/python/gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func pyEnumValueName(value string) string {
244244
func buildEnums(req *plugin.CodeGenRequest) []Enum {
245245
var enums []Enum
246246
for _, schema := range req.Catalog.Schemas {
247-
if schema.Name == "pg_catalog" {
247+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
248248
continue
249249
}
250250
for _, enum := range schema.Enums {
@@ -277,7 +277,7 @@ func buildEnums(req *plugin.CodeGenRequest) []Enum {
277277
func buildModels(req *plugin.CodeGenRequest) []Struct {
278278
var structs []Struct
279279
for _, schema := range req.Catalog.Schemas {
280-
if schema.Name == "pg_catalog" {
280+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
281281
continue
282282
}
283283
for _, table := range schema.Tables {

internal/codegen/python/postgresql_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string {
4444
return "str"
4545
default:
4646
for _, schema := range req.Catalog.Schemas {
47-
if schema.Name == "pg_catalog" {
47+
if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
4848
continue
4949
}
5050
for _, enum := range schema.Enums {

0 commit comments

Comments
 (0)