@@ -24,7 +24,7 @@ func (t *TimeValue) ScanRedis(s string) (err error) {
2424 return
2525}
2626
27- var _ = Describe ("Commands" , func () {
27+ var _ = FDescribe ("Commands" , func () {
2828 ctx := context .TODO ()
2929 var client * redis.Client
3030
@@ -2586,18 +2586,22 @@ var _ = Describe("Commands", func() {
25862586 Set4 string `redis:"set4,omitempty"`
25872587 Set5 time.Time `redis:"set5,omitempty"`
25882588 Set6 * numberStruct `redis:"set6,omitempty"`
2589+ Set7 numberStruct `redis:"set7,omitempty"`
25892590 }
25902591
25912592 hSet = client .HSet (ctx , "hash3" , & setOmitEmpty {
25922593 Set1 : "val" ,
25932594 })
25942595 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 )))
25962599
25972600 hGetAll := client .HGetAll (ctx , "hash3" )
25982601 Expect (hGetAll .Err ()).NotTo (HaveOccurred ())
25992602 Expect (hGetAll .Val ()).To (Equal (map [string ]string {
26002603 "set1" : "val" ,
2604+ "set7" : `{"Number":0}` ,
26012605 }))
26022606 var hash3 setOmitEmpty
26032607 Expect (hGetAll .Scan (& hash3 )).NotTo (HaveOccurred ())
@@ -2607,6 +2611,7 @@ var _ = Describe("Commands", func() {
26072611 Expect (hash3 .Set4 ).To (Equal ("" ))
26082612 Expect (hash3 .Set5 ).To (Equal (time.Time {}))
26092613 Expect (hash3 .Set6 ).To (BeNil ())
2614+ Expect (hash3 .Set7 ).To (Equal (numberStruct {}))
26102615
26112616 now := time .Now ()
26122617 hSet = client .HSet (ctx , "hash4" , setOmitEmpty {
@@ -2615,16 +2620,20 @@ var _ = Describe("Commands", func() {
26152620 Set6 : & numberStruct {
26162621 Number : 5 ,
26172622 },
2623+ Set7 : numberStruct {
2624+ Number : 3 ,
2625+ },
26182626 })
26192627 Expect (hSet .Err ()).NotTo (HaveOccurred ())
2620- Expect (hSet .Val ()).To (Equal (int64 (3 )))
2628+ Expect (hSet .Val ()).To (Equal (int64 (4 )))
26212629
26222630 hGetAll = client .HGetAll (ctx , "hash4" )
26232631 Expect (hGetAll .Err ()).NotTo (HaveOccurred ())
26242632 Expect (hGetAll .Val ()).To (Equal (map [string ]string {
26252633 "set1" : "val" ,
26262634 "set5" : now .Format (time .RFC3339Nano ),
26272635 "set6" : `{"Number":5}` ,
2636+ "set7" : `{"Number":3}` ,
26282637 }))
26292638 })
26302639
@@ -7667,7 +7676,7 @@ type numberStruct struct {
76677676 Number int
76687677}
76697678
7670- func (n * numberStruct ) MarshalBinary () ([]byte , error ) {
7679+ func (n numberStruct ) MarshalBinary () ([]byte , error ) {
76717680 return json .Marshal (n )
76727681}
76737682
0 commit comments