INNER CODE UNIT · Rust
new_in_memory
zly2006/zhihu-plus-plus · aigc-vote-server/src/lib.rs:41
pub fn new_in_memory() -> Result<Self, ServiceError> {
Self::new_in_memory_with_credit_bypass_voters(HashSet::new())
}
pub fn new_in_memory_with_credit_bypass_voters(
credit_bypass_voters: HashSet<String>,
) -> Result<Self, ServiceError> {
Ok(Self {
store: Arc::new(MemoryVoteStore::new(credit_bypass_voters)),
})
}
pub async fn new_postgres(database_url: &str) -> Result<Self, ServiceError> {
Self::new_postgres_with_credit_bypass_voters(database_url, HashSet::new()).await
}
pub async fn new_postgres_with_credit_bypass_voters(
database_url: &str,