mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 15:19:58 -07:00
query: add count param
This commit is contained in:
@@ -40,13 +40,27 @@ fn req_to_response_res(
|
||||
format,
|
||||
from,
|
||||
index,
|
||||
to,
|
||||
mut to,
|
||||
count,
|
||||
values,
|
||||
}): AxumQuery<Params>,
|
||||
AppState { query, .. }: AppState,
|
||||
) -> color_eyre::Result<Response> {
|
||||
let index = Index::try_from(index.as_str())?;
|
||||
|
||||
if to.is_none() {
|
||||
if let Some(c) = count {
|
||||
let c = c as i64;
|
||||
if let Some(f) = from {
|
||||
if f.is_positive() || f.abs() > c {
|
||||
to.replace(f + c);
|
||||
}
|
||||
} else {
|
||||
to.replace(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let vecs = query.search(
|
||||
index,
|
||||
&values.iter().map(|v| v.as_str()).collect::<Vec<_>>(),
|
||||
|
||||
Reference in New Issue
Block a user