Skip to content

Commit b98fe80

Browse files
committed
adding firstkey, lastkey, and keystep to redis_module & redis_command macros
1 parent f0427d8 commit b98fe80

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/macros.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#[macro_export]
22
macro_rules! redis_command {
3-
($ctx: expr, $command_name:expr, $command_handler:expr, $command_flags:expr) => {{
3+
($ctx:expr, $command_name:expr, $command_handler:expr, $command_flags:expr, $firstkey:expr, $lastkey:expr, $keystep:expr) => {{
44
let name = CString::new($command_name).unwrap();
55
let flags = CString::new($command_flags).unwrap();
6-
let (firstkey, lastkey, keystep) = (1, 1, 1);
6+
let firstkey: i32 = $firstkey;
7+
let lastkey: i32 = $lastkey;
8+
let keystep: i32 = $keystep;
79

810
/////////////////////
911
extern "C" fn do_command(
@@ -61,7 +63,10 @@ macro_rules! redis_module {
6163
$([
6264
$name:expr,
6365
$command:expr,
64-
$flags:expr
66+
$flags:expr,
67+
$firstkey:expr,
68+
$lastkey:expr,
69+
$keystep:expr
6570
]),* $(,)*
6671
] $(,)*
6772
) => {
@@ -112,7 +117,7 @@ macro_rules! redis_module {
112117
)*
113118

114119
$(
115-
redis_command!(ctx, $name, $command, $flags);
120+
redis_command!(ctx, $name, $command, $flags, $firstkey, $lastkey, $keystep);
116121
)*
117122

118123
raw::Status::Ok as c_int

0 commit comments

Comments
 (0)