2019-04-09 18:55:53 -04:00
|
|
|
//! Database Driver for Postgres
|
|
|
|
//!
|
|
|
|
//! Contains database-specific query data
|
2019-04-02 16:35:52 -04:00
|
|
|
use super::*;
|
|
|
|
|
2019-04-09 18:55:53 -04:00
|
|
|
/// The struct implementing the `DatabaseDriver` trait
|
2019-04-02 16:35:52 -04:00
|
|
|
#[derive(Debug)]
|
2019-04-12 17:09:59 -04:00
|
|
|
pub struct PostgresDriver;
|
2019-04-02 16:35:52 -04:00
|
|
|
|
2019-04-12 17:09:59 -04:00
|
|
|
impl PostgresDriver {
|
|
|
|
/// Create a PostgresDriver driver
|
2019-04-09 14:13:37 -04:00
|
|
|
pub fn new() -> Self {
|
2019-04-12 17:09:59 -04:00
|
|
|
PostgresDriver {}
|
2019-04-02 16:35:52 -04:00
|
|
|
}
|
2019-04-04 16:39:05 -04:00
|
|
|
}
|
2019-04-09 14:13:37 -04:00
|
|
|
|
2019-04-12 17:09:59 -04:00
|
|
|
impl DatabaseDriver for PostgresDriver {
|
|
|
|
fn explain(&self, sql: &str) -> String {
|
2019-04-17 09:09:31 -04:00
|
|
|
format!("EXPLAIN VERBOSE {}", sql)
|
2019-04-12 17:09:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fn random(&self) -> String {
|
|
|
|
String::from(" RANDOM()")
|
|
|
|
}
|
|
|
|
}
|