pub enum Dialect {
Sqlite,
Postgres,
}Expand description
SQL dialect for code generation.
Selected at compile time via the postgres feature flag.
Dialect::CURRENT resolves to the active dialect.
Variants§
Implementations§
Source§impl Dialect
impl Dialect
pub const fn as_str(self) -> &'static str
Sourcepub fn param(self, index: usize) -> String
pub fn param(self, index: usize) -> String
Positional parameter placeholder for this dialect.
SQLite uses ?N, Postgres uses $N.
Sourcepub fn map_default(self, default: &str) -> String
pub fn map_default(self, default: &str) -> String
Translate SQLite-specific default expressions to their Postgres equivalents.
Unknown defaults pass through unchanged.
Sourcepub const fn now_epoch(self) -> &'static str
pub const fn now_epoch(self) -> &'static str
SQL expression for the current Unix epoch in seconds.
Postgres: extract(epoch from now())::bigint; SQLite/libsql: unixepoch().
Use this instead of hardcoding the Postgres form in raw SQL / set_expr.
Sourcepub fn quote_ident(self, ident: &str) -> String
pub fn quote_ident(self, ident: &str) -> String
Quote a SQL identifier (table name, column name).
Both SQLite and Postgres use double quotes for identifiers.
Trait Implementations§
impl Copy for Dialect
impl Eq for Dialect
impl StructuralPartialEq for Dialect
Auto Trait Implementations§
impl Freeze for Dialect
impl RefUnwindSafe for Dialect
impl Send for Dialect
impl Sync for Dialect
impl Unpin for Dialect
impl UnsafeUnpin for Dialect
impl UnwindSafe for Dialect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more