1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-10-01 08:44:09 +02:00

command help

This commit is contained in:
Robin Appelman 2025-09-01 18:17:06 +02:00
commit f928547ac2
6 changed files with 350 additions and 106 deletions

View file

@ -9,26 +9,26 @@ use std::io::{stdout, Stdout};
use std::net::IpAddr;
use std::str::FromStr;
use std::time::Duration;
use strum::{Display, EnumIter, EnumProperty, IntoStaticStr};
use tokio::time::{sleep, timeout};
#[derive(Eq, PartialEq)]
#[derive(Eq, PartialEq, IntoStaticStr, Copy, Clone, EnumIter, EnumProperty, Display)]
#[strum(serialize_all = "lowercase")]
pub enum DatabaseFamily {
Sqlite,
#[strum(props(Versions = "5 5.6 5.7 8"))]
Mysql,
#[strum(props(Versions = "10 10.1 10.2 10.3 10.4 10.5"))]
MariaDB,
#[strum(props(Versions = "9 10 11 12 13 14"))]
Postgres,
#[strum(props(Versions = "21"))]
Oracle,
}
impl DatabaseFamily {
pub fn name(&self) -> &'static str {
match self {
DatabaseFamily::Sqlite => "sqlite",
DatabaseFamily::Mysql => "mysql",
DatabaseFamily::MariaDB => "mariadb",
DatabaseFamily::Postgres => "pgsql",
DatabaseFamily::Oracle => "oci",
}
self.into()
}
}
@ -96,6 +96,7 @@ impl FromStr for Database {
"postgresql:13" => Ok(Database::Postgres13),
"postgresql:14" => Ok(Database::Postgres14),
"oracle" => Ok(Database::Oracle),
"oracle:21" => Ok(Database::Oracle),
"oci" => Ok(Database::Oracle),
_ => Err(Report::msg("Unknown db type")),
}