sea_schema/postgres/discovery/executor/
mock.rs

1use crate::sqlx_types::{postgres::PgRow, PgPool};
2use sea_query::{PostgresQueryBuilder, SelectStatement};
3
4use crate::{debug_print, sqlx_types::SqlxError};
5
6#[allow(dead_code)]
7pub struct Executor {
8    pool: PgPool,
9}
10
11pub trait IntoExecutor {
12    fn into_executor(self) -> Executor;
13}
14
15impl IntoExecutor for PgPool {
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<PgRow>, SqlxError> {
23        let (_sql, _values) = select.build(PostgresQueryBuilder);
24        debug_print!("{}, {:?}", _sql, _values);
25
26        panic!("This is a mock Executor");
27    }
28}