aboutsummaryrefslogtreecommitdiff
path: root/src/util/mod.rs
blob: c939b95371dfe888daca17e73aa88d21dbc71bd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use log::error;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};

pub fn log_err(e: sqlx::Error) -> sqlx::Error {
    error!("{:?}", e);
    e
}
pub fn generate_random_url_safe(n: usize) -> String {
    thread_rng()
        .sample_iter(&Alphanumeric)
        .take(n)
        .map(char::from)
        .collect()
}