pub struct Json<T: Sized>(pub T);
Expand description
Wrapper type that implements Json data handling for postgres diesel connection
Use as wrapper for fields that are stored in Jsonb format
ⓘ
#[derive(serde::Serialize, serde::Deserialize, Debug)]
pub struct ComplexStruct {
// ...
}
#[derive(serde::Serialize, serde::Deserialize,
diesel::Queryable, diesel::Insertable)]
pub struct ExampleTable {
// Field that will be stored in Json, Jsonb format
pub jsonb_field: diesel_json::Json<ComplexStruct>,
}
Tuple Fields§
§0: T
Implementations§
Trait Implementations§
Source§impl<'expr, T: Sized> AsExpression<Jsonb> for &'expr Json<T>
impl<'expr, T: Sized> AsExpression<Jsonb> for &'expr Json<T>
Source§type Expression = Bound<Jsonb, &'expr Json<T>>
type Expression = Bound<Jsonb, &'expr Json<T>>
The expression being returned
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
Source§impl<T: Sized> AsExpression<Jsonb> for Json<T>
impl<T: Sized> AsExpression<Jsonb> for Json<T>
Source§type Expression = Bound<Jsonb, Json<T>>
type Expression = Bound<Jsonb, Json<T>>
The expression being returned
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
Source§impl<'expr, T: Sized> AsExpression<Nullable<Jsonb>> for &'expr Json<T>
impl<'expr, T: Sized> AsExpression<Nullable<Jsonb>> for &'expr Json<T>
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
Source§impl<T: Sized> AsExpression<Nullable<Jsonb>> for Json<T>
impl<T: Sized> AsExpression<Nullable<Jsonb>> for Json<T>
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
Source§impl<'de, T> Deserialize<'de> for Json<T>where
T: Deserialize<'de> + Sized,
impl<'de, T> Deserialize<'de> for Json<T>where
T: Deserialize<'de> + Sized,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Sized, __ST, __DB> FromSqlRow<__ST, __DB> for Json<T>
impl<T: Sized, __ST, __DB> FromSqlRow<__ST, __DB> for Json<T>
Source§const FIELDS_NEEDED: usize = 1usize
const FIELDS_NEEDED: usize = 1usize
The number of fields that this type will consume. Must be equal to
the number of times you would call
row.take()
in build_from_row
Auto Trait Implementations§
impl<T> Freeze for Json<T>where
T: Freeze,
impl<T> RefUnwindSafe for Json<T>where
T: RefUnwindSafe,
impl<T> Send for Json<T>where
T: Send,
impl<T> Sync for Json<T>where
T: Sync,
impl<T> Unpin for Json<T>where
T: Unpin,
impl<T> UnwindSafe for Json<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
Convert
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
Convert
&self
to an expression for Diesel’s query builder. Read more