@@ -142,7 +142,10 @@ pub type BindCollector<'a, DB> = <DB as HasBindCollector<'a>>::BindCollector;
142142/// a custom `QueryFragment<YourBackend, YourSpecialSyntaxType>` implementation
143143/// to specialize on generic `QueryFragment<DB, DB::AssociatedType>` implementations.
144144///
145- /// See the [`sql_dialect`] module for options provided by diesel out of the box.
145+ #[ cfg_attr(
146+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
147+ doc = "See the [`sql_dialect`] module for options provided by diesel out of the box."
148+ ) ]
146149pub trait SqlDialect : self :: private:: TrustedBackend {
147150 /// Configures how this backends supports `RETURNING` clauses
148151 ///
@@ -157,21 +160,30 @@ pub trait SqlDialect: self::private::TrustedBackend {
157160 doc = "implementation for `ReturningClause`"
158161 ) ]
159162 ///
160- /// See [`sql_dialect::returning_clause`] for provided default implementations
163+ #[ cfg_attr(
164+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
165+ doc = "See [`sql_dialect::returning_clause`] for provided default implementations"
166+ ) ]
161167 type ReturningClause ;
162168 /// Configures how this backend supports `ON CONFLICT` clauses
163169 ///
164170 /// This allows backends to opt in `ON CONFLICT` clause support
165171 ///
166- /// See [`sql_dialect::on_conflict_clause`] for provided default implementations
172+ #[ cfg_attr(
173+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
174+ doc = "See [`sql_dialect::on_conflict_clause`] for provided default implementations"
175+ ) ]
167176 type OnConflictClause ;
168177 /// Configures how this backend handles the bare `DEFAULT` keyword for
169178 /// inserting the default value in a `INSERT INTO` `VALUES` clause
170179 ///
171180 /// This allows backends to opt in support for `DEFAULT` value expressions
172181 /// for insert statements
173182 ///
174- /// See [`sql_dialect::default_keyword_for_insert`] for provided default implementations
183+ #[ cfg_attr(
184+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
185+ doc = "See [`sql_dialect::default_keyword_for_insert`] for provided default implementations"
186+ ) ]
175187 type InsertWithDefaultKeyword ;
176188 /// Configures how this backend handles Batch insert statements
177189 ///
@@ -185,7 +197,10 @@ pub trait SqlDialect: self::private::TrustedBackend {
185197 doc = "implementation for `BatchInsert`"
186198 ) ]
187199 ///
188- /// See [`sql_dialect::batch_insert_support`] for provided default implementations
200+ #[ cfg_attr(
201+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
202+ doc = "See [`sql_dialect::batch_insert_support`] for provided default implementations"
203+ ) ]
189204 type BatchInsertSupport ;
190205 /// Configures how this backend handles the `DEFAULT VALUES` clause for
191206 /// insert statements.
@@ -200,7 +215,10 @@ pub trait SqlDialect: self::private::TrustedBackend {
200215 doc = "implementation for `DefaultValues`"
201216 ) ]
202217 ///
203- /// See [`sql_dialect::default_value_clause`] for provided default implementations
218+ #[ cfg_attr(
219+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
220+ doc = "See [`sql_dialect::default_value_clause`] for provided default implementations"
221+ ) ]
204222 type DefaultValueClauseForInsert ;
205223 /// Configures how this backend handles empty `FROM` clauses for select statements.
206224 ///
@@ -214,7 +232,10 @@ pub trait SqlDialect: self::private::TrustedBackend {
214232 doc = "implementation for `NoFromClause`"
215233 ) ]
216234 ///
217- /// See [`sql_dialect::from_clause_syntax`] for provided default implementations
235+ #[ cfg_attr(
236+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
237+ doc = "See [`sql_dialect::from_clause_syntax`] for provided default implementations"
238+ ) ]
218239 type EmptyFromClauseSyntax ;
219240 /// Configures how this backend handles `EXISTS()` expressions.
220241 ///
@@ -228,7 +249,10 @@ pub trait SqlDialect: self::private::TrustedBackend {
228249 doc = "implementation for `Exists`"
229250 ) ]
230251 ///
231- /// See [`sql_dialect::exists_syntax`] for provided default implementations
252+ #[ cfg_attr(
253+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
254+ doc = "See [`sql_dialect::exists_syntax`] for provided default implementations"
255+ ) ]
232256 type ExistsSyntax ;
233257
234258 /// Configures how this backend handles `IN()` and `NOT IN()` expressions.
@@ -245,18 +269,43 @@ pub trait SqlDialect: self::private::TrustedBackend {
245269 doc = "implementations for `In`, `NotIn` and `Many`"
246270 ) ]
247271 ///
248- /// See `[sql_dialect::array_comparison`] for provided default implementations
249- type ArrayComparision ;
272+ #[ cfg_attr(
273+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ,
274+ doc = "See [`sql_dialect::array_comparison`] for provided default implementations"
275+ ) ]
276+ type ArrayComparison ;
250277}
251278
252279/// This module contains all options provided by diesel to configure the [`SqlDialect`] trait.
253- pub mod sql_dialect {
280+ // This module is only public behind the unstable feature flag, as we may want to change SqlDialect
281+ // implementations of existing backends because of:
282+ // * The backend gained support for previously unsupported SQL operations
283+ // * The backend fixed/introduced a bug that requires special handling
284+ // * We got some edge case wrong with sharing the implementation between backends
285+ //
286+ // By not exposing these types publically we are able to change the exact definitions later on
287+ // as users cannot write trait bounds that ensure that a specific type is used in place of
288+ // an existing associated type.
289+ #[ diesel_derives:: __diesel_public_if(
290+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
291+ ) ]
292+ pub ( crate ) mod sql_dialect {
293+ #![ cfg_attr(
294+ not( feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes" ) ,
295+ // Otherwise there are false positives
296+ // because the lint seems to believe that these pub statements
297+ // are not required, but they are required through the various backend impls
298+ allow( unreachable_pub)
299+ ) ]
254300 #[ cfg( doc) ]
255301 use super :: SqlDialect ;
256302
257303 /// This module contains all diesel provided reusable options to
258304 /// configure [`SqlDialect::OnConflictClause`]
259- pub mod on_conflict_clause {
305+ #[ diesel_derives:: __diesel_public_if(
306+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
307+ ) ]
308+ pub ( crate ) mod on_conflict_clause {
260309 /// A marker trait indicating if a `ON CONFLICT` clause is supported or not
261310 ///
262311 /// If you use a custom type to specify specialized support for `ON CONFLICT` clauses
@@ -271,7 +320,10 @@ pub mod sql_dialect {
271320
272321 /// This module contains all reusable options to configure
273322 /// [`SqlDialect::ReturningClause`]
274- pub mod returning_clause {
323+ #[ diesel_derives:: __diesel_public_if(
324+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
325+ ) ]
326+ pub ( crate ) mod returning_clause {
275327 /// A marker trait indicating if a `RETURNING` clause is supported or not
276328 ///
277329 /// If you use custom type to specify specialized support for `RETURNING` clauses
@@ -292,7 +344,10 @@ pub mod sql_dialect {
292344
293345 /// This module contains all reusable options to configure
294346 /// [`SqlDialect::InsertWithDefaultKeyword`]
295- pub mod default_keyword_for_insert {
347+ #[ diesel_derives:: __diesel_public_if(
348+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
349+ ) ]
350+ pub ( crate ) mod default_keyword_for_insert {
296351 /// A marker trait indicating if a `DEFAULT` like expression
297352 /// is supported as part of `INSERT INTO` clauses to indicate
298353 /// that a default value should be inserted at a specific position
@@ -318,7 +373,10 @@ pub mod sql_dialect {
318373
319374 /// This module contains all reusable options to configure
320375 /// [`SqlDialect::BatchInsertSupport`]
321- pub mod batch_insert_support {
376+ #[ diesel_derives:: __diesel_public_if(
377+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
378+ ) ]
379+ pub ( crate ) mod batch_insert_support {
322380 /// A marker trait indicating if batch insert statements
323381 /// are supported for this backend or not
324382 pub trait SupportsBatchInsert { }
@@ -341,7 +399,10 @@ pub mod sql_dialect {
341399
342400 /// This module contains all reusable options to configure
343401 /// [`SqlDialect::DefaultValueClauseForInsert`]
344- pub mod default_value_clause {
402+ #[ diesel_derives:: __diesel_public_if(
403+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
404+ ) ]
405+ pub ( crate ) mod default_value_clause {
345406
346407 /// Indicates that this backend uses the
347408 /// `DEFAULT VALUES` syntax to specify
@@ -353,7 +414,10 @@ pub mod sql_dialect {
353414
354415 /// This module contains all reusable options to configure
355416 /// [`SqlDialect::EmptyFromClauseSyntax`]
356- pub mod from_clause_syntax {
417+ #[ diesel_derives:: __diesel_public_if(
418+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
419+ ) ]
420+ pub ( crate ) mod from_clause_syntax {
357421
358422 /// Indicates that this backend skips
359423 /// the `FROM` clause in `SELECT` statements
@@ -364,7 +428,10 @@ pub mod sql_dialect {
364428
365429 /// This module contains all reusable options to configure
366430 /// [`SqlDialect::ExistsSyntax`]
367- pub mod exists_syntax {
431+ #[ diesel_derives:: __diesel_public_if(
432+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
433+ ) ]
434+ pub ( crate ) mod exists_syntax {
368435
369436 /// Indicates that this backend
370437 /// treats `EXIST()` as function
@@ -374,8 +441,11 @@ pub mod sql_dialect {
374441 }
375442
376443 /// This module contains all reusable options to configure
377- /// [`SqlDialect::ArrayComparision`]
378- pub mod array_comparision {
444+ /// [`SqlDialect::ArrayComparison`]
445+ #[ diesel_derives:: __diesel_public_if(
446+ feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
447+ ) ]
448+ pub ( crate ) mod array_comparison {
379449
380450 /// Indicates that this backend requires a single bind
381451 /// per array element in `IN()` and `NOT IN()` expression
0 commit comments