File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -17,34 +17,33 @@ impl DatabaseBackend {
17
17
}
18
18
19
19
pub ( super ) async fn exists ( & self , path : & str ) -> Result < bool > {
20
- Ok ( sqlx:: query !(
20
+ Ok ( sqlx:: query_scalar !(
21
21
r#"SELECT COUNT(*) > 0 as "has_count!" FROM files WHERE path = $1"# ,
22
22
path
23
23
)
24
24
. fetch_one ( & self . pool )
25
- . await ?
26
- . has_count )
25
+ . await ?)
27
26
}
28
27
29
28
pub ( super ) async fn get_public_access ( & self , path : & str ) -> Result < bool > {
30
- match sqlx:: query !(
31
- "SELECT public
32
- FROM files
29
+ match sqlx:: query_scalar !(
30
+ "SELECT public
31
+ FROM files
33
32
WHERE path = $1" ,
34
33
path
35
34
)
36
35
. fetch_optional ( & self . pool )
37
36
. await ?
38
37
{
39
- Some ( row ) => Ok ( row . public ) ,
38
+ Some ( public ) => Ok ( public) ,
40
39
None => Err ( super :: PathNotFoundError . into ( ) ) ,
41
40
}
42
41
}
43
42
44
43
pub ( super ) async fn set_public_access ( & self , path : & str , public : bool ) -> Result < ( ) > {
45
44
if sqlx:: query!(
46
- "UPDATE files
47
- SET public = $2
45
+ "UPDATE files
46
+ SET public = $2
48
47
WHERE path = $1" ,
49
48
path,
50
49
public,
You can’t perform that action at this time.
0 commit comments