Lost refactor.
This commit is contained in:
@@ -19,23 +19,22 @@ pub async fn list<'e, E>(executor: E, query: Query) -> Result<Vec<Transaction>,
|
|||||||
where
|
where
|
||||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||||
{
|
{
|
||||||
let transactions = db::list(
|
let query = db::Query {
|
||||||
executor,
|
limit: query
|
||||||
db::Query {
|
.limit
|
||||||
limit: query
|
.map(|l| i64::try_from(l).map_err(|_| QueryConversionError::Limit(l)))
|
||||||
.limit
|
.transpose()?,
|
||||||
.map(|l| i64::try_from(l).map_err(|_| QueryConversionError::Limit(l)))
|
offset: query
|
||||||
.transpose()?,
|
.offset
|
||||||
offset: query
|
.map(|o| i64::try_from(o).map_err(|_| QueryConversionError::Offset(o)))
|
||||||
.offset
|
.transpose()?,
|
||||||
.map(|o| i64::try_from(o).map_err(|_| QueryConversionError::Offset(o)))
|
};
|
||||||
.transpose()?,
|
|
||||||
},
|
let transactions = db::list(executor, query)
|
||||||
)
|
.await?
|
||||||
.await?
|
.into_iter()
|
||||||
.into_iter()
|
.map(decode)
|
||||||
.map(decode)
|
.collect::<Result<_, DecodeError>>()?;
|
||||||
.collect::<Result<_, DecodeError>>()?;
|
|
||||||
|
|
||||||
Ok(transactions)
|
Ok(transactions)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user