mirror of https://github.com/TaKO8Ki/gobang
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
776 B
Rust
30 lines
776 B
Rust
pub mod mysql;
|
|
pub mod postgres;
|
|
|
|
pub use mysql::MySqlPool;
|
|
pub use postgres::PostgresPool;
|
|
|
|
use async_trait::async_trait;
|
|
use database_tree::{Child, Database, Table};
|
|
|
|
pub const RECORDS_LIMIT_PER_PAGE: u8 = 200;
|
|
|
|
#[async_trait]
|
|
pub trait Pool {
|
|
async fn get_databases(&self) -> anyhow::Result<Vec<Database>>;
|
|
async fn get_tables(&self, database: String) -> anyhow::Result<Vec<Child>>;
|
|
async fn get_records(
|
|
&self,
|
|
database: &Database,
|
|
table: &Table,
|
|
page: u16,
|
|
filter: Option<String>,
|
|
) -> anyhow::Result<(Vec<String>, Vec<Vec<String>>)>;
|
|
async fn get_columns(
|
|
&self,
|
|
database: &Database,
|
|
table: &Table,
|
|
) -> anyhow::Result<(Vec<String>, Vec<Vec<String>>)>;
|
|
async fn close(&self);
|
|
}
|