Skip to content

Commit bce52c9

Browse files
committed
Fixed outdated dummy
1 parent 1e31c0e commit bce52c9

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

src/dummy_impl/database.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use rorm_sql::value::Value;
22

3+
use super::{no_sqlx, NotInstantiable};
34
use crate::database::{Database, DatabaseConfiguration};
45
use crate::error::Error;
56
use crate::row::Row;
67
use crate::transaction::Transaction;
78

8-
use super::{no_sqlx, NotInstantiable};
9-
109
pub(crate) type Impl = NotInstantiable;
1110

1211
/// Implementation of [Database::connect]
@@ -19,7 +18,7 @@ pub async fn raw_sql<'a>(
1918
db: &Database,
2019
_query_string: &'a str,
2120
_bind_params: Option<&[Value<'a>]>,
22-
_transaction: Option<&mut Transaction<'_>>,
21+
_transaction: Option<&mut Transaction>,
2322
) -> Result<Vec<Row>, Error> {
2423
// "Read" pool at least once
2524
let _ = db.pool;

src/dummy_impl/executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::executor::{
1212
AffectedRows, All, Executor, Nothing, One, Optional, QueryStrategy, QueryStrategyResult, Stream,
1313
};
1414
use crate::row::Row;
15-
use crate::transaction::Transaction;
15+
use crate::transaction::{Transaction, TransactionGuard};
1616

1717
impl<'executor> Executor<'executor> for &'executor Database {
1818
fn execute<'data, 'result, Q>(
@@ -40,7 +40,7 @@ impl<'executor> Executor<'executor> for &'executor Database {
4040
no_sqlx();
4141
}
4242
}
43-
impl<'executor> Executor<'executor> for &'executor mut Transaction<'_> {
43+
impl<'executor> Executor<'executor> for &'executor mut Transaction {
4444
fn execute<'data, 'result, Q>(
4545
self,
4646
_query: String,

src/dummy_impl/transaction.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
use super::{no_sqlx, NotInstantiable};
12
use crate::transaction::Transaction;
23
use crate::Error;
34

4-
use super::{no_sqlx, NotInstantiable};
5-
65
pub(crate) type Impl = NotInstantiable;
76

87
/// Implementation of [Transaction::commit]
9-
pub(crate) async fn commit(transaction: Transaction<'_>) -> Result<(), Error> {
8+
pub(crate) async fn commit(transaction: Transaction) -> Result<(), Error> {
109
// "Read" tx at least once
1110
let _ = transaction.tx;
1211
no_sqlx();
1312
}
1413

1514
/// Implementation of [Transaction::rollback]
16-
pub(crate) async fn rollback(_transaction: Transaction<'_>) -> Result<(), Error> {
15+
pub(crate) async fn rollback(_transaction: Transaction) -> Result<(), Error> {
1716
no_sqlx();
1817
}

src/error.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,24 @@
22
33
use std::{error, fmt};
44

5-
#[cfg(feature = "sqlx")]
6-
use sqlx::Error as SqlxError;
7-
85
#[cfg(not(feature = "sqlx"))]
9-
const _: () = {
6+
mod sqlx {
107
/// Represent all ways a method can fail within SQLx.
118
///
129
/// I.e. not at all since sqlx isn't a dependency.
1310
#[derive(Debug)]
14-
pub enum SqlxError {}
11+
pub enum Error {}
1512

16-
impl error::Error for Error {}
13+
impl std::error::Error for Error {}
1714

18-
impl fmt::Display for Error {
19-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15+
impl std::fmt::Display for Error {
16+
fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
2017
unreachable!("You shouldn't be able to get an instance of an empty enum!");
2118
}
2219
}
23-
};
20+
}
21+
22+
use sqlx::Error as SqlxError;
2423

2524
/// Error type to simplify propagating different error types.
2625
#[derive(Debug)]

0 commit comments

Comments
 (0)