mirror of
https://github.com/redis/go-redis.git
synced 2025-04-17 20:17:02 +03:00
fix: test code
This commit is contained in:
parent
07e15d2876
commit
1fdcbf86bb
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user