fix: test code

This commit is contained in:
Bogus Jung 2022-04-28 20:32:58 +09:00
parent 07e15d2876
commit 1fdcbf86bb
1 changed files with 8 additions and 6 deletions

View File

@ -198,13 +198,15 @@ func ExampleClient_SetEX() {
}
func ExampleClient_HSet() {
type Items struct {
Key1 string `json:"key1"`
Key2 string `json:"key2"`
// Set "key" tag for hash key
type ExampleUser struct {
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 {
panic(err)
}