MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / get_account

Method get_account

ch_10/src/store.rs:232–252  ·  view source on GitHub ↗
(
        self,
        email: String,
    )

Source from the content-addressed store, hash-verified

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

Callers 1

loginFunction · 0.45

Calls 1

AccountIdClass · 0.50

Tested by

no test coverage detected