Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/codegen/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ type nullableHelper struct {
ArgType string
}

func (b *IndentStringBuilder) writeNullableHelpers(nullableHelpers core.NullableHelpers, nonNullAnnotation, nullableAnnotation string) {
func (b *IndentStringBuilder) writeNullableHelpers(nullableHelpers core.NullableHelpers, nonNullAnnotation, nullableAnnotation string) []string {
imports := make([]string, 0)
methodTypes := []nullableHelper{
{nullableHelpers.Int, "Integer", "Int"},
{nullableHelpers.Long, "Long", "Long"},
Expand Down Expand Up @@ -77,7 +78,11 @@ func (b *IndentStringBuilder) writeNullableHelpers(nullableHelpers core.Nullable
))
b.WriteIndentedString(2, "var colVal = rs.getArray(col); return colVal == null ? null : Arrays.asList(as.cast(colVal.getArray()));\n")
b.WriteIndentedString(1, "}\n")

imports = append(imports, "java.util.List")
}

return imports
}

func (b *IndentStringBuilder) writeParameter(javaType core.JavaType, name, nonNullAnnotation, nullableAnnotation string) ([]string, error) {
Expand Down
4 changes: 3 additions & 1 deletion internal/codegen/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ func BuildQueriesFile(engine string, config core.Config, queryFilename string, q

// boilerplate methods to allow for getting null primitive values
body.WriteString("\n")
body.writeNullableHelpers(nullableHelpers, nonNullAnnotation, nullableAnnotation)

imp := body.writeNullableHelpers(nullableHelpers, nonNullAnnotation, nullableAnnotation)
imports = append(imports, imp...)

for _, q := range queries {
body.WriteString("\n")
Expand Down
Loading