Skip to main content

SqlDialect

Trait SqlDialect 

Source
pub trait SqlDialect: Dialect {
    // Required methods
    fn compile_search_expression(
        b: &mut Builder<Self>,
        attribute: &str,
        values: &Array,
        not: bool,
    ) -> Result<String>;
    fn compile_spatial_distance(
        b: &mut Builder<Self>,
        method: Method,
        attribute: &str,
        values: &Array,
    ) -> Result<String>;
    fn compile_spatial_predicate(
        b: &mut Builder<Self>,
        function: &str,
        attribute: &str,
        values: &Array,
        not: bool,
    ) -> Result<String>;
    fn compile_spatial_covers_predicate(
        b: &mut Builder<Self>,
        attribute: &str,
        values: &Array,
        not: bool,
    ) -> Result<String>;
    fn compile_json_contains_expression(
        b: &mut Builder<Self>,
        attribute: &str,
        values: &Array,
        not: bool,
    ) -> Result<String>;
    fn compile_json_overlaps_expression(
        b: &mut Builder<Self>,
        attribute: &str,
        values: &Array,
    ) -> Result<String>;
    fn compile_json_path_expression(
        b: &mut Builder<Self>,
        attribute: &str,
        values: &Array,
    ) -> Result<String>;
    fn compile_conflict_header(b: &mut Builder<Self>) -> Result<String>;
    fn compile_conflict_assignment(wrapped: &str) -> String;

    // Provided methods
    fn compile_spatial_filter(
        b: &mut Builder<Self>,
        method: Method,
        attribute: &str,
        query: &Query,
    ) -> Result<String> { ... }
    fn compile_array_filter(
        b: &mut Builder<Self>,
        method: Method,
        attribute: &str,
        query: &Query,
    ) -> Result<String> { ... }
}
Expand description

The hooks a SQL dialect implements: how it compiles search, spatial and JSON predicates, and its conflict clause.

Required Methods§

Source

fn compile_search_expression( b: &mut Builder<Self>, attribute: &str, values: &Array, not: bool, ) -> Result<String>

Full-text search on the wrapped attribute.

Source

fn compile_spatial_distance( b: &mut Builder<Self>, method: Method, attribute: &str, values: &Array, ) -> Result<String>

A distance* predicate.

Source

fn compile_spatial_predicate( b: &mut Builder<Self>, function: &str, attribute: &str, values: &Array, not: bool, ) -> Result<String>

A spatial predicate function (ST_Intersects, …), negated with NOT.

Source

fn compile_spatial_covers_predicate( b: &mut Builder<Self>, attribute: &str, values: &Array, not: bool, ) -> Result<String>

covers / notCovers (MySQL ST_Contains, PostgreSQL ST_Covers).

Source

fn compile_json_contains_expression( b: &mut Builder<Self>, attribute: &str, values: &Array, not: bool, ) -> Result<String>

jsonContains / jsonNotContains.

Source

fn compile_json_overlaps_expression( b: &mut Builder<Self>, attribute: &str, values: &Array, ) -> Result<String>

jsonOverlaps.

Source

fn compile_json_path_expression( b: &mut Builder<Self>, attribute: &str, values: &Array, ) -> Result<String>

jsonPath.

Source

fn compile_conflict_header(b: &mut Builder<Self>) -> Result<String>

The start of the conflict clause (ON DUPLICATE KEY UPDATE).

Source

fn compile_conflict_assignment(wrapped: &str) -> String

The new value of a conflicting column (VALUES(col), excluded.col).

Provided Methods§

Source

fn compile_spatial_filter( b: &mut Builder<Self>, method: Method, attribute: &str, query: &Query, ) -> Result<String>

A spatial filter (MariaDB checks units first).

Source

fn compile_array_filter( b: &mut Builder<Self>, method: Method, attribute: &str, query: &Query, ) -> Result<String>

A filter on an array attribute (contains on arrays, …).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§