MCPcopy Create free account
hub / github.com/Moosync/Moosync / get_entity_by_options

Method get_entity_by_options

src-tauri/database/src/database.rs:507–550  ·  view source on GitHub ↗
(&self, options: GetEntityOptions)

Source from the content-addressed store, hash-verified

505
506 #[tracing::instrument(level = "debug", skip(self))]
507 pub fn get_entity_by_options(&self, options: GetEntityOptions) -> Result<Value> {
508 let mut conn = self.pool.get().unwrap();
509 let inclusive = options.inclusive.unwrap_or_default();
510
511 trace!("Getting entity by options");
512
513 if options.album.is_some() {
514 return Ok(serde_json::to_value(self.get_albums(
515 options.album.unwrap(),
516 inclusive,
517 &mut conn,
518 )?)
519 .unwrap());
520 }
521
522 if options.artist.is_some() {
523 return Ok(serde_json::to_value(self.get_artists(
524 options.artist.unwrap(),
525 inclusive,
526 &mut conn,
527 )?)
528 .unwrap());
529 }
530
531 if options.genre.is_some() {
532 return Ok(serde_json::to_value(self.get_genres(
533 options.genre.unwrap(),
534 inclusive,
535 &mut conn,
536 )?)
537 .unwrap());
538 }
539
540 if options.playlist.is_some() {
541 return Ok(serde_json::to_value(self.get_playlists(
542 options.playlist.unwrap(),
543 inclusive,
544 &mut conn,
545 )?)
546 .unwrap());
547 }
548
549 Ok(Value::Null)
550 }
551
552 #[tracing::instrument(level = "debug", skip(self, conn))]
553 pub fn get_album_songs(

Callers 4

test_playlist_operationsFunction · 0.80
test_album_operationsFunction · 0.80
test_artist_operationsFunction · 0.80
get_entityMethod · 0.80

Calls 5

getMethod · 0.80
get_albumsMethod · 0.80
get_artistsMethod · 0.80
get_genresMethod · 0.80
get_playlistsMethod · 0.80

Tested by 3

test_playlist_operationsFunction · 0.64
test_album_operationsFunction · 0.64
test_artist_operationsFunction · 0.64