opentalk_diesel_newtype/
lib.rs

1// SPDX-FileCopyrightText: OpenTalk GmbH <mail@opentalk.eu>
2//
3// SPDX-License-Identifier: EUPL-1.2
4
5use std::{
6    fmt::{Debug, Display},
7    hash::Hash,
8};
9
10use diesel::{
11    deserialize::{FromSql, FromSqlRow},
12    expression::{AsExpression, TypedExpressionType},
13    pg::Pg,
14    sql_types::{SingleValue, SqlType},
15};
16use serde::{de::DeserializeOwned, Serialize};
17
18#[doc(hidden)]
19pub mod __exports {
20    pub use diesel;
21}
22
23pub use opentalk_diesel_newtype_impl::DieselNewtype;
24
25pub trait DieselNewtype<T>:
26    Debug
27    + Display
28    + Clone
29    + PartialEq
30    + Eq
31    + PartialOrd
32    + Ord
33    + Hash
34    + Serialize
35    + DeserializeOwned
36    + AsExpression<T>
37    + FromSqlRow<T, Pg>
38where
39    T: SqlType + TypedExpressionType + SingleValue,
40    Self: FromSql<T, Pg>,
41{
42}