Skip to content

Commit

Permalink
Fix config flags
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich committed Jan 22, 2024
1 parent a016cc7 commit e6db7d7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions diesel_derives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1634,38 +1634,40 @@ pub fn table_proc(input: TokenStream) -> TokenStream {
/// in your enum, and the backend generated by this derive called MultiBackend.
/// For example to support `diesel::sql_types::TimestamptzSqlite` with the `time` crate:
/// ```
/// # #[cfg(all(feature = "sqlite", feature = "time"))]
/// # fn main() {
/// use diesel::backend::Backend;
/// use diesel::deserialize::{self, FromSql};
/// use diesel::serialize::{self, IsNull, ToSql};
/// use diesel::sql_types::HasSqlType;
///
/// #[derive(diesel::MultiConnection)]
/// pub enum AnyConnection {
/// # #[cfg(feature = "sqlite")]
/// Sqlite(diesel::SqliteConnection),
/// }
///
/// # #[cfg(all("sqlite", "time"))]
/// impl HasSqlType<diesel::sql_types::TimestamptzSqlite> for MultiBackend {
/// fn metadata(lookup: &mut Self::MetadataLookup) -> Self::TypeMetadata {
/// MultiBackend::lookup_sql_type::<diesel::sql_types::TimestamptzSqlite>(lookup)
/// }
/// }
///
/// # #[cfg(all("sqlite", "time"))]
/// impl FromSql<diesel::sql_types::TimestamptzSqlite, MultiBackend> for time::OffsetDateTime {
/// fn from_sql(bytes: <MultiBackend as Backend>::RawValue<'_>) -> deserialize::Result<Self> {
/// bytes.from_sql::<time::OffsetDateTime, diesel::sql_types::TimestamptzSqlite>()
/// }
/// }
///
/// # #[cfg(all("sqlite", "time"))]
/// impl ToSql<diesel::sql_types::TimestamptzSqlite, MultiBackend> for time::OffsetDateTime {
/// fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, MultiBackend>) -> serialize::Result {
/// out.set_value((diesel::sql_types::TimestamptzSqlite, self));
/// Ok(IsNull::No)
/// }
/// }
/// # }
///
/// # #[cfg(not(all(feature = "sqlite", feature = "time")))]
/// # fn main() {}
/// ```
#[proc_macro_derive(MultiConnection)]
pub fn derive_multiconnection(input: TokenStream) -> TokenStream {
Expand Down

0 comments on commit e6db7d7

Please sign in to comment.