Update book

This commit is contained in:
Sunli 2021-12-09 20:20:51 +08:00
parent d7c92a596a
commit 9cced48733
2 changed files with 0 additions and 2 deletions

View File

@ -81,7 +81,6 @@ impl Loader<u64> for UserNameLoader {
type Error = Arc<sqlx::Error>;
async fn load(&self, keys: &[u64]) -> Result<HashMap<u64, Self::Value>, Self::Error> {
let pool = ctx.data_unchecked::<Pool<Postgres>>();
let query = format!("SELECT name FROM user WHERE id IN ({})", keys.iter().join(","));
Ok(sqlx::query_as(query)
.fetch(&self.pool)

View File

@ -79,7 +79,6 @@ impl Loader<u64> for UserNameLoader {
type Error = Arc<sqlx::Error>;
async fn load(&self, keys: &[u64]) -> Result<HashMap<u64, Self::Value>, Self::Error> {
let pool = ctx.data_unchecked::<Pool<Postgres>>();
let query = format!("SELECT name FROM user WHERE id IN ({})", keys.iter().join(","));
Ok(sqlx::query_as(query)
.fetch(&self.pool)