redis_event/cmd/
server.rs1use std::slice::Iter;
10
11#[derive(Debug)]
12pub struct FLUSHDB {
13 pub _async: Option<bool>,
14}
15
16pub(crate) fn parse_flushdb(mut iter: Iter<Vec<u8>>) -> FLUSHDB {
17 let mut _async = None;
18 if let Some(next_arg) = iter.next() {
19 let arg_upper = String::from_utf8_lossy(next_arg).to_uppercase();
20 if &arg_upper == "ASYNC" {
21 _async = Some(true);
22 } else {
23 panic!("Invalid argument")
24 }
25 }
26 FLUSHDB { _async }
27}
28
29#[derive(Debug)]
30pub struct FLUSHALL {
31 pub _async: Option<bool>,
32}
33
34pub(crate) fn parse_flushall(mut iter: Iter<Vec<u8>>) -> FLUSHALL {
35 let mut _async = None;
36 if let Some(next_arg) = iter.next() {
37 let arg_upper = String::from_utf8_lossy(next_arg).to_uppercase();
38 if &arg_upper == "ASYNC" {
39 _async = Some(true);
40 } else {
41 panic!("Invalid argument")
42 }
43 }
44 FLUSHALL { _async }
45}