perf: avoid cloning when checking access
This commit is contained in:
parent
7b86706793
commit
2864196584
2 changed files with 3 additions and 3 deletions
|
@ -15,10 +15,10 @@ pub fn web() -> Scope {
|
|||
.service(refresh::res)
|
||||
}
|
||||
|
||||
pub async fn check_access_token(access_token: String, pool: sqlx::Pool<Postgres>) -> Result<Uuid, HttpResponse> {
|
||||
pub async fn check_access_token<'a>(access_token: String, pool: &'a sqlx::Pool<Postgres>) -> Result<Uuid, HttpResponse> {
|
||||
match sqlx::query_as("SELECT CAST(uuid as VARCHAR), created FROM access_tokens WHERE token = $1")
|
||||
.bind(&access_token)
|
||||
.fetch_one(&pool)
|
||||
.fetch_one(&*pool)
|
||||
.await {
|
||||
Ok(row) => {
|
||||
let (uuid, created): (String, i64) = row;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue