mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
database: Implement Hash for public structs
This commit is contained in:
parent
b17ffc5db9
commit
05b18db18a
6 changed files with 11 additions and 11 deletions
|
|
@ -5,7 +5,7 @@ use log::info;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// An ensemble that takes part in recordings.
|
||||
#[derive(Serialize, Deserialize, Insertable, Queryable, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Ensemble {
|
||||
pub id: String,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use log::info;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// An instrument or any other possible role within a recording.
|
||||
#[derive(Serialize, Deserialize, Insertable, Queryable, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Instrument {
|
||||
pub id: String,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
/// Representation of someting like a physical audio disc or a folder with
|
||||
/// audio files (i.e. a collection of tracks for one or more recordings).
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Medium {
|
||||
/// An unique ID for the medium.
|
||||
|
|
@ -24,7 +24,7 @@ pub struct Medium {
|
|||
}
|
||||
|
||||
/// A track on a medium.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Track {
|
||||
/// The recording on this track.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use log::info;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A person that is a composer, an interpret or both.
|
||||
#[derive(Serialize, Deserialize, Insertable, Queryable, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Person {
|
||||
pub id: String,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use log::info;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A specific recording of a work.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Recording {
|
||||
pub id: String,
|
||||
|
|
@ -40,7 +40,7 @@ impl Recording {
|
|||
}
|
||||
|
||||
/// How a person or ensemble was involved in a recording.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Performance {
|
||||
pub performer: PersonOrEnsemble,
|
||||
|
|
@ -62,7 +62,7 @@ impl Performance {
|
|||
}
|
||||
|
||||
/// Either a person or an ensemble.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Debug)]
|
||||
pub enum PersonOrEnsemble {
|
||||
Person(Person),
|
||||
Ensemble(Ensemble),
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ struct WorkSectionRow {
|
|||
pub before_index: i64,
|
||||
}
|
||||
/// A concrete work part that can be recorded.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WorkPart {
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
/// A heading between work parts.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WorkSection {
|
||||
pub title: String,
|
||||
|
|
@ -69,7 +69,7 @@ pub struct WorkSection {
|
|||
}
|
||||
|
||||
/// A specific work by a composer.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Work {
|
||||
pub id: String,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue