pub trait DbFunction<T>:
Clone
+ Send
+ Sync
+ 'static {
// Required method
fn name(&self, dialect: Dialect) -> Result<Cow<'static, str>, QueryError>;
// Provided methods
fn validate(
&self,
_dialect: Dialect,
_arity: usize,
) -> Result<(), QueryError> { ... }
fn supports_window(&self) -> bool { ... }
}Expand description
Dialect-aware typed SQL function.
Implement this for reusable functions such as unaccent, JSON helpers, or
project-specific database functions. The renderer validates the function
for the active dialect before writing SQL.
Required Methods§
Provided Methods§
Sourcefn validate(&self, _dialect: Dialect, _arity: usize) -> Result<(), QueryError>
fn validate(&self, _dialect: Dialect, _arity: usize) -> Result<(), QueryError>
Validates dialect support and argument count.
Sourcefn supports_window(&self) -> bool
fn supports_window(&self) -> bool
Whether this function can be rendered with OVER (...).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".