32 lines
530 B
Rust
32 lines
530 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
|
pub struct Service {
|
|
pub name: String,
|
|
|
|
id: Option<u64>,
|
|
}
|
|
|
|
impl Service {
|
|
pub fn new(name: &str) -> Self {
|
|
Self {
|
|
name: name.to_string(),
|
|
id: None,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl j_db::model::JdbModel for Service {
|
|
fn id(&self) -> Option<u64> {
|
|
self.id
|
|
}
|
|
|
|
fn set_id(&mut self, id: u64) {
|
|
self.id = Some(id)
|
|
}
|
|
|
|
fn tree() -> String {
|
|
"Service".to_string()
|
|
}
|
|
}
|