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

Method get_playlists

src-tauri/database/src/database.rs:452–488  ·  view source on GitHub ↗
(
        &self,
        options: QueryablePlaylist,
        inclusive: bool,
        conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
    )

Source from the content-addressed store, hash-verified

450
451 #[tracing::instrument(level = "debug", skip(self, conn))]
452 fn get_playlists(
453 &self,
454 options: QueryablePlaylist,
455 inclusive: bool,
456 conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
457 ) -> Result<Vec<QueryablePlaylist>> {
458 let mut predicate = schema::playlists::table.into_boxed();
459
460 trace!("Fetching playlists");
461 predicate = filter_field!(
462 predicate,
463 &options.playlist_id,
464 schema::playlists::playlist_id,
465 inclusive
466 );
467
468 predicate = filter_field_like!(
469 predicate,
470 if options.playlist_name.is_empty() {
471 None
472 } else {
473 Some(&options.playlist_name)
474 },
475 schema::playlists::playlist_name,
476 inclusive
477 );
478
479 predicate = filter_field_like!(
480 predicate,
481 &options.playlist_path,
482 schema::playlists::playlist_path,
483 inclusive
484 );
485
486 let fetched: Vec<QueryablePlaylist> = predicate.load(conn)?;
487 Ok(fetched)
488 }
489
490 pub fn is_song_in_playlist(&self, playlist_id: String, song_id: String) -> Result<bool> {
491 let mut conn = self.pool.get().unwrap();

Callers 5

create_playlistMethod · 0.80
get_entity_by_optionsMethod · 0.80
get_playlist_songsMethod · 0.80
search_allMethod · 0.80
export_playlistMethod · 0.80

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected