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
Currently for values its accepting '[]any' for
'rueidiscompat.Cmdable.HSet(ctx context.Context, key string, values ...any) '
It should accept input in form of map[string]interface{} , as most of the developers have their values in the form of structs.
Developers can marshal and then unmarshal it to convert their structure into map, no need to convert it into []any.
eg.
``
type CustInfo struct {
CustomerID string json:"customer_id"
Name string `json:"name"`
}
using json.marshal and json.unmarshal we can easily convert it into map and pass it in
rueidiscompat.Cmdable.HSetV1(ctx context.Context, key string, values map[string]interface{})
``
The text was updated successfully, but these errors were encountered:
Thank you for the proposal. But map[string]interface{} is too loose for HSET. Remember that HSET can't accept nested structures in one field. So, json.Marshal is also inappropriate for HSET. Use JSON.SET instead.
In terms of performance, IMO, the FieldValueIter by #625 is the best way to use HSET without additional intermediate map/slice allocation.
By the way, I think we already made rueidiscompat.Cmdable.HSet compatible with go-redis, that you can already put a single map[string]interface{} without nested structures and it will turn the map into arguments slice.
Currently for values its accepting '[]any' for
'rueidiscompat.Cmdable.HSet(ctx context.Context, key string, values ...any) '
It should accept input in form of
map[string]interface{}
, as most of the developers have their values in the form of structs.Developers can marshal and then unmarshal it to convert their structure into map, no need to convert it into []any.
eg.
``
type CustInfo struct {
CustomerID string
json:"customer_id"
Name string `json:"name"`
}
using json.marshal and json.unmarshal we can easily convert it into map and pass it in
rueidiscompat.Cmdable.HSetV1(ctx context.Context, key string, values map[string]interface{})
``
The text was updated successfully, but these errors were encountered: