@@ -238,7 +238,7 @@ type Cmdable interface {
238238 BitOpNot (ctx context.Context , destKey string , key string ) * IntCmd
239239 BitPos (ctx context.Context , key string , bit int64 , pos ... int64 ) * IntCmd
240240 BitPosSpan (ctx context.Context , key string , bit int8 , start , end int64 , span string ) * IntCmd
241- BitField (ctx context.Context , key string , args ... interface {}) * IntSliceCmd
241+ BitField (ctx context.Context , key string , values ... interface {}) * IntSliceCmd
242242
243243 Scan (ctx context.Context , cursor uint64 , match string , count int64 ) * ScanCmd
244244 ScanType (ctx context.Context , cursor uint64 , match string , count int64 , keyType string ) * ScanCmd
@@ -1369,12 +1369,16 @@ func (c cmdable) BitPosSpan(ctx context.Context, key string, bit int8, start, en
13691369 return cmd
13701370}
13711371
1372- func (c cmdable ) BitField (ctx context.Context , key string , args ... interface {}) * IntSliceCmd {
1373- a := make ([]interface {}, 0 , 2 + len (args ))
1374- a = append (a , "bitfield" )
1375- a = append (a , key )
1376- a = append (a , args ... )
1377- cmd := NewIntSliceCmd (ctx , a ... )
1372+ // BitField accepts multiple values:
1373+ // - BitField("set", "i1", "offset1", "value1","cmd2", "type2", "offset2", "value2")
1374+ // - BitField([]string{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
1375+ // - BitField([]interface{}{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
1376+ func (c cmdable ) BitField (ctx context.Context , key string , values ... interface {}) * IntSliceCmd {
1377+ args := make ([]interface {}, 2 , 2 + len (values ))
1378+ args [0 ] = "bitfield"
1379+ args [1 ] = key
1380+ args = appendArgs (args , values )
1381+ cmd := NewIntSliceCmd (ctx , args ... )
13781382 _ = c (ctx , cmd )
13791383 return cmd
13801384}
0 commit comments