From 1fdcbf86bbb390e4e689a35a391a4a4b3917216d Mon Sep 17 00:00:00 2001 From: Bogus Jung Date: Thu, 28 Apr 2022 20:32:58 +0900 Subject: [PATCH] fix: test code --- example_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/example_test.go b/example_test.go index e696fdfe..8b32e79e 100644 --- a/example_test.go +++ b/example_test.go @@ -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) }