♻️ update
This commit is contained in:
parent
9f95060806
commit
e9d9ac4d9a
4 changed files with 55 additions and 22 deletions
|
@ -300,13 +300,26 @@ pub async fn index_document(doc: &Document) {
|
|||
pub struct DocumentIndex {}
|
||||
|
||||
impl DocumentIndex {
|
||||
pub async fn get_documents_of_day(day: NaiveDate) -> HashMap<String, Vec<String>> {
|
||||
let res: Vec<(String, String)> =
|
||||
pub async fn get_documents_of_day(
|
||||
day: NaiveDate,
|
||||
domain: Option<&str>,
|
||||
) -> HashMap<String, Vec<String>> {
|
||||
let res: Vec<(String, String)> = if let Some(domain) = domain {
|
||||
sqlx::query_as(
|
||||
"SELECT domain, path FROM document_index WHERE version = $1 WHERE domain = $2",
|
||||
)
|
||||
.bind(day)
|
||||
.bind(domain)
|
||||
.fetch_all(get_pg!())
|
||||
.await
|
||||
.unwrap()
|
||||
} else {
|
||||
sqlx::query_as("SELECT domain, path FROM document_index WHERE version = $1")
|
||||
.bind(day)
|
||||
.fetch_all(get_pg!())
|
||||
.await
|
||||
.unwrap();
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let mut ret = HashMap::new();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue