Cleaned up imports.
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::database::{
|
||||
common::{Delete, Upsert},
|
||||
dtos::transaction::TransactionRow,
|
||||
};
|
||||
use super::dtos::{Delete, TransactionRow, Upsert};
|
||||
|
||||
pub struct Query {
|
||||
pub limit: Option<i64>,
|
||||
pub offset: Option<i64>,
|
||||
}
|
||||
|
||||
pub async fn query_transactions<'e, E>(
|
||||
executor: E,
|
||||
query: Query,
|
||||
) -> Result<Vec<TransactionRow>, sqlx::Error>
|
||||
pub async fn query<'e, E>(executor: E, query: Query) -> Result<Vec<TransactionRow>, sqlx::Error>
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
@@ -33,10 +27,7 @@ where
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn get_transaction_by_id<'e, E>(
|
||||
executor: E,
|
||||
id: Uuid,
|
||||
) -> Result<Option<TransactionRow>, sqlx::Error>
|
||||
pub async fn get_by_id<'e, E>(executor: E, id: Uuid) -> Result<Option<TransactionRow>, sqlx::Error>
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
@@ -53,7 +44,7 @@ where
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn upsert_transaction<'e, E>(
|
||||
pub async fn upsert<'e, E>(
|
||||
executor: E,
|
||||
transaction: TransactionRow,
|
||||
) -> Result<Upsert<TransactionRow>, sqlx::Error>
|
||||
@@ -101,7 +92,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn delete_transaction_by_id<'e, E>(executor: E, id: Uuid) -> Result<Delete, sqlx::Error>
|
||||
pub async fn delete_by_id<'e, E>(executor: E, id: Uuid) -> Result<Delete, sqlx::Error>
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user