From 6eb0c7f1cf74e3bd9bed7da88e9f08f0d14b9916 Mon Sep 17 00:00:00 2001 From: bayge Date: Wed, 18 Dec 2024 12:58:38 +1030 Subject: [PATCH] Decode []uint8 for Number as well --- lib/types/types.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/types/types.go b/lib/types/types.go index dfe81b27..36532b37 100644 --- a/lib/types/types.go +++ b/lib/types/types.go @@ -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!",