use journio_core::dialect::{Dialect, DialectName};
#[derive(Debug, Default, Clone, Copy)]
pub struct PostgresDialect;
impl Dialect for PostgresDialect {
fn name(&self) -> DialectName {
DialectName::Postgres
}
fn schema_prefix(&self, schema: &str) -> String {
format!("\"{}\".", schema)
}
fn rewrite_query(&self, query: &str) -> String {
query.to_string()
}
fn lock_skip_locked(&self) -> &str {
"FOR UPDATE SKIP LOCKED"
}
fn lock_nowait(&self) -> &str {
"FOR UPDATE NOWAIT"
}
fn supports_listen_notify(&self) -> bool {
true
}
fn supports_array_parameters(&self) -> bool {
true
}
fn supports_data_modifying_cte(&self) -> bool {
true
}
}
pub fn sanitize_identifier(ident: &str) -> String {
format!("\"{}\"", ident.replace('"', "\"\""))
}