sea_schema/sqlx_types/
mock.rs1#![allow(dead_code)]
2
3pub struct MySqlPool;
4
5pub mod mysql {
6 pub struct MySqlRow;
7}
8
9pub struct PgPool;
10
11pub mod postgres {
12 pub struct PgRow;
13}
14
15pub struct SqlitePool;
16
17pub mod sqlite {
18 pub struct SqliteRow;
19}
20
21pub trait Row {}
22
23#[derive(Debug)]
24pub struct Error;
25
26#[derive(Debug)]
27pub enum SqlxError {
28 RowNotFound,
29 PoolClosed,
30}
31
32pub enum SqlxRow {
33 SqlxMySql(mysql::MySqlRow),
34 SqlxPostgres(postgres::PgRow),
35 SqlxSqlite(sqlite::SqliteRow),
36}
37
38impl SqlxRow {
39 pub fn mysql(self) -> mysql::MySqlRow {
40 match self {
41 Self::SqlxMySql(row) => row,
42 _ => panic!("Not SqlxMySql"),
43 }
44 }
45
46 pub fn postgres(self) -> postgres::PgRow {
47 match self {
48 Self::SqlxPostgres(row) => row,
49 _ => panic!("Not SqlxPostgres"),
50 }
51 }
52
53 pub fn sqlite(self) -> sqlite::SqliteRow {
54 match self {
55 Self::SqlxSqlite(row) => row,
56 _ => panic!("Not SqlxSqlite"),
57 }
58 }
59}