mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
fix: nil pointer dereferencing in writeArg (#3271)
* fixed bug with nil dereferencing in writeArg, added hset struct example, added tests * removed password from example * added omitempty * reverted xxhash versioning * reverted xxhash versioning * removed password * removed password --------- Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
This commit is contained in:
@ -11,9 +11,12 @@ import (
|
||||
type Model struct {
|
||||
Str1 string `redis:"str1"`
|
||||
Str2 string `redis:"str2"`
|
||||
Str3 *string `redis:"str3"`
|
||||
Bytes []byte `redis:"bytes"`
|
||||
Int int `redis:"int"`
|
||||
Int2 *int `redis:"int2"`
|
||||
Bool bool `redis:"bool"`
|
||||
Bool2 *bool `redis:"bool2"`
|
||||
Ignored struct{} `redis:"-"`
|
||||
}
|
||||
|
||||
@ -29,8 +32,11 @@ func main() {
|
||||
if _, err := rdb.Pipelined(ctx, func(rdb redis.Pipeliner) error {
|
||||
rdb.HSet(ctx, "key", "str1", "hello")
|
||||
rdb.HSet(ctx, "key", "str2", "world")
|
||||
rdb.HSet(ctx, "key", "str3", "")
|
||||
rdb.HSet(ctx, "key", "int", 123)
|
||||
rdb.HSet(ctx, "key", "int2", 0)
|
||||
rdb.HSet(ctx, "key", "bool", 1)
|
||||
rdb.HSet(ctx, "key", "bool2", 0)
|
||||
rdb.HSet(ctx, "key", "bytes", []byte("this is bytes !"))
|
||||
return nil
|
||||
}); err != nil {
|
||||
|
Reference in New Issue
Block a user