Skip to content

Commit 852981a

Browse files
committed
Use sqlx::Encode implementation for GithubRepoName
I didn't know how to do it before, but I found the right syntax now.
1 parent 3bbf558 commit 852981a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/database/operations.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ FROM pull_request as pr
5151
WHERE pr.repository = $1
5252
AND pr.number = $2
5353
"#,
54-
repo.to_string(),
54+
repo as &GithubRepoName,
5555
pr_number.0 as i32
5656
)
5757
.fetch_optional(executor)
@@ -69,7 +69,7 @@ pub(crate) async fn create_pull_request(
6969
INSERT INTO pull_request (repository, number)
7070
VALUES ($1, $2) ON CONFLICT DO NOTHING
7171
"#,
72-
repo.to_string(),
72+
repo as &GithubRepoName,
7373
pr_number.0 as i32
7474
)
7575
.execute(executor)
@@ -210,7 +210,7 @@ INSERT INTO build (repository, branch, commit_sha, parent, status)
210210
VALUES ($1, $2, $3, $4, $5)
211211
RETURNING id
212212
"#,
213-
repo.to_string(),
213+
repo as &GithubRepoName,
214214
branch,
215215
commit_sha.0,
216216
parent.0,
@@ -243,7 +243,7 @@ WHERE repository = $1
243243
AND branch = $2
244244
AND commit_sha = $3
245245
"#,
246-
repo.to_string(),
246+
repo as &GithubRepoName,
247247
branch,
248248
commit_sha.0
249249
)
@@ -271,7 +271,7 @@ FROM build
271271
WHERE repository = $1
272272
AND status = $2
273273
"#,
274-
repo.to_string(),
274+
repo as &GithubRepoName,
275275
BuildStatus::Pending as BuildStatus
276276
)
277277
.fetch_all(executor)
@@ -470,7 +470,7 @@ pub(crate) async fn get_repository(
470470
FROM repository
471471
WHERE name = $1
472472
"#,
473-
repo.to_string()
473+
repo as &GithubRepoName
474474
)
475475
.fetch_optional(executor)
476476
.await?;
@@ -495,7 +495,7 @@ pub(crate) async fn upsert_repository(
495495
ON CONFLICT (name)
496496
DO UPDATE SET tree_state = EXCLUDED.tree_state, treeclosed_src = EXCLUDED.treeclosed_src
497497
"#,
498-
repo.to_string(),
498+
repo as &GithubRepoName,
499499
priority,
500500
src
501501
)

0 commit comments

Comments
 (0)