• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

99designs / gqlgen / 17465290901

04 Sep 2025 01:22PM UTC coverage: 72.621% (-0.1%) from 72.728%
17465290901

push

github

web-flow
Add Support For All SIgned and Unsigned Integers (#3787)

* feat(int): add support for all signed integers

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* feat(uint): add support for all unsigned integer types

uint, uint8, uint16, uint32, uint64

* style: fix unnecessary conversion

* fix(int): Potential overflow when casting uint64 to int64.

If v > math.MaxInt64 the cast silently wraps around, turning a large positive value into a negative one and slipping past the size-checks in safeCastSignedNumber, yielding incorrect results instead of a deterministic overflow error.

* fix(uint): wrong max constants for signed branches.

safeCastUnsignedNumber treats "int8"/"int16"/"int32" the same as their unsigned counterparts and compares against math.MaxUint*.
Casting a value 200 into int8 passes the check (200 ≤ 255) and returns int8(200) which is -56 after wrap-around.

* fix: group cases in switch statement

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* test: remove unnecessary tests cases

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* test: add benchmark tests for UnmarshalUint and UnmarshalInt

These are the results from my local setup:
goos: linux
goarch: amd64
pkg: github.com/99designs/gqlgen/graphql
cpu: AMD Ryzen 7 7735HS with Radeon Graphics
BenchmarkUnmarshalIntInitial-16        62162     19745 ns/op
BenchmarkUnmarshalIntNew-16            53192     22884 ns/op
BenchmarkUnmarshalUintInitial-16       18339     67228 ns/op
BenchmarkUnmarshalUintNew-16           54229     22213 ns/op
PASS
ok  github.com/99designs/gqlgen/graphql6.208s

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

---------

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

112 of 122 new or added lines in 2 files covered. (91.8%)

32 existing lines in 4 files now uncovered.

8814 of 12137 relevant lines covered (72.62%)

743.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.0
/graphql/int.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc