Whui
This commit is contained in:
parent
96033b4b9f
commit
9609a80f7f
4 changed files with 120 additions and 93 deletions
|
@ -12,7 +12,11 @@ struct AppState {
|
|||
#[derive(Clone, Copy)]
|
||||
enum Store {
|
||||
Aldi,
|
||||
Edeka,
|
||||
Dm,
|
||||
Lidl,
|
||||
Rewe,
|
||||
Tegut,
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for Store {
|
||||
|
@ -21,7 +25,11 @@ impl TryFrom<&str> for Store {
|
|||
fn try_from(s: &str) -> Result<Self, Self::Error> {
|
||||
match s {
|
||||
"aldi" => Ok(Store::Aldi),
|
||||
"edeka" => Ok(Store::Edeka),
|
||||
"dm" => Ok(Store::Dm),
|
||||
"lidl" => Ok(Store::Lidl),
|
||||
"rewe" => Ok(Store::Rewe),
|
||||
"tegut" => Ok(Store::Tegut),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +39,11 @@ impl ToSql for Store {
|
|||
fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
|
||||
match self {
|
||||
Store::Aldi => 0.to_sql(),
|
||||
Store::Rewe => 1.to_sql(),
|
||||
Store::Edeka => 1.to_sql(),
|
||||
Store::Dm => 2.to_sql(),
|
||||
Store::Lidl => 3.to_sql(),
|
||||
Store::Rewe => 4.to_sql(),
|
||||
Store::Tegut => 5.to_sql(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue