You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can use UUID type for storing structs in hash tables
Current Behavior
Got invalid UUID length: 16 error from (uuid *UUID) UnmarshalText
Possible Solution
Add encoding.BinaryUnmarshaler to switch case at /internal/hscan/structmap.go:107
Steps to Reproduce
Create structure with UUID field
Set it to hash table with HSet()
Get it back with HGetAll()
Try to write given map[string]string to structure with Scan()
Detailed Description
I am facing a problem related to hash tables. I want to store objects in it, so I use HSet. Then encoding.BinaryMarshaler is used to marshal the UUID, but when I try to get the object back using Scan(), encoding.TextUnmarshaler is used instead of encoding.BinaryUnmarshaler to unmarshal it.
This is a incorrect use of these interfaces. As it is written in the description of these interfaces
UnmarshalBinary must be able to decode the form generated by MarshalBinary
And
UnmarshalText must be able to decode the form generated by MarshalText
They are not interchangeable and Binary should be used with Binary and Text with Text
The text was updated successfully, but these errors were encountered:
Expected Behavior
Can use UUID type for storing structs in hash tables
Current Behavior
Got
invalid UUID length: 16
error from (uuid *UUID) UnmarshalTextPossible Solution
Add
encoding.BinaryUnmarshaler
to switch case at/internal/hscan/structmap.go:107
Steps to Reproduce
Detailed Description
I am facing a problem related to hash tables. I want to store objects in it, so I use HSet. Then
encoding.BinaryMarshaler
is used to marshal the UUID, but when I try to get the object back using Scan(),encoding.TextUnmarshaler
is used instead ofencoding.BinaryUnmarshaler
to unmarshal it.This is a incorrect use of these interfaces. As it is written in the description of these interfaces
And
They are not interchangeable and Binary should be used with Binary and Text with Text
The text was updated successfully, but these errors were encountered: