MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / get_account

Method get_account

ch_09/src/store.rs:235–255  ·  view source on GitHub ↗
(
        self,
        email: String,
    )

Source from the content-addressed store, hash-verified

233 }
234
235 pub async fn get_account(
236 self,
237 email: String,
238 ) -> Result<Account, Error> {
239 match sqlx::query("SELECT * from accounts where email = $1")
240 .bind(email)
241 .map(|row: PgRow| Account {
242 id: Some(AccountId(row.get("id"))),
243 email: row.get("email"),
244 password: row.get("password"),
245 })
246 .fetch_one(&self.connection)
247 .await
248 {
249 Ok(account) => Ok(account),
250 Err(error) => {
251 tracing::event!(tracing::Level::ERROR, "{:?}", error);
252 Err(Error::DatabaseQueryError(error))
253 }
254 }
255 }
256}

Callers 1

loginFunction · 0.45

Calls 1

AccountIdClass · 0.50

Tested by

no test coverage detected