Skip to main content

DbExpression

Trait DbExpression 

Source
pub trait DbExpression<T>:
    Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn render(&self, ctx: &mut ExprRenderCtx<'_>) -> Result<String, QueryError>;

    // Provided methods
    fn args(&self) -> FunctionArgs { ... }
    fn validate(&self, _dialect: Dialect) -> Result<(), QueryError> { ... }
}
Expand description

Advanced hook for typed custom expressions.

Prefer DbFunction for ordinary function calls. Use this hook when a dialect-specific expression cannot be represented as name(arg, ...).

Required Methods§

Source

fn render(&self, ctx: &mut ExprRenderCtx<'_>) -> Result<String, QueryError>

Renders this expression with pre-rendered child expression access.

Provided Methods§

Source

fn args(&self) -> FunctionArgs

Returns child expressions used by this custom expression.

Source

fn validate(&self, _dialect: Dialect) -> Result<(), QueryError>

Validates dialect support before rendering.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§