Skip to content

Commit 745fbf2

Browse files
committed
fix: add bytes in scan struct example
Signed-off-by: rfyiamcool <[email protected]>
1 parent 0d70f60 commit 745fbf2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

example/scan-struct/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
type Model struct {
1212
Str1 string `redis:"str1"`
1313
Str2 string `redis:"str2"`
14-
Bytes1 []byte `redis:"bytes1"`
14+
Bytes []byte `redis:"bytes"`
1515
Int int `redis:"int"`
1616
Bool bool `redis:"bool"`
1717
Ignored struct{} `redis:"-"`
@@ -31,7 +31,7 @@ func main() {
3131
rdb.HSet(ctx, "key", "str2", "world")
3232
rdb.HSet(ctx, "key", "int", 123)
3333
rdb.HSet(ctx, "key", "bool", 1)
34-
rdb.HSet(ctx, "key", "bytes1", []byte("this is bytes !"))
34+
rdb.HSet(ctx, "key", "bytes", []byte("this is bytes !"))
3535
return nil
3636
}); err != nil {
3737
panic(err)
@@ -54,7 +54,7 @@ func main() {
5454
// (main.Model) {
5555
// Str1: (string) (len=5) "hello",
5656
// Str2: (string) (len=5) "world",
57-
// Bytes1: ([]uint8) (len=15 cap=16) {
57+
// Bytes: ([]uint8) (len=15 cap=16) {
5858
// 00000000 74 68 69 73 20 69 73 20 62 79 74 65 73 20 21 |this is bytes !|
5959
// },
6060
// Int: (int) 123,
@@ -68,11 +68,10 @@ func main() {
6868
// (main.Model) {
6969
// Str1: (string) (len=5) "hello",
7070
// Str2: (string) "",
71-
// Bytes1: ([]uint8) <nil>,
71+
// Bytes: ([]uint8) <nil>,
7272
// Int: (int) 123,
7373
// Bool: (bool) false,
7474
// Ignored: (struct {}) {
7575
// }
7676
// }
77-
7877
}

0 commit comments

Comments
 (0)