mirror of https://github.com/go-redis/redis.git
fix: test code
This commit is contained in:
parent
07e15d2876
commit
1fdcbf86bb
|
@ -198,13 +198,15 @@ func ExampleClient_SetEX() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleClient_HSet() {
|
func ExampleClient_HSet() {
|
||||||
type Items struct {
|
// Set "key" tag for hash key
|
||||||
Key1 string `json:"key1"`
|
type ExampleUser struct {
|
||||||
Key2 string `json:"key2"`
|
Name string `key:"name"`
|
||||||
|
Age int `key:"age"`
|
||||||
}
|
}
|
||||||
items := Items{"field1", "field2"}
|
|
||||||
|
|
||||||
err := rdb.HSet(ctx, "key", items).Err()
|
items := ExampleUser{"jane", 22}
|
||||||
|
|
||||||
|
err := rdb.HSet(ctx, "user:1", items).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue