Trait diesel::backend::SqlDialect
source · pub trait SqlDialect: TrustedBackend {
type ReturningClause;
type OnConflictClause;
type InsertWithDefaultKeyword;
type BatchInsertSupport;
type ConcatClause;
type DefaultValueClauseForInsert;
type EmptyFromClauseSyntax;
type ExistsSyntax;
type ArrayComparison;
type SelectStatementSyntax;
type AliasSyntax;
}
Expand description
This trait provides various options to configure the generated SQL for a specific backend.
Accessing anything from this trait is considered to be part of the public API. Implementing this trait is not considered to be part of diesel’s public API, as future versions of diesel may add additional associated constants here.
Each associated type is used to configure the behaviour
of one or more QueryFragment
implementations by providing
a custom QueryFragment<YourBackend, YourSpecialSyntaxType>
implementation
to specialize on generic QueryFragment<DB, DB::AssociatedType>
implementations.
See the sql_dialect
module for options provided by diesel out of the box.
Required Associated Types§
sourcetype ReturningClause
type ReturningClause
Configures how this backend supports RETURNING
clauses
This allows backends to opt in RETURNING
clause support and to
provide a custom QueryFragment
implementation for ReturningClause
See sql_dialect::returning_clause
for provided default implementations
sourcetype OnConflictClause
type OnConflictClause
Configures how this backend supports ON CONFLICT
clauses
This allows backends to opt in ON CONFLICT
clause support
See sql_dialect::on_conflict_clause
for provided default implementations
sourcetype InsertWithDefaultKeyword
type InsertWithDefaultKeyword
Configures how this backend handles the bare DEFAULT
keyword for
inserting the default value in a INSERT INTO
VALUES
clause
This allows backends to opt in support for DEFAULT
value expressions
for insert statements
See sql_dialect::default_keyword_for_insert
for provided default implementations
sourcetype BatchInsertSupport
type BatchInsertSupport
Configures how this backend handles Batch insert statements
This allows backends to provide a custom QueryFragment
implementation for BatchInsert
See sql_dialect::batch_insert_support
for provided default implementations
sourcetype ConcatClause
type ConcatClause
Configures how this backend handles the Concat clauses in select statements.
This allows backends to provide a custom QueryFragment
implementation for Concat
See sql_dialect::concat_clause
for provided default implementations
sourcetype DefaultValueClauseForInsert
type DefaultValueClauseForInsert
Configures how this backend handles the DEFAULT VALUES
clause for
insert statements.
This allows backends to provide a custom QueryFragment
implementation for DefaultValues
See sql_dialect::default_value_clause
for provided default implementations
sourcetype EmptyFromClauseSyntax
type EmptyFromClauseSyntax
Configures how this backend handles empty FROM
clauses for select statements.
This allows backends to provide a custom QueryFragment
implementation for NoFromClause
See sql_dialect::from_clause_syntax
for provided default implementations
sourcetype ExistsSyntax
type ExistsSyntax
Configures how this backend handles EXISTS()
expressions.
This allows backends to provide a custom QueryFragment
implementation for Exists
See sql_dialect::exists_syntax
for provided default implementations
sourcetype ArrayComparison
type ArrayComparison
Configures how this backend handles IN()
and NOT IN()
expressions.
This allows backends to provide custom QueryFragment
implementations for In
,
NotIn
and
Many
See sql_dialect::array_comparison
for provided default implementations
sourcetype SelectStatementSyntax
type SelectStatementSyntax
Configures how this backend structures SELECT
queries
This allows backends to provide custom QueryFragment
implementations for
See sql_dialect::select_statement_syntax
for provided default implementations
sourcetype AliasSyntax
type AliasSyntax
Configures how this backend structures SELECT
queries
This allows backends to provide custom QueryFragment
implementations for Alias<T>
See sql_dialect::alias_syntax
for provided default implementations