@@ -24,7 +24,7 @@ func (t *TimeValue) ScanRedis(s string) (err error) {
24
24
return
25
25
}
26
26
27
- var _ = Describe ("Commands" , func () {
27
+ var _ = FDescribe ("Commands" , func () {
28
28
ctx := context .TODO ()
29
29
var client * redis.Client
30
30
@@ -2586,18 +2586,22 @@ var _ = Describe("Commands", func() {
2586
2586
Set4 string `redis:"set4,omitempty"`
2587
2587
Set5 time.Time `redis:"set5,omitempty"`
2588
2588
Set6 * numberStruct `redis:"set6,omitempty"`
2589
+ Set7 numberStruct `redis:"set7,omitempty"`
2589
2590
}
2590
2591
2591
2592
hSet = client .HSet (ctx , "hash3" , & setOmitEmpty {
2592
2593
Set1 : "val" ,
2593
2594
})
2594
2595
Expect (hSet .Err ()).NotTo (HaveOccurred ())
2595
- Expect (hSet .Val ()).To (Equal (int64 (1 )))
2596
+ // both set1 and set7 are set
2597
+ // custom struct is not omitted
2598
+ Expect (hSet .Val ()).To (Equal (int64 (2 )))
2596
2599
2597
2600
hGetAll := client .HGetAll (ctx , "hash3" )
2598
2601
Expect (hGetAll .Err ()).NotTo (HaveOccurred ())
2599
2602
Expect (hGetAll .Val ()).To (Equal (map [string ]string {
2600
2603
"set1" : "val" ,
2604
+ "set7" : `{"Number":0}` ,
2601
2605
}))
2602
2606
var hash3 setOmitEmpty
2603
2607
Expect (hGetAll .Scan (& hash3 )).NotTo (HaveOccurred ())
@@ -2607,6 +2611,7 @@ var _ = Describe("Commands", func() {
2607
2611
Expect (hash3 .Set4 ).To (Equal ("" ))
2608
2612
Expect (hash3 .Set5 ).To (Equal (time.Time {}))
2609
2613
Expect (hash3 .Set6 ).To (BeNil ())
2614
+ Expect (hash3 .Set7 ).To (Equal (numberStruct {}))
2610
2615
2611
2616
now := time .Now ()
2612
2617
hSet = client .HSet (ctx , "hash4" , setOmitEmpty {
@@ -2615,16 +2620,20 @@ var _ = Describe("Commands", func() {
2615
2620
Set6 : & numberStruct {
2616
2621
Number : 5 ,
2617
2622
},
2623
+ Set7 : numberStruct {
2624
+ Number : 3 ,
2625
+ },
2618
2626
})
2619
2627
Expect (hSet .Err ()).NotTo (HaveOccurred ())
2620
- Expect (hSet .Val ()).To (Equal (int64 (3 )))
2628
+ Expect (hSet .Val ()).To (Equal (int64 (4 )))
2621
2629
2622
2630
hGetAll = client .HGetAll (ctx , "hash4" )
2623
2631
Expect (hGetAll .Err ()).NotTo (HaveOccurred ())
2624
2632
Expect (hGetAll .Val ()).To (Equal (map [string ]string {
2625
2633
"set1" : "val" ,
2626
2634
"set5" : now .Format (time .RFC3339Nano ),
2627
2635
"set6" : `{"Number":5}` ,
2636
+ "set7" : `{"Number":3}` ,
2628
2637
}))
2629
2638
})
2630
2639
@@ -7667,7 +7676,7 @@ type numberStruct struct {
7667
7676
Number int
7668
7677
}
7669
7678
7670
- func (n * numberStruct ) MarshalBinary () ([]byte , error ) {
7679
+ func (n numberStruct ) MarshalBinary () ([]byte , error ) {
7671
7680
return json .Marshal (n )
7672
7681
}
7673
7682
0 commit comments