working implementation of docker get
This commit is contained in:
@@ -83,6 +83,23 @@ pub trait PersistentCredential: for<'a> Deserialize<'a> + Sized {
|
||||
Self::from_row(row, crypto)
|
||||
}
|
||||
|
||||
async fn load_by<T>(column: &str, value: T, crypto: &Crypto, pool: &SqlitePool) -> Result<Self, LoadCredentialsError>
|
||||
where T: Send + for<'q> sqlx::Encode<'q, Sqlite> + sqlx::Type<Sqlite>
|
||||
{
|
||||
let query = format!(
|
||||
"SELECT * FROM {} where {} = ?",
|
||||
Self::table_name(),
|
||||
column,
|
||||
);
|
||||
let row: Self::Row = sqlx::query_as(&query)
|
||||
.bind(value)
|
||||
.fetch_optional(pool)
|
||||
.await?
|
||||
.ok_or(LoadCredentialsError::NoCredentials)?;
|
||||
|
||||
Self::from_row(row, crypto)
|
||||
}
|
||||
|
||||
async fn load_default(crypto: &Crypto, pool: &SqlitePool) -> Result<Self, LoadCredentialsError> {
|
||||
let q = format!(
|
||||
"SELECT details.*
|
||||
|
Reference in New Issue
Block a user