Provides a wrapper diesel_json::Json
type that can be directly used
to wrap serde serializable, deserializable structures and recognize them
as queryable, insertable JsonB fields.
Wrap data structures into diesel_json::Json
type.
```rust
struct ComplexStruct { // ... }
struct ExampleTable {
// ...
// Field that will be stored in Jsonb format
jsonbfield: dieseljson::Json
Json
type provides new
function for object initialization, implements Deref
,
DerefMut
, AsRef
, AsMut
that maps data access directly to underlying data.
Without wrapper type for each unique type you store as JsonB field you
would need to use serde_json::Value
directly
or implement your own implementation for following traits:
rust
impl<T> FromSql<sql_types::JsonB, Pg> for Json<T> {}
impl<T> ToSql<sql_types::JsonB, Pg> for Json<T> {}