Skip to content

Commit

Permalink
Merge pull request #9 from samudradev/master
Browse files Browse the repository at this point in the history
Merge conflict
  • Loading branch information
Thaza-Kun authored Jul 14, 2024
2 parents 72792f8 + 420dc06 commit cf93574
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions backend/database/src/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ pub struct Connection<DB: sqlx::Database> {
pub pool: sqlx::Pool<DB>,
}

// impl<DB> From<sqlx::Pool<DB>> for Connection<DB> {
// fn from(value: sqlx::Pool<DB>) -> Self {
// Self { pool: value }
// }
// }

/// Counts of selected items.
#[allow(missing_docs)]
#[derive(Debug, Clone, Default, serde::Serialize, PartialEq, ts_rs::TS)]
Expand Down Expand Up @@ -65,7 +59,7 @@ impl Connection<sqlx::Postgres> {
/// ```sql
#[doc = include_str!("../transactions/postgres/count_items.sql")]
/// ```
pub async fn statistics(&self) -> Result<Counts<i64>> {
pub async fn statistics(self) -> Result<Counts<i64>> {
let inter: Counts<Option<i64>> =
sqlx::query_file_as!(Counts, "transactions/postgres/count_items.sql")
.fetch_one(&self.pool)
Expand Down Expand Up @@ -110,7 +104,7 @@ impl Connection<sqlx::Sqlite> {
/// ```sql
#[doc = include_str!("../transactions/sqlite/count_items.sql")]
/// ```
pub async fn statistics(&self) -> Result<Counts<i32>> {
pub async fn statistics(self) -> Result<Counts<i32>> {
sqlx::query_file_as!(Counts, "transactions/sqlite/count_items.sql")
.fetch_one(&self.pool)
.await
Expand All @@ -123,7 +117,7 @@ impl Connection<sqlx::Sqlite> {
/// ```sql
/// SELECT nama AS item FROM golongan_kata
/// ```
pub async fn get_golongan_kata_enumeration(&self) -> Result<Vec<StringItem>> {
pub async fn get_golongan_kata_enumeration(self) -> Result<Vec<StringItem>> {
sqlx::query_as!(StringItem, "SELECT nama AS item FROM golongan_kata")
.fetch_all(&self.pool)
.await
Expand Down

0 comments on commit cf93574

Please sign in to comment.