Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 26c7793

Browse files
committed
[ci skip] format queries
1 parent 60c04a2 commit 26c7793

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/models.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,14 @@ impl Extension {
199199

200200
pub async fn all(database: &crate::database::Database) -> Result<Vec<Self>, sqlx::Error> {
201201
let rows = sqlx::query(&format!(
202-
"SELECT {} FROM extensions JOIN authors ON extensions.author_id = authors.id WHERE NOT extensions.hidden AND NOT extensions.pending",
202+
r#"
203+
SELECT {}
204+
FROM extensions
205+
JOIN authors ON extensions.author_id = authors.id
206+
WHERE
207+
NOT extensions.hidden
208+
AND NOT extensions.pending
209+
"#,
203210
Self::columns()
204211
))
205212
.fetch_all(database.read())
@@ -210,7 +217,15 @@ impl Extension {
210217

211218
pub async fn by_id(database: &crate::database::Database, id: i32) -> Option<Self> {
212219
let row = sqlx::query(&format!(
213-
"SELECT {} FROM extensions JOIN authors ON extensions.author_id = authors.id WHERE extensions.id = $1 AND NOT extensions.hidden AND NOT extensions.pending",
220+
r#"
221+
SELECT {}
222+
FROM extensions
223+
JOIN authors ON extensions.author_id = authors.id
224+
WHERE
225+
extensions.id = $1
226+
AND NOT extensions.hidden
227+
AND NOT extensions.pending
228+
"#,
214229
Self::columns()
215230
))
216231
.bind(id)
@@ -226,7 +241,15 @@ impl Extension {
226241
identifier: &str,
227242
) -> Option<Self> {
228243
let row = sqlx::query(&format!(
229-
"SELECT {} FROM extensions JOIN authors ON extensions.author_id = authors.id WHERE extensions.identifier = $1 AND NOT extensions.hidden AND NOT extensions.pending",
244+
r#"
245+
SELECT {}
246+
FROM extensions
247+
JOIN authors ON extensions.author_id = authors.id
248+
WHERE
249+
extensions.identifier = $1
250+
AND NOT extensions.hidden
251+
AND NOT extensions.pending
252+
"#,
230253
Self::columns()
231254
))
232255
.bind(identifier)

0 commit comments

Comments
 (0)