@@ -116,6 +116,7 @@ type Cmdable interface {
116116 Restore (ctx context.Context , key string , ttl time.Duration , value string ) * StatusCmd
117117 RestoreReplace (ctx context.Context , key string , ttl time.Duration , value string ) * StatusCmd
118118 Sort (ctx context.Context , key string , sort * Sort ) * StringSliceCmd
119+ SortRO (ctx context.Context , key string , sort * Sort ) * StringSliceCmd
119120 SortStore (ctx context.Context , key , store string , sort * Sort ) * IntCmd
120121 SortInterfaces (ctx context.Context , key string , sort * Sort ) * SliceCmd
121122 Touch (ctx context.Context , keys ... string ) * IntCmd
@@ -710,8 +711,9 @@ type Sort struct {
710711 Alpha bool
711712}
712713
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+
715717 if sort .By != "" {
716718 args = append (args , "by" , sort .By )
717719 }
@@ -730,14 +732,20 @@ func (sort *Sort) args(key string) []interface{} {
730732 return args
731733}
732734
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+
733741func (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 )... )
735743 _ = c (ctx , cmd )
736744 return cmd
737745}
738746
739747func (c cmdable ) SortStore (ctx context.Context , key , store string , sort * Sort ) * IntCmd {
740- args := sort .args (key )
748+ args := sort .args ("sort" , key )
741749 if store != "" {
742750 args = append (args , "store" , store )
743751 }
@@ -747,7 +755,7 @@ func (c cmdable) SortStore(ctx context.Context, key, store string, sort *Sort) *
747755}
748756
749757func (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 )... )
751759 _ = c (ctx , cmd )
752760 return cmd
753761}
0 commit comments