feat: setup forgeflux forge type in DB
This commit is contained in:
parent
66e9ec20f9
commit
d1606fa2ac
1 changed files with 5 additions and 0 deletions
|
@ -309,6 +309,8 @@ impl Clone for Box<dyn SCDatabase> {
|
||||||
pub enum ForgeImplementation {
|
pub enum ForgeImplementation {
|
||||||
/// [Gitea](https://gitea.io) softare forge
|
/// [Gitea](https://gitea.io) softare forge
|
||||||
Gitea,
|
Gitea,
|
||||||
|
/// [ForgeFlux](https://net.forgeflux.net)
|
||||||
|
ForgeFlux,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ForgeImplementation {
|
impl ForgeImplementation {
|
||||||
|
@ -316,6 +318,7 @@ impl ForgeImplementation {
|
||||||
pub const fn to_str(&self) -> &'static str {
|
pub const fn to_str(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
ForgeImplementation::Gitea => "gitea",
|
ForgeImplementation::Gitea => "gitea",
|
||||||
|
ForgeImplementation::ForgeFlux => "forgeflux",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,9 +329,11 @@ impl FromStr for ForgeImplementation {
|
||||||
/// Convert [str] to [ForgeImplementation]
|
/// Convert [str] to [ForgeImplementation]
|
||||||
fn from_str(s: &str) -> DBResult<Self> {
|
fn from_str(s: &str) -> DBResult<Self> {
|
||||||
const GITEA: &str = ForgeImplementation::Gitea.to_str();
|
const GITEA: &str = ForgeImplementation::Gitea.to_str();
|
||||||
|
const FORGEFLUX: &str = ForgeImplementation::ForgeFlux.to_str();
|
||||||
let s = s.trim();
|
let s = s.trim();
|
||||||
match s {
|
match s {
|
||||||
GITEA => Ok(Self::Gitea),
|
GITEA => Ok(Self::Gitea),
|
||||||
|
FORGEFLUX => Ok(Self::ForgeFlux),
|
||||||
_ => Err(DBError::UnknownForgeType(s.to_owned())),
|
_ => Err(DBError::UnknownForgeType(s.to_owned())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue