mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-29 05:07:23 +01:00
editor: Add basic work structure
This commit is contained in:
parent
bdf8ed989d
commit
3eed04d04b
3 changed files with 51 additions and 6 deletions
|
|
@ -38,6 +38,11 @@ pub fn connect(file_name: &str) -> Result<SqliteConnection> {
|
|||
Ok(connection)
|
||||
}
|
||||
|
||||
/// Generate a random string suitable as an item ID.
|
||||
pub fn generate_id() -> String {
|
||||
uuid::Uuid::new_v4().simple().to_string()
|
||||
}
|
||||
|
||||
/// A single translated string value.
|
||||
#[derive(Serialize, Deserialize, AsExpression, FromSqlRow, Clone, Default, Debug)]
|
||||
#[diesel(sql_type = Text)]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub struct Work {
|
|||
}
|
||||
|
||||
// TODO: Handle part composers.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct WorkPart {
|
||||
pub work_id: String,
|
||||
pub level: u8,
|
||||
|
|
@ -113,6 +113,13 @@ impl PartialEq for Composer {
|
|||
}
|
||||
}
|
||||
|
||||
impl Eq for WorkPart {}
|
||||
impl PartialEq for WorkPart {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.work_id == other.work_id
|
||||
}
|
||||
}
|
||||
|
||||
impl Work {
|
||||
pub fn from_table(data: tables::Work, connection: &mut SqliteConnection) -> Result<Self> {
|
||||
fn visit_children(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue