feat: add flush bucket and flush object commands
BREAKING CHANGES: push, query and suggestion commands with optional variables now haven't option arguments in methods
This commit is contained in:
parent
b73bddf7fc
commit
54e82f78d7
2 changed files with 19 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "sonic-channel"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"]
|
||||
description = "Rust client for sonic search backend"
|
||||
categories = ["api-bindings"]
|
||||
|
@ -16,13 +16,13 @@ readme = "README.md"
|
|||
|
||||
[dependencies]
|
||||
lazy_static = "1.4.0"
|
||||
regex = "1.3.4"
|
||||
regex = { version = "1.3.4", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["search"]
|
||||
|
||||
ingest = []
|
||||
search = []
|
||||
ingest = ["regex"]
|
||||
search = ["regex"]
|
||||
control = []
|
||||
|
||||
|
||||
|
|
|
@ -14,22 +14,27 @@ macro_rules! init_commands {
|
|||
$(
|
||||
use $cmd_name:ident
|
||||
for fn $fn_name:ident
|
||||
$(<$($lt:lifetime)+>)?
|
||||
($($args:tt)*)
|
||||
;
|
||||
$(<$($lt:lifetime)+>)? (
|
||||
$($args:tt)*
|
||||
);
|
||||
)*
|
||||
) => {
|
||||
$(init_commands!(use $cmd_name for fn $fn_name $(<$($lt)+>)? ($($args)*));)*
|
||||
};
|
||||
|
||||
(use $cmd_name:ident for fn $fn_name:ident $(<$($lt:lifetime)+>)? ($($arg_name:ident : $arg_type:ty,)*)) => {
|
||||
(
|
||||
use $cmd_name:ident
|
||||
for fn $fn_name:ident $(<$($lt:lifetime)+>)? (
|
||||
$($arg_name:ident : $arg_type:ty $( => $arg_value:expr)?,)*
|
||||
)
|
||||
) => {
|
||||
pub fn $fn_name $(<$($lt)+>)? (
|
||||
&self,
|
||||
$($arg_name: $arg_type),*
|
||||
) -> crate::result::Result<
|
||||
<$cmd_name as crate::commands::StreamCommand>::Response,
|
||||
> {
|
||||
let command = $cmd_name { $($arg_name,)* ..Default::default() };
|
||||
let command = $cmd_name { $($arg_name $(: $arg_value)?,)* ..Default::default() };
|
||||
self.run_command(command)
|
||||
}
|
||||
};
|
||||
|
@ -178,7 +183,7 @@ impl SonicChannel {
|
|||
bucket: &'a str,
|
||||
object: &'a str,
|
||||
text: &'a str,
|
||||
locale: Option<&'a str>,
|
||||
locale: &'a str => Some(locale),
|
||||
);
|
||||
|
||||
use FlushCommand for fn flushc<'a>(
|
||||
|
@ -198,15 +203,15 @@ impl SonicChannel {
|
|||
collection: &'a str,
|
||||
bucket: &'a str,
|
||||
terms: &'a str,
|
||||
limit: Option<usize>,
|
||||
limit: usize => Some(limit),
|
||||
);
|
||||
|
||||
use QueryCommand for fn query_with_limit_and_offset<'a>(
|
||||
collection: &'a str,
|
||||
bucket: &'a str,
|
||||
terms: &'a str,
|
||||
limit: Option<usize>,
|
||||
offset: Option<usize>,
|
||||
limit: usize => Some(limit),
|
||||
offset: usize => Some(limit),
|
||||
);
|
||||
|
||||
use SuggestCommand for fn suggest<'a>(
|
||||
|
@ -219,7 +224,7 @@ impl SonicChannel {
|
|||
collection: &'a str,
|
||||
bucket: &'a str,
|
||||
word: &'a str,
|
||||
limit: Option<usize>,
|
||||
limit: usize => Some(limit),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue