sea_schema/sqlite/executor/
mock.rs

1use crate::sqlx_types::{sqlite::SqliteRow, SqlitePool};
2use sea_query::{SelectStatement, SqliteQueryBuilder};
3
4use crate::{debug_print, sqlx_types::SqlxError};
5
6#[allow(dead_code)]
7pub struct Executor {
8    pool: SqlitePool,
9}
10
11pub trait IntoExecutor {
12    fn into_executor(self) -> Executor;
13}
14
15impl IntoExecutor for SqlitePool {
16    fn into_executor(self) -> Executor {
17        Executor { pool: self }
18    }
19}
20
21impl Executor {
22    pub async fn fetch_all(&self, select: SelectStatement) -> Result<Vec<SqliteRow>, SqlxError> {
23        let (_sql, _values) = select.build(SqliteQueryBuilder);
24        debug_print!("{}, {:?}", _sql, _values);
25
26        panic!("This is a mock Executor");
27    }
28
29    pub async fn fetch_one(&self, select: SelectStatement) -> Result<SqliteRow, SqlxError> {
30        let (_sql, _values) = select.build(SqliteQueryBuilder);
31        debug_print!("{}, {:?}", _sql, _values);
32
33        panic!("This is a mock Executor");
34    }
35
36    pub async fn fetch_all_raw(&self, _sql: String) -> Result<Vec<SqliteRow>, SqlxError> {
37        debug_print!("{}", _sql);
38
39        panic!("This is a mock Executor");
40    }
41}