I'm getting data from the redis.HGetAll but found no clean way to convert results into my Struct.
var object struct {
x int
}
result := redisClient.HGetAll(context.Background(), "the_h_key")
//TODO import the result content into the object
Is there any function for this spectacular case?
I'm using the JSON package(marshal, then UnMarshal to a struct).
The result from Redis is a map[string]string. For each field in the struct, get the value from the map, convert the string to the field type and assign to the field.