Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit ac362e8e authored by Christian Raphael Heryanto's avatar Christian Raphael Heryanto
Browse files

Implement delete function in Subscriber repository.

parent 63f53fff
No related branches found
No related tags found
No related merge requests found
......@@ -29,4 +29,16 @@ impl SubscriberRepository {
return SUBSCRIBERS.get(product_type).unwrap().iter()
.map(|f| f.value().clone()).collect();
}
pub fn delete(product_type: &str, url: &str) -> Option<Subscriber> {
if SUBSCRIBERS.get(product_type).is_none() {
SUBSCRIBERS.insert(String::from(product_type), DashMap::new());
}
let result = SUBSCRIBERS.get(product_type).unwrap()
.remove(url);
if !result.is_none() {
return Some(result.unwrap().1);
}
return None;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment