-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add hstrlen command for hash #2843
base: master
Are you sure you want to change the base?
feat: add hstrlen command for hash #2843
Conversation
9bfbda2
to
dd41c7d
Compare
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
dd41c7d
to
47591c8
Compare
@@ -172,3 +173,9 @@ func (c cmdable) HScan(ctx context.Context, key string, cursor uint64, match str | |||
_ = c(ctx, cmd) | |||
return cmd | |||
} | |||
|
|||
func (c cmdable) HStrLen(ctx context.Context, key, field string) *IntCmd { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe changing the type of field to interface{}
?
To enhance flexibility by supporting multiple data types and simplifying API usage across different caller scenario.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found type of field
in hash commands is string type, so I need to be consistent with the other hash commands ? 😁
// hash_commands.go:5
type HashCmdable interface {
HDel(ctx context.Context, key string, fields ...string) *IntCmd
HExists(ctx context.Context, key, field string) *BoolCmd
HGet(ctx context.Context, key, field string) *StringCmd
HIncrBy(ctx context.Context, key, field string, incr int64) *IntCmd
HIncrByFloat(ctx context.Context, key, field string, incr float64) *FloatCmd
HMGet(ctx context.Context, key string, fields ...string) *SliceCmd
HSet(ctx context.Context, key string, values ...interface{}) *IntCmd
HMSet(ctx context.Context, key string, values ...interface{}) *BoolCmd
HSetNX(ctx context.Context, key, field string, value interface{}) *BoolCmd
HScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd
HVals(ctx context.Context, key string) *StringSliceCmd
HRandField(ctx context.Context, key string, count int) *StringSliceCmd
HRandFieldWithValues(ctx context.Context, key string, count int) *KeyValueSliceCmd
HStrLen(ctx context.Context, key, field string) *IntCmd
}
summary
Add
HSTRLEN
command for HASH.https://redis.io/commands/hstrlen/