Skip to content

Commit bda7b2b

Browse files
committed
fix: NPE when setting null value as enum
1 parent ca01ba2 commit bda7b2b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ You should ensure that the `sha256` value in your `sqlc.yaml` is correct for thi
6262

6363
## Planned Features
6464

65-
- `MySQL` support
6665
- `SQLite` support
6766
- Improved parameter naming
6867

6968
**Tentative:**
7069

7170
- r2dbc support
72-
- Support for PostgreSQL enum types
7371
- copyfrom support where possible [ref](https://www.baeldung.com/jdbc-batch-processing)

internal/core/models.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ func (q QueryArg) BindStmt() string {
9696
}
9797

9898
if q.JavaType.IsEnum {
99+
if q.JavaType.IsNullable {
100+
return fmt.Sprintf("stmt.setString(%d, %s == null ? null : %s.getValue());", q.Number, q.Name, q.Name)
101+
}
99102
return fmt.Sprintf("stmt.setString(%d, %s.getValue());", q.Number, q.Name)
100103
}
101104

0 commit comments

Comments
 (0)