1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
use crate::database::DatabaseWrapper;
use crate::database::song::Song;
use crate::database::artist::Artist;
use crate::database::album::Album;
impl DatabaseWrapper {
pub async fn search_results_by_id(
&self,
id: &str,
) -> (
Result<Option<Artist>, sqlx::Error>,
Result<Option<Album>, sqlx::Error>,
Result<Option<Song>, sqlx::Error>,
) {
(
self.select_artist_by_id(id).await,
self.select_album_by_id(id).await,
self.select_song_by_id(id).await,
)
}
pub async fn search_results_by_name(
&self,
name: &str,
) -> (
Result<Vec<Artist>, sqlx::Error>,
Result<Vec<Album>, sqlx::Error>,
Result<Vec<Song>, sqlx::Error>,
) {
return (
self.select_artists_by_name(name).await,
self.select_albums_by_name(name).await,
self.select_songs_by_name(name).await,
);
}
}
|