Skip to main content

Dialect

Trait Dialect 

Source
pub trait Dialect {
    // Required method
    fn write_placeholder(&self, sql: &mut String, index: usize);
}
Expand description

Backend SQL dialect.

The cratestack renderers produce dialect-agnostic SQL for everything except parameter placeholder syntax: Postgres uses $1, $2, ... while SQLite uses ?1, ?2, ... (also valid: ? for positional). Implementors own that one decision and the backend crates plug in their own impl.

Kept deliberately narrow — adding methods here forces every backend to implement them, which is the wrong default. New dialect-specific quirks should live in the backend’s own renderer until at least two backends agree on the shape.

Required Methods§

Source

fn write_placeholder(&self, sql: &mut String, index: usize)

Write a numbered placeholder for bind index index (1-based) into sql. Postgres writes $N; SQLite writes ?N.

Implementors§