@@ -497,6 +497,8 @@ type Cmdable interface {
497
497
GeoHash (ctx context.Context , key string , members ... string ) * StringSliceCmd
498
498
499
499
ACLDryRun (ctx context.Context , username string , command ... interface {}) * StringCmd
500
+
501
+ ModuleLoadex (ctx context.Context , conf * ModuleLoadexConfig ) * StringCmd
500
502
}
501
503
502
504
type StatefulCmdable interface {
@@ -3888,3 +3890,32 @@ func (c cmdable) ACLDryRun(ctx context.Context, username string, command ...inte
3888
3890
_ = c (ctx , cmd )
3889
3891
return cmd
3890
3892
}
3893
+
3894
+ // ModuleLoadexConfig struct is used to specify the arguments for the MODULE LOADEX command of redis.
3895
+ // `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ...]]`
3896
+ type ModuleLoadexConfig struct {
3897
+ Path string
3898
+ Conf map [string ]interface {}
3899
+ Args []interface {}
3900
+ }
3901
+
3902
+ func (c * ModuleLoadexConfig ) toArgs () []interface {} {
3903
+ args := make ([]interface {}, 3 , 3 + len (c .Conf )* 3 + len (c .Args )* 2 )
3904
+ args [0 ] = "MODULE"
3905
+ args [1 ] = "LOADEX"
3906
+ args [2 ] = c .Path
3907
+ for k , v := range c .Conf {
3908
+ args = append (args , "CONFIG" , k , v )
3909
+ }
3910
+ for _ , arg := range c .Args {
3911
+ args = append (args , "ARGS" , arg )
3912
+ }
3913
+ return args
3914
+ }
3915
+
3916
+ // ModuleLoadex Redis `MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ...]]` command.
3917
+ func (c cmdable ) ModuleLoadex (ctx context.Context , conf * ModuleLoadexConfig ) * StringCmd {
3918
+ cmd := NewStringCmd (ctx , conf .toArgs ()... )
3919
+ _ = c (ctx , cmd )
3920
+ return cmd
3921
+ }
0 commit comments