mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Use access time in some selectors
For now, only persons, instruments and ensembles will be ordered by access time.
This commit is contained in:
parent
3064f18323
commit
3a27113bda
9 changed files with 34 additions and 7 deletions
|
|
@ -64,4 +64,13 @@ impl Database {
|
|||
let ensembles = ensembles::table.load::<Ensemble>(&self.connection)?;
|
||||
Ok(ensembles)
|
||||
}
|
||||
|
||||
/// Get recently used ensembles.
|
||||
pub fn get_recent_ensembles(&self) -> Result<Vec<Ensemble>> {
|
||||
let ensembles = ensembles::table
|
||||
.order(ensembles::last_used.desc())
|
||||
.load::<Ensemble>(&self.connection)?;
|
||||
|
||||
Ok(ensembles)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,13 @@ impl Database {
|
|||
|
||||
Ok(instruments)
|
||||
}
|
||||
|
||||
/// Get recently used instruments.
|
||||
pub fn get_recent_instruments(&self) -> Result<Vec<Instrument>> {
|
||||
let instruments = instruments::table
|
||||
.order(instruments::last_used.desc())
|
||||
.load::<Instrument>(&self.connection)?;
|
||||
|
||||
Ok(instruments)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,4 +77,13 @@ impl Database {
|
|||
|
||||
Ok(persons)
|
||||
}
|
||||
|
||||
/// Get recently used persons.
|
||||
pub fn get_recent_persons(&self) -> Result<Vec<Person>> {
|
||||
let persons = persons::table
|
||||
.order(persons::last_used.desc())
|
||||
.load::<Person>(&self.connection)?;
|
||||
|
||||
Ok(persons)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue