Skip to content
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

Enable fix float point 2 decimal place #3018

Open
aqibabas3 opened this issue Apr 26, 2024 · 0 comments
Open

Enable fix float point 2 decimal place #3018

aqibabas3 opened this issue Apr 26, 2024 · 0 comments

Comments

@aqibabas3
Copy link

What happened?

If the type is of type Float or Decimal (custom from https://github.com/shopspring/decimal) and the value have trailing zero, it will not show the trailing zero.
Eg 191.80 is showing as 191.8

What did you expect?

191.80 Supposed to show 191.80

Minimal graphql.schema and models to reproduce

even when implementing MarshalGQL (for decimal) doesnt work.

func (y Decimal) MarshalGQL(w io.Writer) {
fmt.Fprintf(w, decimal.Decimal(y).StringFixed(2))
}

versions

  • go run github.com/99designs/gqlgen version?
    v0.17.45
  • go version?
    1.21.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant