INNER CODE UNIT · Rust
new_in_memory_with_credit_bypass_voters
zly2006/zhihu-plus-plus · aigc-vote-server/src/lib.rs:45
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,
credit_bypass_voters: HashSet<String>,
) -> Result<Self, ServiceError> {
Ok(Self {
store: Arc::new(PostgresVoteStore::connect(database_url, credit_bypass_voters).await?),