(
&self,
options: QueryablePlaylist,
inclusive: bool,
conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
)
| 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(); |
no test coverage detected