Skip to content

Commit

Permalink
Decode []uint8 for Number as well
Browse files Browse the repository at this point in the history
  • Loading branch information
af-afk committed Dec 18, 2024
1 parent d6e9dca commit 6eb0c7f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ func (int *Number) Scan(v interface{}) error {
case uint64:
n := NumberFromUint64(c)
*int = n
case []uint8:
// Assume this is a string that's encoded this way for some reason.
int_, err := NumberFromBase10(string(v.([]uint8)))
if err != nil {
return fmt.Errorf(
"failed to scan uint8[]! %v",
err,
)
}
*int = *int_
default:
return fmt.Errorf(
"failed to scan type %T content %v into the Number type!",
Expand Down

0 comments on commit 6eb0c7f

Please sign in to comment.