feat: uniform hostname extraction for DB storage via get_hostname
This commit is contained in:
parent
6f21a8b49e
commit
4cd62dcb40
2 changed files with 8 additions and 0 deletions
|
@ -16,6 +16,7 @@ authors = ["Aravinth Manivannan <realaravinth@batsense.net>"]
|
|||
async-trait = "0.1.51"
|
||||
thiserror = "1.0.30"
|
||||
serde = { version = "1", features = ["derive"]}
|
||||
url = { version = "2.2.2", features = ["serde"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
pub mod errors;
|
||||
pub mod ops;
|
||||
|
@ -66,6 +67,12 @@ pub struct CreateForge<'a> {
|
|||
pub forge_type: ForgeImplementation,
|
||||
}
|
||||
|
||||
/// Get hostname from URL
|
||||
/// Utility function for uniform hostname format
|
||||
pub fn get_hostname(url: &Url) -> String {
|
||||
url.host().as_ref().unwrap().to_string()
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
/// add new user to database
|
||||
pub struct AddUser<'a> {
|
||||
|
|
Loading…
Reference in a new issue