@@ -116,6 +116,7 @@ type Cmdable interface {
116
116
Restore (ctx context.Context , key string , ttl time.Duration , value string ) * StatusCmd
117
117
RestoreReplace (ctx context.Context , key string , ttl time.Duration , value string ) * StatusCmd
118
118
Sort (ctx context.Context , key string , sort * Sort ) * StringSliceCmd
119
+ SortRO (ctx context.Context , key string , sort * Sort ) * StringSliceCmd
119
120
SortStore (ctx context.Context , key , store string , sort * Sort ) * IntCmd
120
121
SortInterfaces (ctx context.Context , key string , sort * Sort ) * SliceCmd
121
122
Touch (ctx context.Context , keys ... string ) * IntCmd
@@ -710,8 +711,9 @@ type Sort struct {
710
711
Alpha bool
711
712
}
712
713
713
- func (sort * Sort ) args (key string ) []interface {} {
714
- args := []interface {}{"sort" , key }
714
+ func (sort * Sort ) args (command , key string ) []interface {} {
715
+ args := []interface {}{command , key }
716
+
715
717
if sort .By != "" {
716
718
args = append (args , "by" , sort .By )
717
719
}
@@ -730,14 +732,20 @@ func (sort *Sort) args(key string) []interface{} {
730
732
return args
731
733
}
732
734
735
+ func (c cmdable ) SortRO (ctx context.Context , key string , sort * Sort ) * StringSliceCmd {
736
+ cmd := NewStringSliceCmd (ctx , sort .args ("sort_ro" , key )... )
737
+ _ = c (ctx , cmd )
738
+ return cmd
739
+ }
740
+
733
741
func (c cmdable ) Sort (ctx context.Context , key string , sort * Sort ) * StringSliceCmd {
734
- cmd := NewStringSliceCmd (ctx , sort .args (key )... )
742
+ cmd := NewStringSliceCmd (ctx , sort .args ("sort" , key )... )
735
743
_ = c (ctx , cmd )
736
744
return cmd
737
745
}
738
746
739
747
func (c cmdable ) SortStore (ctx context.Context , key , store string , sort * Sort ) * IntCmd {
740
- args := sort .args (key )
748
+ args := sort .args ("sort" , key )
741
749
if store != "" {
742
750
args = append (args , "store" , store )
743
751
}
@@ -747,7 +755,7 @@ func (c cmdable) SortStore(ctx context.Context, key, store string, sort *Sort) *
747
755
}
748
756
749
757
func (c cmdable ) SortInterfaces (ctx context.Context , key string , sort * Sort ) * SliceCmd {
750
- cmd := NewSliceCmd (ctx , sort .args (key )... )
758
+ cmd := NewSliceCmd (ctx , sort .args ("sort" , key )... )
751
759
_ = c (ctx , cmd )
752
760
return cmd
753
761
}
0 commit comments