Skip to content

fix(postgres): Handling of the decimal column in the build query #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2024
Merged
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: 7 additions & 0 deletions internal/core/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ func jdbcGet(t ktType, idx int) string {
}
return fmt.Sprintf(`results.getObject(%d) as%s %s`, idx, nullCast, t.Name)
}
if t.IsBigDecimal() {
return fmt.Sprintf(`results.getBigDecimal(%d)`, idx)
}
return fmt.Sprintf(`results.get%s(%d)`, t.Name, idx)
}

Expand Down Expand Up @@ -364,6 +367,10 @@ func (t ktType) IsUUID() bool {
return t.Name == "UUID"
}

func (t ktType) IsBigDecimal() bool {
return t.Name == "java.math.BigDecimal"
}

func makeType(req *plugin.GenerateRequest, col *plugin.Column) ktType {
typ, isEnum := ktInnerType(req, col)
return ktType{
Expand Down