From f243f60381aaddaa11839be684c008c0ddf6a7c6 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Tue, 23 Aug 2022 21:50:45 -0700 Subject: [PATCH 1/2] fix: Update comment for nullable enums --- internal/codegen/golang/templates/template.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/codegen/golang/templates/template.tmpl b/internal/codegen/golang/templates/template.tmpl index b155516e9f..5dadf8e289 100644 --- a/internal/codegen/golang/templates/template.tmpl +++ b/internal/codegen/golang/templates/template.tmpl @@ -89,7 +89,7 @@ func (e *{{.Name}}) Scan(src interface{}) error { type Null{{.Name}} struct { {{.Name}} {{.Name}} - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if {{.Name}} is not NULL } // Scan implements the Scanner interface. From 3ebde1474e21e5bdea2ff1e9a06b473388430620 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Tue, 23 Aug 2022 21:55:13 -0700 Subject: [PATCH 2/2] Update comments in generated files --- examples/batch/postgresql/models.go | 2 +- examples/booktest/mysql/models.go | 2 +- examples/booktest/postgresql/models.go | 2 +- examples/ondeck/mysql/models.go | 2 +- examples/ondeck/postgresql/models.go | 2 +- .../endtoend/testdata/comment_on/postgresql/pgx/go/models.go | 2 +- .../testdata/comment_on/postgresql/stdlib/go/models.go | 2 +- .../ddl_alter_type_add_value/postgresql/pgx/go/models.go | 2 +- .../ddl_alter_type_add_value/postgresql/stdlib/go/models.go | 2 +- .../ddl_alter_type_rename/postgresql/pgx/go/models.go | 2 +- .../ddl_alter_type_rename/postgresql/stdlib/go/models.go | 2 +- .../postgresql/pgx/go/models.go | 2 +- .../postgresql/stdlib/go/models.go | 2 +- .../ddl_alter_type_rename_value/postgresql/pgx/go/models.go | 2 +- .../postgresql/stdlib/go/models.go | 2 +- .../endtoend/testdata/ddl_comment/postgresql/pgx/go/models.go | 2 +- .../testdata/ddl_comment/postgresql/stdlib/go/models.go | 2 +- internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go | 4 ++-- .../testdata/ddl_create_enum/postgresql/pgx/go/models.go | 4 ++-- .../testdata/ddl_create_enum/postgresql/stdlib/go/models.go | 4 ++-- .../endtoend/testdata/emit_enum_valid_and_values/go/models.go | 2 +- internal/endtoend/testdata/enum/mysql/go/models.go | 4 ++-- internal/endtoend/testdata/enum/postgresql/pgx/go/models.go | 2 +- .../endtoend/testdata/enum/postgresql/stdlib/go/models.go | 2 +- internal/endtoend/testdata/rename/pgx/go/models.go | 2 +- internal/endtoend/testdata/rename/stdlib/go/models.go | 2 +- .../endtoend/testdata/schema_scoped_enum/pgx/go/models.go | 2 +- .../endtoend/testdata/schema_scoped_enum/stdlib/go/models.go | 2 +- 28 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/batch/postgresql/models.go b/examples/batch/postgresql/models.go index 6375262e50..34e3d66afb 100644 --- a/examples/batch/postgresql/models.go +++ b/examples/batch/postgresql/models.go @@ -31,7 +31,7 @@ func (e *BookType) Scan(src interface{}) error { type NullBookType struct { BookType BookType - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if BookType is not NULL } // Scan implements the Scanner interface. diff --git a/examples/booktest/mysql/models.go b/examples/booktest/mysql/models.go index b342e9b81c..862f4a0014 100644 --- a/examples/booktest/mysql/models.go +++ b/examples/booktest/mysql/models.go @@ -31,7 +31,7 @@ func (e *BooksBookType) Scan(src interface{}) error { type NullBooksBookType struct { BooksBookType BooksBookType - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if BooksBookType is not NULL } // Scan implements the Scanner interface. diff --git a/examples/booktest/postgresql/models.go b/examples/booktest/postgresql/models.go index d84ed1ef1d..90a6acb55d 100644 --- a/examples/booktest/postgresql/models.go +++ b/examples/booktest/postgresql/models.go @@ -31,7 +31,7 @@ func (e *BookType) Scan(src interface{}) error { type NullBookType struct { BookType BookType - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if BookType is not NULL } // Scan implements the Scanner interface. diff --git a/examples/ondeck/mysql/models.go b/examples/ondeck/mysql/models.go index 0dc0573a89..20aabdb876 100644 --- a/examples/ondeck/mysql/models.go +++ b/examples/ondeck/mysql/models.go @@ -32,7 +32,7 @@ func (e *VenuesStatus) Scan(src interface{}) error { type NullVenuesStatus struct { VenuesStatus VenuesStatus - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if VenuesStatus is not NULL } // Scan implements the Scanner interface. diff --git a/examples/ondeck/postgresql/models.go b/examples/ondeck/postgresql/models.go index 9447f1970f..377115891b 100644 --- a/examples/ondeck/postgresql/models.go +++ b/examples/ondeck/postgresql/models.go @@ -33,7 +33,7 @@ func (e *Status) Scan(src interface{}) error { type NullStatus struct { Status Status - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Status is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/comment_on/postgresql/pgx/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/pgx/go/models.go index 371b6add83..d16ce77761 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/pgx/go/models.go @@ -32,7 +32,7 @@ func (e *FooMood) Scan(src interface{}) error { type NullFooMood struct { FooMood FooMood - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooMood is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go index 371b6add83..d16ce77761 100644 --- a/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/comment_on/postgresql/stdlib/go/models.go @@ -32,7 +32,7 @@ func (e *FooMood) Scan(src interface{}) error { type NullFooMood struct { FooMood FooMood - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooMood is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/go/models.go index 145eaf7d8a..e17be0b3fb 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/pgx/go/models.go @@ -31,7 +31,7 @@ func (e *Status) Scan(src interface{}) error { type NullStatus struct { Status Status - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Status is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go index 145eaf7d8a..e17be0b3fb 100644 --- a/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_add_value/postgresql/stdlib/go/models.go @@ -31,7 +31,7 @@ func (e *Status) Scan(src interface{}) error { type NullStatus struct { Status Status - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Status is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/go/models.go index 596c020bbc..7446d7461b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/pgx/go/models.go @@ -30,7 +30,7 @@ func (e *NewEvent) Scan(src interface{}) error { type NullNewEvent struct { NewEvent NewEvent - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if NewEvent is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go index 596c020bbc..7446d7461b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename/postgresql/stdlib/go/models.go @@ -30,7 +30,7 @@ func (e *NewEvent) Scan(src interface{}) error { type NullNewEvent struct { NewEvent NewEvent - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if NewEvent is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/go/models.go index 596c020bbc..7446d7461b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/pgx/go/models.go @@ -30,7 +30,7 @@ func (e *NewEvent) Scan(src interface{}) error { type NullNewEvent struct { NewEvent NewEvent - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if NewEvent is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go index 596c020bbc..7446d7461b 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_and_update_columns/postgresql/stdlib/go/models.go @@ -30,7 +30,7 @@ func (e *NewEvent) Scan(src interface{}) error { type NullNewEvent struct { NewEvent NewEvent - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if NewEvent is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/go/models.go index 879b523b1b..972377ce0e 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/pgx/go/models.go @@ -30,7 +30,7 @@ func (e *Status) Scan(src interface{}) error { type NullStatus struct { Status Status - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Status is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go index 879b523b1b..972377ce0e 100644 --- a/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_alter_type_rename_value/postgresql/stdlib/go/models.go @@ -30,7 +30,7 @@ func (e *Status) Scan(src interface{}) error { type NullStatus struct { Status Status - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Status is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/go/models.go index 00554aa36f..e3e582b2c8 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/pgx/go/models.go @@ -31,7 +31,7 @@ func (e *FooBat) Scan(src interface{}) error { type NullFooBat struct { FooBat FooBat - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooBat is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go index 00554aa36f..e3e582b2c8 100644 --- a/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_comment/postgresql/stdlib/go/models.go @@ -31,7 +31,7 @@ func (e *FooBat) Scan(src interface{}) error { type NullFooBat struct { FooBat FooBat - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooBat is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go index a09261aad7..4adee8ea11 100644 --- a/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/mysql/go/models.go @@ -40,7 +40,7 @@ func (e *FooDigit) Scan(src interface{}) error { type NullFooDigit struct { FooDigit FooDigit - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooDigit is not NULL } // Scan implements the Scanner interface. @@ -87,7 +87,7 @@ func (e *FooFoobar) Scan(src interface{}) error { type NullFooFoobar struct { FooFoobar FooFoobar - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooFoobar is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/go/models.go index 3eb2824c32..b838274a5f 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/pgx/go/models.go @@ -40,7 +40,7 @@ func (e *Digit) Scan(src interface{}) error { type NullDigit struct { Digit Digit - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Digit is not NULL } // Scan implements the Scanner interface. @@ -87,7 +87,7 @@ func (e *Foobar) Scan(src interface{}) error { type NullFoobar struct { Foobar Foobar - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Foobar is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go index 3eb2824c32..b838274a5f 100644 --- a/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/ddl_create_enum/postgresql/stdlib/go/models.go @@ -40,7 +40,7 @@ func (e *Digit) Scan(src interface{}) error { type NullDigit struct { Digit Digit - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Digit is not NULL } // Scan implements the Scanner interface. @@ -87,7 +87,7 @@ func (e *Foobar) Scan(src interface{}) error { type NullFoobar struct { Foobar Foobar - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Foobar is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go index 329c223192..62df94f4f5 100644 --- a/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go +++ b/internal/endtoend/testdata/emit_enum_valid_and_values/go/models.go @@ -31,7 +31,7 @@ func (e *IPProtocol) Scan(src interface{}) error { type NullIPProtocol struct { IPProtocol IPProtocol - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if IPProtocol is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/enum/mysql/go/models.go b/internal/endtoend/testdata/enum/mysql/go/models.go index 2d7c7af067..e415884d8c 100644 --- a/internal/endtoend/testdata/enum/mysql/go/models.go +++ b/internal/endtoend/testdata/enum/mysql/go/models.go @@ -34,7 +34,7 @@ func (e *UsersShirtSize) Scan(src interface{}) error { type NullUsersShirtSize struct { UsersShirtSize UsersShirtSize - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if UsersShirtSize is not NULL } // Scan implements the Scanner interface. @@ -79,7 +79,7 @@ func (e *UsersShoeSize) Scan(src interface{}) error { type NullUsersShoeSize struct { UsersShoeSize UsersShoeSize - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if UsersShoeSize is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/enum/postgresql/pgx/go/models.go b/internal/endtoend/testdata/enum/postgresql/pgx/go/models.go index eb67362c19..5e25cec0db 100644 --- a/internal/endtoend/testdata/enum/postgresql/pgx/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/pgx/go/models.go @@ -34,7 +34,7 @@ func (e *Size) Scan(src interface{}) error { type NullSize struct { Size Size - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Size is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go index eb67362c19..5e25cec0db 100644 --- a/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/enum/postgresql/stdlib/go/models.go @@ -34,7 +34,7 @@ func (e *Size) Scan(src interface{}) error { type NullSize struct { Size Size - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if Size is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/rename/pgx/go/models.go b/internal/endtoend/testdata/rename/pgx/go/models.go index 8e4228da78..3f0601c5af 100644 --- a/internal/endtoend/testdata/rename/pgx/go/models.go +++ b/internal/endtoend/testdata/rename/pgx/go/models.go @@ -31,7 +31,7 @@ func (e *IPProtocol) Scan(src interface{}) error { type NullIPProtocol struct { IPProtocol IPProtocol - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if IPProtocol is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/rename/stdlib/go/models.go b/internal/endtoend/testdata/rename/stdlib/go/models.go index 8e4228da78..3f0601c5af 100644 --- a/internal/endtoend/testdata/rename/stdlib/go/models.go +++ b/internal/endtoend/testdata/rename/stdlib/go/models.go @@ -31,7 +31,7 @@ func (e *IPProtocol) Scan(src interface{}) error { type NullIPProtocol struct { IPProtocol IPProtocol - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if IPProtocol is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/schema_scoped_enum/pgx/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/pgx/go/models.go index 1dcff193e2..e47f8bd203 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/pgx/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/pgx/go/models.go @@ -30,7 +30,7 @@ func (e *FooTypeUserRole) Scan(src interface{}) error { type NullFooTypeUserRole struct { FooTypeUserRole FooTypeUserRole - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooTypeUserRole is not NULL } // Scan implements the Scanner interface. diff --git a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go index 1dcff193e2..e47f8bd203 100644 --- a/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go +++ b/internal/endtoend/testdata/schema_scoped_enum/stdlib/go/models.go @@ -30,7 +30,7 @@ func (e *FooTypeUserRole) Scan(src interface{}) error { type NullFooTypeUserRole struct { FooTypeUserRole FooTypeUserRole - Valid bool // Valid is true if String is not NULL + Valid bool // Valid is true if FooTypeUserRole is not NULL } // Scan implements the Scanner interface.