#[non_exhaustive]pub enum DeleteMode {
Unlink,
DryRun,
}Expand description
Whether delete-prefix deletes what it finds or only counts it.
use kevy_cli::bulk::DeleteMode;
// `delete-prefix --dry-run`
assert_ne!(DeleteMode::DryRun, DeleteMode::default());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unlink
UNLINK every key found.
use kevy_cli::bulk::{DeleteMode, run_delete_prefix};
let mut client = kevy_resp_client::RespClient::connect("127.0.0.1", port)?;
client.request_borrowed(&[b"SET", b"tmp:a", b"1"])?;
assert_eq!(run_delete_prefix(&mut client, b"tmp:", 0, DeleteMode::Unlink)?, 1);
let left = client.request_borrowed(&[b"EXISTS", b"tmp:a"])?;
assert_eq!(left, kevy_resp_client::Reply::Int(0));DryRun
Count the keys that would be deleted and touch nothing
(--dry-run).
use kevy_cli::bulk::{DeleteMode, run_delete_prefix};
let mut client = kevy_resp_client::RespClient::connect("127.0.0.1", port)?;
client.request_borrowed(&[b"SET", b"tmp:a", b"1"])?;
assert_eq!(run_delete_prefix(&mut client, b"tmp:", 0, DeleteMode::DryRun)?, 1);
let left = client.request_borrowed(&[b"EXISTS", b"tmp:a"])?;
assert_eq!(left, kevy_resp_client::Reply::Int(1), "a dry run touches nothing");Trait Implementations§
Source§impl Clone for DeleteMode
impl Clone for DeleteMode
impl Copy for DeleteMode
Source§impl Debug for DeleteMode
impl Debug for DeleteMode
Source§impl Default for DeleteMode
impl Default for DeleteMode
impl Eq for DeleteMode
Source§impl Hash for DeleteMode
impl Hash for DeleteMode
Source§impl PartialEq for DeleteMode
impl PartialEq for DeleteMode
impl StructuralPartialEq for DeleteMode
Auto Trait Implementations§
impl Freeze for DeleteMode
impl RefUnwindSafe for DeleteMode
impl Send for DeleteMode
impl Sync for DeleteMode
impl Unpin for DeleteMode
impl UnsafeUnpin for DeleteMode
impl UnwindSafe for DeleteMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more